提交 f8dcb5e3 编写于 作者: M Michal Schmidt 提交者: David S. Miller

bnx2x: remove {TPA,GRO}_ENABLE_FLAG

These flags are redundant with dev->features. Remove them.
Just make sure to set dev->features ourselves in bnx2x_set_features()
before performing the reload of the card.
Signed-off-by: NMichal Schmidt <mschmidt@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7e6b4d44
...@@ -1545,9 +1545,7 @@ struct bnx2x { ...@@ -1545,9 +1545,7 @@ struct bnx2x {
#define USING_MSIX_FLAG (1 << 5) #define USING_MSIX_FLAG (1 << 5)
#define USING_MSI_FLAG (1 << 6) #define USING_MSI_FLAG (1 << 6)
#define DISABLE_MSI_FLAG (1 << 7) #define DISABLE_MSI_FLAG (1 << 7)
#define TPA_ENABLE_FLAG (1 << 8)
#define NO_MCP_FLAG (1 << 9) #define NO_MCP_FLAG (1 << 9)
#define GRO_ENABLE_FLAG (1 << 10)
#define MF_FUNC_DIS (1 << 11) #define MF_FUNC_DIS (1 << 11)
#define OWN_CNIC_IRQ (1 << 12) #define OWN_CNIC_IRQ (1 << 12)
#define NO_ISCSI_OOO_FLAG (1 << 13) #define NO_ISCSI_OOO_FLAG (1 << 13)
......
...@@ -2477,9 +2477,9 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) ...@@ -2477,9 +2477,9 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index)
/* set the tpa flag for each queue. The tpa flag determines the queue /* set the tpa flag for each queue. The tpa flag determines the queue
* minimal size so it must be set prior to queue memory allocation * minimal size so it must be set prior to queue memory allocation
*/ */
if (bp->flags & TPA_ENABLE_FLAG) if (bp->dev->features & NETIF_F_LRO)
fp->mode = TPA_MODE_LRO; fp->mode = TPA_MODE_LRO;
else if (bp->flags & GRO_ENABLE_FLAG && else if (bp->dev->features & NETIF_F_GRO &&
bnx2x_mtu_allows_gro(bp->dev->mtu)) bnx2x_mtu_allows_gro(bp->dev->mtu))
fp->mode = TPA_MODE_GRO; fp->mode = TPA_MODE_GRO;
else else
...@@ -3249,7 +3249,7 @@ int bnx2x_low_latency_recv(struct napi_struct *napi) ...@@ -3249,7 +3249,7 @@ int bnx2x_low_latency_recv(struct napi_struct *napi)
if ((bp->state == BNX2X_STATE_CLOSED) || if ((bp->state == BNX2X_STATE_CLOSED) ||
(bp->state == BNX2X_STATE_ERROR) || (bp->state == BNX2X_STATE_ERROR) ||
(bp->flags & (TPA_ENABLE_FLAG | GRO_ENABLE_FLAG))) (bp->dev->features & (NETIF_F_LRO | NETIF_F_GRO)))
return LL_FLUSH_FAILED; return LL_FLUSH_FAILED;
if (!bnx2x_fp_lock_poll(fp)) if (!bnx2x_fp_lock_poll(fp))
...@@ -4840,19 +4840,9 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev, ...@@ -4840,19 +4840,9 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev,
int bnx2x_set_features(struct net_device *dev, netdev_features_t features) int bnx2x_set_features(struct net_device *dev, netdev_features_t features)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
u32 flags = bp->flags; netdev_features_t changes = features ^ dev->features;
u32 changes;
bool bnx2x_reload = false; bool bnx2x_reload = false;
int rc;
if (features & NETIF_F_LRO)
flags |= TPA_ENABLE_FLAG;
else
flags &= ~TPA_ENABLE_FLAG;
if (features & NETIF_F_GRO)
flags |= GRO_ENABLE_FLAG;
else
flags &= ~GRO_ENABLE_FLAG;
/* VFs or non SRIOV PFs should be able to change loopback feature */ /* VFs or non SRIOV PFs should be able to change loopback feature */
if (!pci_num_vf(bp->pdev)) { if (!pci_num_vf(bp->pdev)) {
...@@ -4869,24 +4859,23 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) ...@@ -4869,24 +4859,23 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features)
} }
} }
changes = flags ^ bp->flags;
/* if GRO is changed while LRO is enabled, don't force a reload */ /* if GRO is changed while LRO is enabled, don't force a reload */
if ((changes & GRO_ENABLE_FLAG) && (flags & TPA_ENABLE_FLAG)) if ((changes & NETIF_F_GRO) && (features & NETIF_F_LRO))
changes &= ~GRO_ENABLE_FLAG; changes &= ~NETIF_F_GRO;
/* if GRO is changed while HW TPA is off, don't force a reload */ /* if GRO is changed while HW TPA is off, don't force a reload */
if ((changes & GRO_ENABLE_FLAG) && bp->disable_tpa) if ((changes & NETIF_F_GRO) && bp->disable_tpa)
changes &= ~GRO_ENABLE_FLAG; changes &= ~NETIF_F_GRO;
if (changes) if (changes)
bnx2x_reload = true; bnx2x_reload = true;
bp->flags = flags;
if (bnx2x_reload) { if (bnx2x_reload) {
if (bp->recovery_state == BNX2X_RECOVERY_DONE) if (bp->recovery_state == BNX2X_RECOVERY_DONE) {
return bnx2x_reload_if_running(dev); dev->features = features;
rc = bnx2x_reload_if_running(dev);
return rc ? rc : 1;
}
/* else: bnx2x_nic_load() will be called at end of recovery */ /* else: bnx2x_nic_load() will be called at end of recovery */
} }
......
...@@ -3304,7 +3304,7 @@ static void bnx2x_pf_init(struct bnx2x *bp) ...@@ -3304,7 +3304,7 @@ static void bnx2x_pf_init(struct bnx2x *bp)
/* This flag is relevant for E1x only. /* This flag is relevant for E1x only.
* E2 doesn't have a TPA configuration in a function level. * E2 doesn't have a TPA configuration in a function level.
*/ */
flags |= (bp->flags & TPA_ENABLE_FLAG) ? FUNC_FLG_TPA : 0; flags |= (bp->dev->features & NETIF_F_LRO) ? FUNC_FLG_TPA : 0;
func_init.func_flgs = flags; func_init.func_flgs = flags;
func_init.pf_id = BP_FUNC(bp); func_init.pf_id = BP_FUNC(bp);
...@@ -12107,11 +12107,8 @@ static int bnx2x_init_bp(struct bnx2x *bp) ...@@ -12107,11 +12107,8 @@ static int bnx2x_init_bp(struct bnx2x *bp)
/* Set TPA flags */ /* Set TPA flags */
if (bp->disable_tpa) { if (bp->disable_tpa) {
bp->flags &= ~(TPA_ENABLE_FLAG | GRO_ENABLE_FLAG);
bp->dev->hw_features &= ~NETIF_F_LRO; bp->dev->hw_features &= ~NETIF_F_LRO;
bp->dev->features &= ~NETIF_F_LRO; bp->dev->features &= ~NETIF_F_LRO;
} else {
bp->flags |= (TPA_ENABLE_FLAG | GRO_ENABLE_FLAG);
} }
if (CHIP_IS_E1(bp)) if (CHIP_IS_E1(bp))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册