diff options
author | Yuval Mintz <yuvalmin@broadcom.com> | 2012-09-11 00:34:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-13 16:37:52 -0400 |
commit | 7b5342d9026d537cbc01fd30b7cd9bac9b07b5ad (patch) | |
tree | 8f26cbb5145f16a4f6bcd209c2ee1f064bade600 /drivers | |
parent | 2ace95103df2bcb574c9da5df96807e9b46f9b38 (diff) |
bnx2x: Add missing afex code
Commit a334872224a67b614dc888460377862621f3dac7 added afex support but lacked
several logical changes. This lack can cause afex to crash, and also
have a slight effect on other flows (i.e., driver always assumes the Tx ring
has less available buffers than what it actually has).
This patch adds the missing segments, fixing said issues.
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 21 |
2 files changed, 21 insertions, 11 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index 21b553229ea4..dfd86a55f1dc 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | |||
@@ -710,17 +710,15 @@ static inline u16 bnx2x_tx_avail(struct bnx2x *bp, | |||
710 | prod = txdata->tx_bd_prod; | 710 | prod = txdata->tx_bd_prod; |
711 | cons = txdata->tx_bd_cons; | 711 | cons = txdata->tx_bd_cons; |
712 | 712 | ||
713 | /* NUM_TX_RINGS = number of "next-page" entries | 713 | used = SUB_S16(prod, cons); |
714 | It will be used as a threshold */ | ||
715 | used = SUB_S16(prod, cons) + (s16)NUM_TX_RINGS; | ||
716 | 714 | ||
717 | #ifdef BNX2X_STOP_ON_ERROR | 715 | #ifdef BNX2X_STOP_ON_ERROR |
718 | WARN_ON(used < 0); | 716 | WARN_ON(used < 0); |
719 | WARN_ON(used > bp->tx_ring_size); | 717 | WARN_ON(used > txdata->tx_ring_size); |
720 | WARN_ON((bp->tx_ring_size - used) > MAX_TX_AVAIL); | 718 | WARN_ON((txdata->tx_ring_size - used) > MAX_TX_AVAIL); |
721 | #endif | 719 | #endif |
722 | 720 | ||
723 | return (s16)(bp->tx_ring_size) - used; | 721 | return (s16)(txdata->tx_ring_size) - used; |
724 | } | 722 | } |
725 | 723 | ||
726 | static inline int bnx2x_tx_queue_has_work(struct bnx2x_fp_txdata *txdata) | 724 | static inline int bnx2x_tx_queue_has_work(struct bnx2x_fp_txdata *txdata) |
@@ -1088,6 +1086,7 @@ static inline void bnx2x_init_txdata(struct bnx2x *bp, | |||
1088 | txdata->txq_index = txq_index; | 1086 | txdata->txq_index = txq_index; |
1089 | txdata->tx_cons_sb = tx_cons_sb; | 1087 | txdata->tx_cons_sb = tx_cons_sb; |
1090 | txdata->parent_fp = fp; | 1088 | txdata->parent_fp = fp; |
1089 | txdata->tx_ring_size = IS_FCOE_FP(fp) ? MAX_TX_AVAIL : bp->tx_ring_size; | ||
1091 | 1090 | ||
1092 | DP(NETIF_MSG_IFUP, "created tx data cid %d, txq %d\n", | 1091 | DP(NETIF_MSG_IFUP, "created tx data cid %d, txq %d\n", |
1093 | txdata->cid, txdata->txq_index); | 1092 | txdata->cid, txdata->txq_index); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 21054987257a..211753e01f81 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -7561,8 +7561,14 @@ int bnx2x_set_mac_one(struct bnx2x *bp, u8 *mac, | |||
7561 | } | 7561 | } |
7562 | 7562 | ||
7563 | rc = bnx2x_config_vlan_mac(bp, &ramrod_param); | 7563 | rc = bnx2x_config_vlan_mac(bp, &ramrod_param); |
7564 | if (rc < 0) | 7564 | |
7565 | if (rc == -EEXIST) { | ||
7566 | DP(BNX2X_MSG_SP, "Failed to schedule ADD operations: %d\n", rc); | ||
7567 | /* do not treat adding same MAC as error */ | ||
7568 | rc = 0; | ||
7569 | } else if (rc < 0) | ||
7565 | BNX2X_ERR("%s MAC failed\n", (set ? "Set" : "Del")); | 7570 | BNX2X_ERR("%s MAC failed\n", (set ? "Set" : "Del")); |
7571 | |||
7566 | return rc; | 7572 | return rc; |
7567 | } | 7573 | } |
7568 | 7574 | ||
@@ -10294,13 +10300,11 @@ static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp) | |||
10294 | dev_info.port_hw_config[port]. | 10300 | dev_info.port_hw_config[port]. |
10295 | fcoe_wwn_node_name_lower); | 10301 | fcoe_wwn_node_name_lower); |
10296 | } else if (!IS_MF_SD(bp)) { | 10302 | } else if (!IS_MF_SD(bp)) { |
10297 | u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg); | ||
10298 | |||
10299 | /* | 10303 | /* |
10300 | * Read the WWN info only if the FCoE feature is enabled for | 10304 | * Read the WWN info only if the FCoE feature is enabled for |
10301 | * this function. | 10305 | * this function. |
10302 | */ | 10306 | */ |
10303 | if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) | 10307 | if (BNX2X_MF_EXT_PROTOCOL_FCOE(bp) && !CHIP_IS_E1x(bp)) |
10304 | bnx2x_get_ext_wwn_info(bp, func); | 10308 | bnx2x_get_ext_wwn_info(bp, func); |
10305 | 10309 | ||
10306 | } else if (IS_MF_FCOE_SD(bp)) | 10310 | } else if (IS_MF_FCOE_SD(bp)) |
@@ -11073,7 +11077,14 @@ static int bnx2x_set_uc_list(struct bnx2x *bp) | |||
11073 | netdev_for_each_uc_addr(ha, dev) { | 11077 | netdev_for_each_uc_addr(ha, dev) { |
11074 | rc = bnx2x_set_mac_one(bp, bnx2x_uc_addr(ha), mac_obj, true, | 11078 | rc = bnx2x_set_mac_one(bp, bnx2x_uc_addr(ha), mac_obj, true, |
11075 | BNX2X_UC_LIST_MAC, &ramrod_flags); | 11079 | BNX2X_UC_LIST_MAC, &ramrod_flags); |
11076 | if (rc < 0) { | 11080 | if (rc == -EEXIST) { |
11081 | DP(BNX2X_MSG_SP, | ||
11082 | "Failed to schedule ADD operations: %d\n", rc); | ||
11083 | /* do not treat adding same MAC as error */ | ||
11084 | rc = 0; | ||
11085 | |||
11086 | } else if (rc < 0) { | ||
11087 | |||
11077 | BNX2X_ERR("Failed to schedule ADD operations: %d\n", | 11088 | BNX2X_ERR("Failed to schedule ADD operations: %d\n", |
11078 | rc); | 11089 | rc); |
11079 | return rc; | 11090 | return rc; |