diff options
author | stephen hemminger <stephen@networkplumber.org> | 2014-01-10 01:20:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-13 14:59:47 -0500 |
commit | a8f47eb701a562f6b5c81e2e0c143148915d7913 (patch) | |
tree | f4f1a2f2bea1537502313c5cdf70c35d08e2181a /drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |
parent | 6bc21eedcfbf35a087911578e7e30f98c5ece478 (diff) |
bnx2x: namespace and dead code cleanups
Fix a bunch of whole lot of namespace issues with the Broadcom bnx2x driver
found by running 'make namespacecheck'
* global variables must be prefixed with bnx2x_
naming a variable int_mode, or num_queue is invitation to disaster
* make local functions static
* move some inline's used in one file out of header
(this driver has a bad case of inline-itis)
* remove resulting dead code fallout
bnx2x_pfc_statistic,
bnx2x_emac_get_pfc_stat
bnx2x_init_vlan_mac_obj,
Looks like vlan mac support in this driver was a botch from day one
either never worked, or not implemented or missing support functions
Compile tested only.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 91 |
1 files changed, 68 insertions, 23 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 18498fed520b..f90079acb58c 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -94,8 +94,8 @@ MODULE_FIRMWARE(FW_FILE_NAME_E1); | |||
94 | MODULE_FIRMWARE(FW_FILE_NAME_E1H); | 94 | MODULE_FIRMWARE(FW_FILE_NAME_E1H); |
95 | MODULE_FIRMWARE(FW_FILE_NAME_E2); | 95 | MODULE_FIRMWARE(FW_FILE_NAME_E2); |
96 | 96 | ||
97 | int num_queues; | 97 | int bnx2x_num_queues; |
98 | module_param(num_queues, int, 0); | 98 | module_param_named(num_queues, bnx2x_num_queues, int, 0); |
99 | MODULE_PARM_DESC(num_queues, | 99 | MODULE_PARM_DESC(num_queues, |
100 | " Set number of queues (default is as a number of CPUs)"); | 100 | " Set number of queues (default is as a number of CPUs)"); |
101 | 101 | ||
@@ -103,7 +103,7 @@ static int disable_tpa; | |||
103 | module_param(disable_tpa, int, 0); | 103 | module_param(disable_tpa, int, 0); |
104 | MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature"); | 104 | MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature"); |
105 | 105 | ||
106 | int int_mode; | 106 | static int int_mode; |
107 | module_param(int_mode, int, 0); | 107 | module_param(int_mode, int, 0); |
108 | MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X " | 108 | MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X " |
109 | "(1 INT#x; 2 MSI)"); | 109 | "(1 INT#x; 2 MSI)"); |
@@ -279,6 +279,12 @@ MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); | |||
279 | #define BNX2X_PREV_WAIT_NEEDED 1 | 279 | #define BNX2X_PREV_WAIT_NEEDED 1 |
280 | static DEFINE_SEMAPHORE(bnx2x_prev_sem); | 280 | static DEFINE_SEMAPHORE(bnx2x_prev_sem); |
281 | static LIST_HEAD(bnx2x_prev_list); | 281 | static LIST_HEAD(bnx2x_prev_list); |
282 | |||
283 | /* Forward declaration */ | ||
284 | static struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev); | ||
285 | static u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp); | ||
286 | static int bnx2x_set_storm_rx_mode(struct bnx2x *bp); | ||
287 | |||
282 | /**************************************************************************** | 288 | /**************************************************************************** |
283 | * General service functions | 289 | * General service functions |
284 | ****************************************************************************/ | 290 | ****************************************************************************/ |
@@ -5857,11 +5863,11 @@ static void bnx2x_init_eq_ring(struct bnx2x *bp) | |||
5857 | } | 5863 | } |
5858 | 5864 | ||
5859 | /* called with netif_addr_lock_bh() */ | 5865 | /* called with netif_addr_lock_bh() */ |
5860 | int bnx2x_set_q_rx_mode(struct bnx2x *bp, u8 cl_id, | 5866 | static int bnx2x_set_q_rx_mode(struct bnx2x *bp, u8 cl_id, |
5861 | unsigned long rx_mode_flags, | 5867 | unsigned long rx_mode_flags, |
5862 | unsigned long rx_accept_flags, | 5868 | unsigned long rx_accept_flags, |
5863 | unsigned long tx_accept_flags, | 5869 | unsigned long tx_accept_flags, |
5864 | unsigned long ramrod_flags) | 5870 | unsigned long ramrod_flags) |
5865 | { | 5871 | { |
5866 | struct bnx2x_rx_mode_ramrod_params ramrod_param; | 5872 | struct bnx2x_rx_mode_ramrod_params ramrod_param; |
5867 | int rc; | 5873 | int rc; |
@@ -5969,7 +5975,7 @@ static int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode, | |||
5969 | } | 5975 | } |
5970 | 5976 | ||
5971 | /* called with netif_addr_lock_bh() */ | 5977 | /* called with netif_addr_lock_bh() */ |
5972 | int bnx2x_set_storm_rx_mode(struct bnx2x *bp) | 5978 | static int bnx2x_set_storm_rx_mode(struct bnx2x *bp) |
5973 | { | 5979 | { |
5974 | unsigned long rx_mode_flags = 0, ramrod_flags = 0; | 5980 | unsigned long rx_mode_flags = 0, ramrod_flags = 0; |
5975 | unsigned long rx_accept_flags = 0, tx_accept_flags = 0; | 5981 | unsigned long rx_accept_flags = 0, tx_accept_flags = 0; |
@@ -6165,6 +6171,47 @@ static void bnx2x_init_tx_rings(struct bnx2x *bp) | |||
6165 | bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[cos]); | 6171 | bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[cos]); |
6166 | } | 6172 | } |
6167 | 6173 | ||
6174 | static void bnx2x_init_fcoe_fp(struct bnx2x *bp) | ||
6175 | { | ||
6176 | struct bnx2x_fastpath *fp = bnx2x_fcoe_fp(bp); | ||
6177 | unsigned long q_type = 0; | ||
6178 | |||
6179 | bnx2x_fcoe(bp, rx_queue) = BNX2X_NUM_ETH_QUEUES(bp); | ||
6180 | bnx2x_fcoe(bp, cl_id) = bnx2x_cnic_eth_cl_id(bp, | ||
6181 | BNX2X_FCOE_ETH_CL_ID_IDX); | ||
6182 | bnx2x_fcoe(bp, cid) = BNX2X_FCOE_ETH_CID(bp); | ||
6183 | bnx2x_fcoe(bp, fw_sb_id) = DEF_SB_ID; | ||
6184 | bnx2x_fcoe(bp, igu_sb_id) = bp->igu_dsb_id; | ||
6185 | bnx2x_fcoe(bp, rx_cons_sb) = BNX2X_FCOE_L2_RX_INDEX; | ||
6186 | bnx2x_init_txdata(bp, bnx2x_fcoe(bp, txdata_ptr[0]), | ||
6187 | fp->cid, FCOE_TXQ_IDX(bp), BNX2X_FCOE_L2_TX_INDEX, | ||
6188 | fp); | ||
6189 | |||
6190 | DP(NETIF_MSG_IFUP, "created fcoe tx data (fp index %d)\n", fp->index); | ||
6191 | |||
6192 | /* qZone id equals to FW (per path) client id */ | ||
6193 | bnx2x_fcoe(bp, cl_qzone_id) = bnx2x_fp_qzone_id(fp); | ||
6194 | /* init shortcut */ | ||
6195 | bnx2x_fcoe(bp, ustorm_rx_prods_offset) = | ||
6196 | bnx2x_rx_ustorm_prods_offset(fp); | ||
6197 | |||
6198 | /* Configure Queue State object */ | ||
6199 | __set_bit(BNX2X_Q_TYPE_HAS_RX, &q_type); | ||
6200 | __set_bit(BNX2X_Q_TYPE_HAS_TX, &q_type); | ||
6201 | |||
6202 | /* No multi-CoS for FCoE L2 client */ | ||
6203 | BUG_ON(fp->max_cos != 1); | ||
6204 | |||
6205 | bnx2x_init_queue_obj(bp, &bnx2x_sp_obj(bp, fp).q_obj, fp->cl_id, | ||
6206 | &fp->cid, 1, BP_FUNC(bp), bnx2x_sp(bp, q_rdata), | ||
6207 | bnx2x_sp_mapping(bp, q_rdata), q_type); | ||
6208 | |||
6209 | DP(NETIF_MSG_IFUP, | ||
6210 | "queue[%d]: bnx2x_init_sb(%p,%p) cl_id %d fw_sb %d igu_sb %d\n", | ||
6211 | fp->index, bp, fp->status_blk.e2_sb, fp->cl_id, fp->fw_sb_id, | ||
6212 | fp->igu_sb_id); | ||
6213 | } | ||
6214 | |||
6168 | void bnx2x_nic_init_cnic(struct bnx2x *bp) | 6215 | void bnx2x_nic_init_cnic(struct bnx2x *bp) |
6169 | { | 6216 | { |
6170 | if (!NO_FCOE(bp)) | 6217 | if (!NO_FCOE(bp)) |
@@ -8737,16 +8784,16 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode) | |||
8737 | int path = BP_PATH(bp); | 8784 | int path = BP_PATH(bp); |
8738 | 8785 | ||
8739 | DP(NETIF_MSG_IFDOWN, "NO MCP - load counts[%d] %d, %d, %d\n", | 8786 | DP(NETIF_MSG_IFDOWN, "NO MCP - load counts[%d] %d, %d, %d\n", |
8740 | path, load_count[path][0], load_count[path][1], | 8787 | path, bnx2x_load_count[path][0], bnx2x_load_count[path][1], |
8741 | load_count[path][2]); | 8788 | bnx2x_load_count[path][2]); |
8742 | load_count[path][0]--; | 8789 | bnx2x_load_count[path][0]--; |
8743 | load_count[path][1 + port]--; | 8790 | bnx2x_load_count[path][1 + port]--; |
8744 | DP(NETIF_MSG_IFDOWN, "NO MCP - new load counts[%d] %d, %d, %d\n", | 8791 | DP(NETIF_MSG_IFDOWN, "NO MCP - new load counts[%d] %d, %d, %d\n", |
8745 | path, load_count[path][0], load_count[path][1], | 8792 | path, bnx2x_load_count[path][0], bnx2x_load_count[path][1], |
8746 | load_count[path][2]); | 8793 | bnx2x_load_count[path][2]); |
8747 | if (load_count[path][0] == 0) | 8794 | if (bnx2x_load_count[path][0] == 0) |
8748 | reset_code = FW_MSG_CODE_DRV_UNLOAD_COMMON; | 8795 | reset_code = FW_MSG_CODE_DRV_UNLOAD_COMMON; |
8749 | else if (load_count[path][1 + port] == 0) | 8796 | else if (bnx2x_load_count[path][1 + port] == 0) |
8750 | reset_code = FW_MSG_CODE_DRV_UNLOAD_PORT; | 8797 | reset_code = FW_MSG_CODE_DRV_UNLOAD_PORT; |
8751 | else | 8798 | else |
8752 | reset_code = FW_MSG_CODE_DRV_UNLOAD_FUNCTION; | 8799 | reset_code = FW_MSG_CODE_DRV_UNLOAD_FUNCTION; |
@@ -9772,7 +9819,7 @@ period_task_exit: | |||
9772 | * Init service functions | 9819 | * Init service functions |
9773 | */ | 9820 | */ |
9774 | 9821 | ||
9775 | u32 bnx2x_get_pretend_reg(struct bnx2x *bp) | 9822 | static u32 bnx2x_get_pretend_reg(struct bnx2x *bp) |
9776 | { | 9823 | { |
9777 | u32 base = PXP2_REG_PGL_PRETEND_FUNC_F0; | 9824 | u32 base = PXP2_REG_PGL_PRETEND_FUNC_F0; |
9778 | u32 stride = PXP2_REG_PGL_PRETEND_FUNC_F1 - base; | 9825 | u32 stride = PXP2_REG_PGL_PRETEND_FUNC_F1 - base; |
@@ -12005,7 +12052,7 @@ static int bnx2x_set_mc_list(struct bnx2x *bp) | |||
12005 | } | 12052 | } |
12006 | 12053 | ||
12007 | /* If bp->state is OPEN, should be called with netif_addr_lock_bh() */ | 12054 | /* If bp->state is OPEN, should be called with netif_addr_lock_bh() */ |
12008 | void bnx2x_set_rx_mode(struct net_device *dev) | 12055 | static void bnx2x_set_rx_mode(struct net_device *dev) |
12009 | { | 12056 | { |
12010 | struct bnx2x *bp = netdev_priv(dev); | 12057 | struct bnx2x *bp = netdev_priv(dev); |
12011 | 12058 | ||
@@ -12783,8 +12830,6 @@ static int set_is_vf(int chip_id) | |||
12783 | } | 12830 | } |
12784 | } | 12831 | } |
12785 | 12832 | ||
12786 | struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev); | ||
12787 | |||
12788 | static int bnx2x_init_one(struct pci_dev *pdev, | 12833 | static int bnx2x_init_one(struct pci_dev *pdev, |
12789 | const struct pci_device_id *ent) | 12834 | const struct pci_device_id *ent) |
12790 | { | 12835 | { |
@@ -13859,7 +13904,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev) | |||
13859 | return 0; | 13904 | return 0; |
13860 | } | 13905 | } |
13861 | 13906 | ||
13862 | struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) | 13907 | static struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) |
13863 | { | 13908 | { |
13864 | struct bnx2x *bp = netdev_priv(dev); | 13909 | struct bnx2x *bp = netdev_priv(dev); |
13865 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; | 13910 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; |
@@ -13909,7 +13954,7 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) | |||
13909 | return cp; | 13954 | return cp; |
13910 | } | 13955 | } |
13911 | 13956 | ||
13912 | u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp) | 13957 | static u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp) |
13913 | { | 13958 | { |
13914 | struct bnx2x *bp = fp->bp; | 13959 | struct bnx2x *bp = fp->bp; |
13915 | u32 offset = BAR_USTRORM_INTMEM; | 13960 | u32 offset = BAR_USTRORM_INTMEM; |