提交 a8f47eb7 编写于 作者: S stephen hemminger 提交者: David S. Miller

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: NStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6bc21eed
...@@ -2057,7 +2057,6 @@ int bnx2x_del_all_macs(struct bnx2x *bp, ...@@ -2057,7 +2057,6 @@ int bnx2x_del_all_macs(struct bnx2x *bp,
void bnx2x_func_init(struct bnx2x *bp, struct bnx2x_func_init_params *p); void bnx2x_func_init(struct bnx2x *bp, struct bnx2x_func_init_params *p);
void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid, void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid,
u8 vf_valid, int fw_sb_id, int igu_sb_id); u8 vf_valid, int fw_sb_id, int igu_sb_id);
u32 bnx2x_get_pretend_reg(struct bnx2x *bp);
int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port); int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port);
int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port); int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port);
int bnx2x_set_mult_gpio(struct bnx2x *bp, u8 pins, u32 mode); int bnx2x_set_mult_gpio(struct bnx2x *bp, u8 pins, u32 mode);
......
...@@ -30,6 +30,43 @@ ...@@ -30,6 +30,43 @@
#include "bnx2x_init.h" #include "bnx2x_init.h"
#include "bnx2x_sp.h" #include "bnx2x_sp.h"
static void bnx2x_free_fp_mem_cnic(struct bnx2x *bp);
static int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp);
static int bnx2x_alloc_fp_mem(struct bnx2x *bp);
static int bnx2x_poll(struct napi_struct *napi, int budget);
static void bnx2x_add_all_napi_cnic(struct bnx2x *bp)
{
int i;
/* Add NAPI objects */
for_each_rx_queue_cnic(bp, i) {
netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
bnx2x_poll, NAPI_POLL_WEIGHT);
napi_hash_add(&bnx2x_fp(bp, i, napi));
}
}
static void bnx2x_add_all_napi(struct bnx2x *bp)
{
int i;
/* Add NAPI objects */
for_each_eth_queue(bp, i) {
netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
bnx2x_poll, NAPI_POLL_WEIGHT);
napi_hash_add(&bnx2x_fp(bp, i, napi));
}
}
static int bnx2x_calc_num_queues(struct bnx2x *bp)
{
return bnx2x_num_queues ?
min_t(int, bnx2x_num_queues, BNX2X_MAX_QUEUES(bp)) :
min_t(int, netif_get_num_default_rss_queues(),
BNX2X_MAX_QUEUES(bp));
}
/** /**
* bnx2x_move_fp - move content of the fastpath structure. * bnx2x_move_fp - move content of the fastpath structure.
* *
...@@ -145,7 +182,7 @@ static void bnx2x_shrink_eth_fp(struct bnx2x *bp, int delta) ...@@ -145,7 +182,7 @@ static void bnx2x_shrink_eth_fp(struct bnx2x *bp, int delta)
} }
} }
int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */ int bnx2x_load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */
/* free skb in the packet ring at pos idx /* free skb in the packet ring at pos idx
* return idx of last bd freed * return idx of last bd freed
...@@ -813,7 +850,7 @@ void bnx2x_csum_validate(struct sk_buff *skb, union eth_rx_cqe *cqe, ...@@ -813,7 +850,7 @@ void bnx2x_csum_validate(struct sk_buff *skb, union eth_rx_cqe *cqe,
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
} }
int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
{ {
struct bnx2x *bp = fp->bp; struct bnx2x *bp = fp->bp;
u16 bd_cons, bd_prod, bd_prod_fw, comp_ring_cons; u16 bd_cons, bd_prod, bd_prod_fw, comp_ring_cons;
...@@ -1483,7 +1520,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp) ...@@ -1483,7 +1520,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp)
} }
} }
void bnx2x_free_skbs_cnic(struct bnx2x *bp) static void bnx2x_free_skbs_cnic(struct bnx2x *bp)
{ {
bnx2x_free_tx_skbs_cnic(bp); bnx2x_free_tx_skbs_cnic(bp);
bnx2x_free_rx_skbs_cnic(bp); bnx2x_free_rx_skbs_cnic(bp);
...@@ -2302,16 +2339,16 @@ static int bnx2x_nic_load_no_mcp(struct bnx2x *bp, int port) ...@@ -2302,16 +2339,16 @@ static int bnx2x_nic_load_no_mcp(struct bnx2x *bp, int port)
int path = BP_PATH(bp); int path = BP_PATH(bp);
DP(NETIF_MSG_IFUP, "NO MCP - load counts[%d] %d, %d, %d\n", DP(NETIF_MSG_IFUP, "NO MCP - load counts[%d] %d, %d, %d\n",
path, load_count[path][0], load_count[path][1], path, bnx2x_load_count[path][0], bnx2x_load_count[path][1],
load_count[path][2]); bnx2x_load_count[path][2]);
load_count[path][0]++; bnx2x_load_count[path][0]++;
load_count[path][1 + port]++; bnx2x_load_count[path][1 + port]++;
DP(NETIF_MSG_IFUP, "NO MCP - new load counts[%d] %d, %d, %d\n", DP(NETIF_MSG_IFUP, "NO MCP - new load counts[%d] %d, %d, %d\n",
path, load_count[path][0], load_count[path][1], path, bnx2x_load_count[path][0], bnx2x_load_count[path][1],
load_count[path][2]); bnx2x_load_count[path][2]);
if (load_count[path][0] == 1) if (bnx2x_load_count[path][0] == 1)
return FW_MSG_CODE_DRV_LOAD_COMMON; return FW_MSG_CODE_DRV_LOAD_COMMON;
else if (load_count[path][1 + port] == 1) else if (bnx2x_load_count[path][1 + port] == 1)
return FW_MSG_CODE_DRV_LOAD_PORT; return FW_MSG_CODE_DRV_LOAD_PORT;
else else
return FW_MSG_CODE_DRV_LOAD_FUNCTION; return FW_MSG_CODE_DRV_LOAD_FUNCTION;
...@@ -3069,7 +3106,7 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state) ...@@ -3069,7 +3106,7 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
/* /*
* net_device service functions * net_device service functions
*/ */
int bnx2x_poll(struct napi_struct *napi, int budget) static int bnx2x_poll(struct napi_struct *napi, int budget)
{ {
int work_done = 0; int work_done = 0;
u8 cos; u8 cos;
...@@ -4196,7 +4233,7 @@ static void bnx2x_free_fp_mem_at(struct bnx2x *bp, int fp_index) ...@@ -4196,7 +4233,7 @@ static void bnx2x_free_fp_mem_at(struct bnx2x *bp, int fp_index)
/* end of fastpath */ /* end of fastpath */
} }
void bnx2x_free_fp_mem_cnic(struct bnx2x *bp) static void bnx2x_free_fp_mem_cnic(struct bnx2x *bp)
{ {
int i; int i;
for_each_cnic_queue(bp, i) for_each_cnic_queue(bp, i)
...@@ -4410,7 +4447,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) ...@@ -4410,7 +4447,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index)
return 0; return 0;
} }
int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp) static int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp)
{ {
if (!NO_FCOE(bp)) if (!NO_FCOE(bp))
/* FCoE */ /* FCoE */
...@@ -4423,7 +4460,7 @@ int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp) ...@@ -4423,7 +4460,7 @@ int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp)
return 0; return 0;
} }
int bnx2x_alloc_fp_mem(struct bnx2x *bp) static int bnx2x_alloc_fp_mem(struct bnx2x *bp)
{ {
int i; int i;
......
...@@ -26,10 +26,8 @@ ...@@ -26,10 +26,8 @@
#include "bnx2x_sriov.h" #include "bnx2x_sriov.h"
/* This is used as a replacement for an MCP if it's not present */ /* This is used as a replacement for an MCP if it's not present */
extern int load_count[2][3]; /* per-path: 0-common, 1-port0, 2-port1 */ extern int bnx2x_load_count[2][3]; /* per-path: 0-common, 1-port0, 2-port1 */
extern int bnx2x_num_queues;
extern int num_queues;
extern int int_mode;
/************************ Macros ********************************/ /************************ Macros ********************************/
#define BNX2X_PCI_FREE(x, y, size) \ #define BNX2X_PCI_FREE(x, y, size) \
...@@ -417,35 +415,8 @@ int bnx2x_set_eth_mac(struct bnx2x *bp, bool set); ...@@ -417,35 +415,8 @@ int bnx2x_set_eth_mac(struct bnx2x *bp, bool set);
* If bp->state is OPEN, should be called with * If bp->state is OPEN, should be called with
* netif_addr_lock_bh() * netif_addr_lock_bh()
*/ */
void bnx2x_set_rx_mode(struct net_device *dev);
void bnx2x_set_rx_mode_inner(struct bnx2x *bp); void bnx2x_set_rx_mode_inner(struct bnx2x *bp);
/**
* bnx2x_set_storm_rx_mode - configure MAC filtering rules in a FW.
*
* @bp: driver handle
*
* If bp->state is OPEN, should be called with
* netif_addr_lock_bh().
*/
int bnx2x_set_storm_rx_mode(struct bnx2x *bp);
/**
* bnx2x_set_q_rx_mode - configures rx_mode for a single queue.
*
* @bp: driver handle
* @cl_id: client id
* @rx_mode_flags: rx mode configuration
* @rx_accept_flags: rx accept configuration
* @tx_accept_flags: tx accept configuration (tx switch)
* @ramrod_flags: ramrod configuration
*/
int bnx2x_set_q_rx_mode(struct bnx2x *bp, u8 cl_id,
unsigned long rx_mode_flags,
unsigned long rx_accept_flags,
unsigned long tx_accept_flags,
unsigned long ramrod_flags);
/* Parity errors related */ /* Parity errors related */
void bnx2x_set_pf_load(struct bnx2x *bp); void bnx2x_set_pf_load(struct bnx2x *bp);
bool bnx2x_clear_pf_load(struct bnx2x *bp); bool bnx2x_clear_pf_load(struct bnx2x *bp);
...@@ -564,9 +535,6 @@ int bnx2x_reload_if_running(struct net_device *dev); ...@@ -564,9 +535,6 @@ int bnx2x_reload_if_running(struct net_device *dev);
int bnx2x_change_mac_addr(struct net_device *dev, void *p); int bnx2x_change_mac_addr(struct net_device *dev, void *p);
/* NAPI poll Rx part */
int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget);
/* NAPI poll Tx part */ /* NAPI poll Tx part */
int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata); int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata);
...@@ -577,13 +545,9 @@ int bnx2x_resume(struct pci_dev *pdev); ...@@ -577,13 +545,9 @@ int bnx2x_resume(struct pci_dev *pdev);
/* Release IRQ vectors */ /* Release IRQ vectors */
void bnx2x_free_irq(struct bnx2x *bp); void bnx2x_free_irq(struct bnx2x *bp);
void bnx2x_free_fp_mem_cnic(struct bnx2x *bp);
void bnx2x_free_fp_mem(struct bnx2x *bp); void bnx2x_free_fp_mem(struct bnx2x *bp);
int bnx2x_alloc_fp_mem_cnic(struct bnx2x *bp);
int bnx2x_alloc_fp_mem(struct bnx2x *bp);
void bnx2x_init_rx_rings(struct bnx2x *bp); void bnx2x_init_rx_rings(struct bnx2x *bp);
void bnx2x_init_rx_rings_cnic(struct bnx2x *bp); void bnx2x_init_rx_rings_cnic(struct bnx2x *bp);
void bnx2x_free_skbs_cnic(struct bnx2x *bp);
void bnx2x_free_skbs(struct bnx2x *bp); void bnx2x_free_skbs(struct bnx2x *bp);
void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw); void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw);
void bnx2x_netif_start(struct bnx2x *bp); void bnx2x_netif_start(struct bnx2x *bp);
...@@ -606,15 +570,6 @@ int bnx2x_enable_msix(struct bnx2x *bp); ...@@ -606,15 +570,6 @@ int bnx2x_enable_msix(struct bnx2x *bp);
*/ */
int bnx2x_enable_msi(struct bnx2x *bp); int bnx2x_enable_msi(struct bnx2x *bp);
/**
* bnx2x_poll - NAPI callback
*
* @napi: napi structure
* @budget:
*
*/
int bnx2x_poll(struct napi_struct *napi, int budget);
/** /**
* bnx2x_low_latency_recv - LL callback * bnx2x_low_latency_recv - LL callback
* *
...@@ -861,30 +816,6 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp, ...@@ -861,30 +816,6 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp,
sge->addr_lo = 0; sge->addr_lo = 0;
} }
static inline void bnx2x_add_all_napi_cnic(struct bnx2x *bp)
{
int i;
/* Add NAPI objects */
for_each_rx_queue_cnic(bp, i) {
netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
bnx2x_poll, NAPI_POLL_WEIGHT);
napi_hash_add(&bnx2x_fp(bp, i, napi));
}
}
static inline void bnx2x_add_all_napi(struct bnx2x *bp)
{
int i;
/* Add NAPI objects */
for_each_eth_queue(bp, i) {
netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
bnx2x_poll, NAPI_POLL_WEIGHT);
napi_hash_add(&bnx2x_fp(bp, i, napi));
}
}
static inline void bnx2x_del_all_napi_cnic(struct bnx2x *bp) static inline void bnx2x_del_all_napi_cnic(struct bnx2x *bp)
{ {
int i; int i;
...@@ -918,14 +849,6 @@ static inline void bnx2x_disable_msi(struct bnx2x *bp) ...@@ -918,14 +849,6 @@ static inline void bnx2x_disable_msi(struct bnx2x *bp)
} }
} }
static inline int bnx2x_calc_num_queues(struct bnx2x *bp)
{
return num_queues ?
min_t(int, num_queues, BNX2X_MAX_QUEUES(bp)) :
min_t(int, netif_get_num_default_rss_queues(),
BNX2X_MAX_QUEUES(bp));
}
static inline void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp) static inline void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp)
{ {
int i, j; int i, j;
...@@ -1172,8 +1095,6 @@ static inline u8 bnx2x_fp_qzone_id(struct bnx2x_fastpath *fp) ...@@ -1172,8 +1095,6 @@ static inline u8 bnx2x_fp_qzone_id(struct bnx2x_fastpath *fp)
return fp->cl_id; return fp->cl_id;
} }
u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp);
static inline void bnx2x_init_txdata(struct bnx2x *bp, static inline void bnx2x_init_txdata(struct bnx2x *bp,
struct bnx2x_fp_txdata *txdata, u32 cid, struct bnx2x_fp_txdata *txdata, u32 cid,
int txq_index, __le16 *tx_cons_sb, int txq_index, __le16 *tx_cons_sb,
...@@ -1206,47 +1127,6 @@ static inline u8 bnx2x_cnic_igu_sb_id(struct bnx2x *bp) ...@@ -1206,47 +1127,6 @@ static inline u8 bnx2x_cnic_igu_sb_id(struct bnx2x *bp)
return bp->igu_base_sb; return bp->igu_base_sb;
} }
static inline void bnx2x_init_fcoe_fp(struct bnx2x *bp)
{
struct bnx2x_fastpath *fp = bnx2x_fcoe_fp(bp);
unsigned long q_type = 0;
bnx2x_fcoe(bp, rx_queue) = BNX2X_NUM_ETH_QUEUES(bp);
bnx2x_fcoe(bp, cl_id) = bnx2x_cnic_eth_cl_id(bp,
BNX2X_FCOE_ETH_CL_ID_IDX);
bnx2x_fcoe(bp, cid) = BNX2X_FCOE_ETH_CID(bp);
bnx2x_fcoe(bp, fw_sb_id) = DEF_SB_ID;
bnx2x_fcoe(bp, igu_sb_id) = bp->igu_dsb_id;
bnx2x_fcoe(bp, rx_cons_sb) = BNX2X_FCOE_L2_RX_INDEX;
bnx2x_init_txdata(bp, bnx2x_fcoe(bp, txdata_ptr[0]),
fp->cid, FCOE_TXQ_IDX(bp), BNX2X_FCOE_L2_TX_INDEX,
fp);
DP(NETIF_MSG_IFUP, "created fcoe tx data (fp index %d)\n", fp->index);
/* qZone id equals to FW (per path) client id */
bnx2x_fcoe(bp, cl_qzone_id) = bnx2x_fp_qzone_id(fp);
/* init shortcut */
bnx2x_fcoe(bp, ustorm_rx_prods_offset) =
bnx2x_rx_ustorm_prods_offset(fp);
/* Configure Queue State object */
__set_bit(BNX2X_Q_TYPE_HAS_RX, &q_type);
__set_bit(BNX2X_Q_TYPE_HAS_TX, &q_type);
/* No multi-CoS for FCoE L2 client */
BUG_ON(fp->max_cos != 1);
bnx2x_init_queue_obj(bp, &bnx2x_sp_obj(bp, fp).q_obj, fp->cl_id,
&fp->cid, 1, BP_FUNC(bp), bnx2x_sp(bp, q_rdata),
bnx2x_sp_mapping(bp, q_rdata), q_type);
DP(NETIF_MSG_IFUP,
"queue[%d]: bnx2x_init_sb(%p,%p) cl_id %d fw_sb %d igu_sb %d\n",
fp->index, bp, fp->status_blk.e2_sb, fp->cl_id, fp->fw_sb_id,
fp->igu_sb_id);
}
static inline int bnx2x_clean_tx_queue(struct bnx2x *bp, static inline int bnx2x_clean_tx_queue(struct bnx2x *bp,
struct bnx2x_fp_txdata *txdata) struct bnx2x_fp_txdata *txdata)
{ {
......
...@@ -205,6 +205,11 @@ typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy, ...@@ -205,6 +205,11 @@ typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy,
(_bank + (_addr & 0xf)), \ (_bank + (_addr & 0xf)), \
_val) _val)
static int bnx2x_check_half_open_conn(struct link_params *params,
struct link_vars *vars, u8 notify);
static int bnx2x_sfp_module_detection(struct bnx2x_phy *phy,
struct link_params *params);
static u32 bnx2x_bits_en(struct bnx2x *bp, u32 reg, u32 bits) static u32 bnx2x_bits_en(struct bnx2x *bp, u32 reg, u32 bits)
{ {
u32 val = REG_RD(bp, reg); u32 val = REG_RD(bp, reg);
...@@ -1399,57 +1404,6 @@ static void bnx2x_update_pfc_xmac(struct link_params *params, ...@@ -1399,57 +1404,6 @@ static void bnx2x_update_pfc_xmac(struct link_params *params,
udelay(30); udelay(30);
} }
static void bnx2x_emac_get_pfc_stat(struct link_params *params,
u32 pfc_frames_sent[2],
u32 pfc_frames_received[2])
{
/* Read pfc statistic */
struct bnx2x *bp = params->bp;
u32 emac_base = params->port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
u32 val_xon = 0;
u32 val_xoff = 0;
DP(NETIF_MSG_LINK, "pfc statistic read from EMAC\n");
/* PFC received frames */
val_xoff = REG_RD(bp, emac_base +
EMAC_REG_RX_PFC_STATS_XOFF_RCVD);
val_xoff &= EMAC_REG_RX_PFC_STATS_XOFF_RCVD_COUNT;
val_xon = REG_RD(bp, emac_base + EMAC_REG_RX_PFC_STATS_XON_RCVD);
val_xon &= EMAC_REG_RX_PFC_STATS_XON_RCVD_COUNT;
pfc_frames_received[0] = val_xon + val_xoff;
/* PFC received sent */
val_xoff = REG_RD(bp, emac_base +
EMAC_REG_RX_PFC_STATS_XOFF_SENT);
val_xoff &= EMAC_REG_RX_PFC_STATS_XOFF_SENT_COUNT;
val_xon = REG_RD(bp, emac_base + EMAC_REG_RX_PFC_STATS_XON_SENT);
val_xon &= EMAC_REG_RX_PFC_STATS_XON_SENT_COUNT;
pfc_frames_sent[0] = val_xon + val_xoff;
}
/* Read pfc statistic*/
void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars,
u32 pfc_frames_sent[2],
u32 pfc_frames_received[2])
{
/* Read pfc statistic */
struct bnx2x *bp = params->bp;
DP(NETIF_MSG_LINK, "pfc statistic\n");
if (!vars->link_up)
return;
if (vars->mac_type == MAC_TYPE_EMAC) {
DP(NETIF_MSG_LINK, "About to read PFC stats from EMAC\n");
bnx2x_emac_get_pfc_stat(params, pfc_frames_sent,
pfc_frames_received);
}
}
/******************************************************************/ /******************************************************************/
/* MAC/PBF section */ /* MAC/PBF section */
/******************************************************************/ /******************************************************************/
...@@ -13413,9 +13367,9 @@ static u8 bnx2x_analyze_link_error(struct link_params *params, ...@@ -13413,9 +13367,9 @@ static u8 bnx2x_analyze_link_error(struct link_params *params,
* a fault, for example, due to break in the TX side of fiber. * a fault, for example, due to break in the TX side of fiber.
* *
******************************************************************************/ ******************************************************************************/
int bnx2x_check_half_open_conn(struct link_params *params, static int bnx2x_check_half_open_conn(struct link_params *params,
struct link_vars *vars, struct link_vars *vars,
u8 notify) u8 notify)
{ {
struct bnx2x *bp = params->bp; struct bnx2x *bp = params->bp;
u32 lss_status = 0; u32 lss_status = 0;
......
...@@ -533,19 +533,11 @@ int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos); ...@@ -533,19 +533,11 @@ int bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos);
int bnx2x_ets_e3b0_config(const struct link_params *params, int bnx2x_ets_e3b0_config(const struct link_params *params,
const struct link_vars *vars, const struct link_vars *vars,
struct bnx2x_ets_params *ets_params); struct bnx2x_ets_params *ets_params);
/* Read pfc statistic*/
void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars,
u32 pfc_frames_sent[2],
u32 pfc_frames_received[2]);
void bnx2x_init_mod_abs_int(struct bnx2x *bp, struct link_vars *vars, void bnx2x_init_mod_abs_int(struct bnx2x *bp, struct link_vars *vars,
u32 chip_id, u32 shmem_base, u32 shmem2_base, u32 chip_id, u32 shmem_base, u32 shmem2_base,
u8 port); u8 port);
int bnx2x_sfp_module_detection(struct bnx2x_phy *phy,
struct link_params *params);
void bnx2x_period_func(struct link_params *params, struct link_vars *vars); void bnx2x_period_func(struct link_params *params, struct link_vars *vars);
int bnx2x_check_half_open_conn(struct link_params *params,
struct link_vars *vars, u8 notify);
#endif /* BNX2X_LINK_H */ #endif /* BNX2X_LINK_H */
...@@ -94,8 +94,8 @@ MODULE_FIRMWARE(FW_FILE_NAME_E1); ...@@ -94,8 +94,8 @@ MODULE_FIRMWARE(FW_FILE_NAME_E1);
MODULE_FIRMWARE(FW_FILE_NAME_E1H); MODULE_FIRMWARE(FW_FILE_NAME_E1H);
MODULE_FIRMWARE(FW_FILE_NAME_E2); MODULE_FIRMWARE(FW_FILE_NAME_E2);
int num_queues; int bnx2x_num_queues;
module_param(num_queues, int, 0); module_param_named(num_queues, bnx2x_num_queues, int, 0);
MODULE_PARM_DESC(num_queues, MODULE_PARM_DESC(num_queues,
" Set number of queues (default is as a number of CPUs)"); " Set number of queues (default is as a number of CPUs)");
...@@ -103,7 +103,7 @@ static int disable_tpa; ...@@ -103,7 +103,7 @@ static int disable_tpa;
module_param(disable_tpa, int, 0); module_param(disable_tpa, int, 0);
MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature"); MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature");
int int_mode; static int int_mode;
module_param(int_mode, int, 0); module_param(int_mode, int, 0);
MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X " MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X "
"(1 INT#x; 2 MSI)"); "(1 INT#x; 2 MSI)");
...@@ -279,6 +279,12 @@ MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); ...@@ -279,6 +279,12 @@ MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl);
#define BNX2X_PREV_WAIT_NEEDED 1 #define BNX2X_PREV_WAIT_NEEDED 1
static DEFINE_SEMAPHORE(bnx2x_prev_sem); static DEFINE_SEMAPHORE(bnx2x_prev_sem);
static LIST_HEAD(bnx2x_prev_list); static LIST_HEAD(bnx2x_prev_list);
/* Forward declaration */
static struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev);
static u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp);
static int bnx2x_set_storm_rx_mode(struct bnx2x *bp);
/**************************************************************************** /****************************************************************************
* General service functions * General service functions
****************************************************************************/ ****************************************************************************/
...@@ -5857,11 +5863,11 @@ static void bnx2x_init_eq_ring(struct bnx2x *bp) ...@@ -5857,11 +5863,11 @@ static void bnx2x_init_eq_ring(struct bnx2x *bp)
} }
/* called with netif_addr_lock_bh() */ /* called with netif_addr_lock_bh() */
int bnx2x_set_q_rx_mode(struct bnx2x *bp, u8 cl_id, static int bnx2x_set_q_rx_mode(struct bnx2x *bp, u8 cl_id,
unsigned long rx_mode_flags, unsigned long rx_mode_flags,
unsigned long rx_accept_flags, unsigned long rx_accept_flags,
unsigned long tx_accept_flags, unsigned long tx_accept_flags,
unsigned long ramrod_flags) unsigned long ramrod_flags)
{ {
struct bnx2x_rx_mode_ramrod_params ramrod_param; struct bnx2x_rx_mode_ramrod_params ramrod_param;
int rc; int rc;
...@@ -5969,7 +5975,7 @@ static int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode, ...@@ -5969,7 +5975,7 @@ static int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode,
} }
/* called with netif_addr_lock_bh() */ /* called with netif_addr_lock_bh() */
int bnx2x_set_storm_rx_mode(struct bnx2x *bp) static int bnx2x_set_storm_rx_mode(struct bnx2x *bp)
{ {
unsigned long rx_mode_flags = 0, ramrod_flags = 0; unsigned long rx_mode_flags = 0, ramrod_flags = 0;
unsigned long rx_accept_flags = 0, tx_accept_flags = 0; unsigned long rx_accept_flags = 0, tx_accept_flags = 0;
...@@ -6165,6 +6171,47 @@ static void bnx2x_init_tx_rings(struct bnx2x *bp) ...@@ -6165,6 +6171,47 @@ static void bnx2x_init_tx_rings(struct bnx2x *bp)
bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[cos]); bnx2x_init_tx_ring_one(bp->fp[i].txdata_ptr[cos]);
} }
static void bnx2x_init_fcoe_fp(struct bnx2x *bp)
{
struct bnx2x_fastpath *fp = bnx2x_fcoe_fp(bp);
unsigned long q_type = 0;
bnx2x_fcoe(bp, rx_queue) = BNX2X_NUM_ETH_QUEUES(bp);
bnx2x_fcoe(bp, cl_id) = bnx2x_cnic_eth_cl_id(bp,
BNX2X_FCOE_ETH_CL_ID_IDX);
bnx2x_fcoe(bp, cid) = BNX2X_FCOE_ETH_CID(bp);
bnx2x_fcoe(bp, fw_sb_id) = DEF_SB_ID;
bnx2x_fcoe(bp, igu_sb_id) = bp->igu_dsb_id;
bnx2x_fcoe(bp, rx_cons_sb) = BNX2X_FCOE_L2_RX_INDEX;
bnx2x_init_txdata(bp, bnx2x_fcoe(bp, txdata_ptr[0]),
fp->cid, FCOE_TXQ_IDX(bp), BNX2X_FCOE_L2_TX_INDEX,
fp);
DP(NETIF_MSG_IFUP, "created fcoe tx data (fp index %d)\n", fp->index);
/* qZone id equals to FW (per path) client id */
bnx2x_fcoe(bp, cl_qzone_id) = bnx2x_fp_qzone_id(fp);
/* init shortcut */
bnx2x_fcoe(bp, ustorm_rx_prods_offset) =
bnx2x_rx_ustorm_prods_offset(fp);
/* Configure Queue State object */
__set_bit(BNX2X_Q_TYPE_HAS_RX, &q_type);
__set_bit(BNX2X_Q_TYPE_HAS_TX, &q_type);
/* No multi-CoS for FCoE L2 client */
BUG_ON(fp->max_cos != 1);
bnx2x_init_queue_obj(bp, &bnx2x_sp_obj(bp, fp).q_obj, fp->cl_id,
&fp->cid, 1, BP_FUNC(bp), bnx2x_sp(bp, q_rdata),
bnx2x_sp_mapping(bp, q_rdata), q_type);
DP(NETIF_MSG_IFUP,
"queue[%d]: bnx2x_init_sb(%p,%p) cl_id %d fw_sb %d igu_sb %d\n",
fp->index, bp, fp->status_blk.e2_sb, fp->cl_id, fp->fw_sb_id,
fp->igu_sb_id);
}
void bnx2x_nic_init_cnic(struct bnx2x *bp) void bnx2x_nic_init_cnic(struct bnx2x *bp)
{ {
if (!NO_FCOE(bp)) if (!NO_FCOE(bp))
...@@ -8737,16 +8784,16 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode) ...@@ -8737,16 +8784,16 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
int path = BP_PATH(bp); int path = BP_PATH(bp);
DP(NETIF_MSG_IFDOWN, "NO MCP - load counts[%d] %d, %d, %d\n", DP(NETIF_MSG_IFDOWN, "NO MCP - load counts[%d] %d, %d, %d\n",
path, load_count[path][0], load_count[path][1], path, bnx2x_load_count[path][0], bnx2x_load_count[path][1],
load_count[path][2]); bnx2x_load_count[path][2]);
load_count[path][0]--; bnx2x_load_count[path][0]--;
load_count[path][1 + port]--; bnx2x_load_count[path][1 + port]--;
DP(NETIF_MSG_IFDOWN, "NO MCP - new load counts[%d] %d, %d, %d\n", DP(NETIF_MSG_IFDOWN, "NO MCP - new load counts[%d] %d, %d, %d\n",
path, load_count[path][0], load_count[path][1], path, bnx2x_load_count[path][0], bnx2x_load_count[path][1],
load_count[path][2]); bnx2x_load_count[path][2]);
if (load_count[path][0] == 0) if (bnx2x_load_count[path][0] == 0)
reset_code = FW_MSG_CODE_DRV_UNLOAD_COMMON; reset_code = FW_MSG_CODE_DRV_UNLOAD_COMMON;
else if (load_count[path][1 + port] == 0) else if (bnx2x_load_count[path][1 + port] == 0)
reset_code = FW_MSG_CODE_DRV_UNLOAD_PORT; reset_code = FW_MSG_CODE_DRV_UNLOAD_PORT;
else else
reset_code = FW_MSG_CODE_DRV_UNLOAD_FUNCTION; reset_code = FW_MSG_CODE_DRV_UNLOAD_FUNCTION;
...@@ -9772,7 +9819,7 @@ static void bnx2x_period_task(struct work_struct *work) ...@@ -9772,7 +9819,7 @@ static void bnx2x_period_task(struct work_struct *work)
* Init service functions * Init service functions
*/ */
u32 bnx2x_get_pretend_reg(struct bnx2x *bp) static u32 bnx2x_get_pretend_reg(struct bnx2x *bp)
{ {
u32 base = PXP2_REG_PGL_PRETEND_FUNC_F0; u32 base = PXP2_REG_PGL_PRETEND_FUNC_F0;
u32 stride = PXP2_REG_PGL_PRETEND_FUNC_F1 - base; u32 stride = PXP2_REG_PGL_PRETEND_FUNC_F1 - base;
...@@ -12005,7 +12052,7 @@ static int bnx2x_set_mc_list(struct bnx2x *bp) ...@@ -12005,7 +12052,7 @@ static int bnx2x_set_mc_list(struct bnx2x *bp)
} }
/* If bp->state is OPEN, should be called with netif_addr_lock_bh() */ /* If bp->state is OPEN, should be called with netif_addr_lock_bh() */
void bnx2x_set_rx_mode(struct net_device *dev) static void bnx2x_set_rx_mode(struct net_device *dev)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
...@@ -12783,8 +12830,6 @@ static int set_is_vf(int chip_id) ...@@ -12783,8 +12830,6 @@ static int set_is_vf(int chip_id)
} }
} }
struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev);
static int bnx2x_init_one(struct pci_dev *pdev, static int bnx2x_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
...@@ -13859,7 +13904,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev) ...@@ -13859,7 +13904,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev)
return 0; return 0;
} }
struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) static struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
{ {
struct bnx2x *bp = netdev_priv(dev); struct bnx2x *bp = netdev_priv(dev);
struct cnic_eth_dev *cp = &bp->cnic_eth_dev; 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,7 +13954,7 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
return cp; return cp;
} }
u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp) static u32 bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp)
{ {
struct bnx2x *bp = fp->bp; struct bnx2x *bp = fp->bp;
u32 offset = BAR_USTRORM_INTMEM; u32 offset = BAR_USTRORM_INTMEM;
......
...@@ -355,23 +355,6 @@ static bool bnx2x_get_credit_vlan(struct bnx2x_vlan_mac_obj *o) ...@@ -355,23 +355,6 @@ static bool bnx2x_get_credit_vlan(struct bnx2x_vlan_mac_obj *o)
return vp->get(vp, 1); return vp->get(vp, 1);
} }
static bool bnx2x_get_credit_vlan_mac(struct bnx2x_vlan_mac_obj *o)
{
struct bnx2x_credit_pool_obj *mp = o->macs_pool;
struct bnx2x_credit_pool_obj *vp = o->vlans_pool;
if (!mp->get(mp, 1))
return false;
if (!vp->get(vp, 1)) {
mp->put(mp, 1);
return false;
}
return true;
}
static bool bnx2x_put_cam_offset_mac(struct bnx2x_vlan_mac_obj *o, int offset) static bool bnx2x_put_cam_offset_mac(struct bnx2x_vlan_mac_obj *o, int offset)
{ {
struct bnx2x_credit_pool_obj *mp = o->macs_pool; struct bnx2x_credit_pool_obj *mp = o->macs_pool;
...@@ -400,22 +383,6 @@ static bool bnx2x_put_credit_vlan(struct bnx2x_vlan_mac_obj *o) ...@@ -400,22 +383,6 @@ static bool bnx2x_put_credit_vlan(struct bnx2x_vlan_mac_obj *o)
return vp->put(vp, 1); return vp->put(vp, 1);
} }
static bool bnx2x_put_credit_vlan_mac(struct bnx2x_vlan_mac_obj *o)
{
struct bnx2x_credit_pool_obj *mp = o->macs_pool;
struct bnx2x_credit_pool_obj *vp = o->vlans_pool;
if (!mp->put(mp, 1))
return false;
if (!vp->put(vp, 1)) {
mp->get(mp, 1);
return false;
}
return true;
}
/** /**
* __bnx2x_vlan_mac_h_write_trylock - try getting the vlan mac writer lock * __bnx2x_vlan_mac_h_write_trylock - try getting the vlan mac writer lock
* *
...@@ -507,22 +474,6 @@ static void __bnx2x_vlan_mac_h_write_unlock(struct bnx2x *bp, ...@@ -507,22 +474,6 @@ static void __bnx2x_vlan_mac_h_write_unlock(struct bnx2x *bp,
} }
} }
/**
* bnx2x_vlan_mac_h_write_unlock - unlock the vlan mac head list writer lock
*
* @bp: device handle
* @o: vlan_mac object
*
* @details Notice if a pending execution exists, it would perform it -
* possibly releasing and reclaiming the execution queue lock.
*/
void bnx2x_vlan_mac_h_write_unlock(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o)
{
spin_lock_bh(&o->exe_queue.lock);
__bnx2x_vlan_mac_h_write_unlock(bp, o);
spin_unlock_bh(&o->exe_queue.lock);
}
/** /**
* __bnx2x_vlan_mac_h_read_lock - lock the vlan mac head list reader lock * __bnx2x_vlan_mac_h_read_lock - lock the vlan mac head list reader lock
...@@ -685,25 +636,6 @@ static int bnx2x_check_vlan_add(struct bnx2x *bp, ...@@ -685,25 +636,6 @@ static int bnx2x_check_vlan_add(struct bnx2x *bp,
return 0; return 0;
} }
static int bnx2x_check_vlan_mac_add(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o,
union bnx2x_classification_ramrod_data *data)
{
struct bnx2x_vlan_mac_registry_elem *pos;
DP(BNX2X_MSG_SP, "Checking VLAN_MAC (%pM, %d) for ADD command\n",
data->vlan_mac.mac, data->vlan_mac.vlan);
list_for_each_entry(pos, &o->head, link)
if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
ether_addr_equal_unaligned(data->vlan_mac.mac, pos->u.vlan_mac.mac) &&
(data->vlan_mac.is_inner_mac ==
pos->u.vlan_mac.is_inner_mac))
return -EEXIST;
return 0;
}
/* check_del() callbacks */ /* check_del() callbacks */
static struct bnx2x_vlan_mac_registry_elem * static struct bnx2x_vlan_mac_registry_elem *
bnx2x_check_mac_del(struct bnx2x *bp, bnx2x_check_mac_del(struct bnx2x *bp,
...@@ -738,26 +670,6 @@ static struct bnx2x_vlan_mac_registry_elem * ...@@ -738,26 +670,6 @@ static struct bnx2x_vlan_mac_registry_elem *
return NULL; return NULL;
} }
static struct bnx2x_vlan_mac_registry_elem *
bnx2x_check_vlan_mac_del(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o,
union bnx2x_classification_ramrod_data *data)
{
struct bnx2x_vlan_mac_registry_elem *pos;
DP(BNX2X_MSG_SP, "Checking VLAN_MAC (%pM, %d) for DEL command\n",
data->vlan_mac.mac, data->vlan_mac.vlan);
list_for_each_entry(pos, &o->head, link)
if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) &&
ether_addr_equal_unaligned(data->vlan_mac.mac, pos->u.vlan_mac.mac) &&
(data->vlan_mac.is_inner_mac ==
pos->u.vlan_mac.is_inner_mac))
return pos;
return NULL;
}
/* check_move() callback */ /* check_move() callback */
static bool bnx2x_check_move(struct bnx2x *bp, static bool bnx2x_check_move(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *src_o, struct bnx2x_vlan_mac_obj *src_o,
...@@ -809,8 +721,8 @@ static inline u8 bnx2x_vlan_mac_get_rx_tx_flag(struct bnx2x_vlan_mac_obj *o) ...@@ -809,8 +721,8 @@ static inline u8 bnx2x_vlan_mac_get_rx_tx_flag(struct bnx2x_vlan_mac_obj *o)
return rx_tx_flag; return rx_tx_flag;
} }
void bnx2x_set_mac_in_nig(struct bnx2x *bp, static void bnx2x_set_mac_in_nig(struct bnx2x *bp,
bool add, unsigned char *dev_addr, int index) bool add, unsigned char *dev_addr, int index)
{ {
u32 wb_data[2]; u32 wb_data[2];
u32 reg_offset = BP_PORT(bp) ? NIG_REG_LLH1_FUNC_MEM : u32 reg_offset = BP_PORT(bp) ? NIG_REG_LLH1_FUNC_MEM :
...@@ -1124,97 +1036,6 @@ static void bnx2x_set_one_vlan_e2(struct bnx2x *bp, ...@@ -1124,97 +1036,6 @@ static void bnx2x_set_one_vlan_e2(struct bnx2x *bp,
rule_cnt); rule_cnt);
} }
static void bnx2x_set_one_vlan_mac_e2(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o,
struct bnx2x_exeq_elem *elem,
int rule_idx, int cam_offset)
{
struct bnx2x_raw_obj *raw = &o->raw;
struct eth_classify_rules_ramrod_data *data =
(struct eth_classify_rules_ramrod_data *)(raw->rdata);
int rule_cnt = rule_idx + 1;
union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
enum bnx2x_vlan_mac_cmd cmd = elem->cmd_data.vlan_mac.cmd;
bool add = (cmd == BNX2X_VLAN_MAC_ADD) ? true : false;
u16 vlan = elem->cmd_data.vlan_mac.u.vlan_mac.vlan;
u8 *mac = elem->cmd_data.vlan_mac.u.vlan_mac.mac;
/* Reset the ramrod data buffer for the first rule */
if (rule_idx == 0)
memset(data, 0, sizeof(*data));
/* Set a rule header */
bnx2x_vlan_mac_set_cmd_hdr_e2(bp, o, add, CLASSIFY_RULE_OPCODE_PAIR,
&rule_entry->pair.header);
/* Set VLAN and MAC themselves */
rule_entry->pair.vlan = cpu_to_le16(vlan);
bnx2x_set_fw_mac_addr(&rule_entry->pair.mac_msb,
&rule_entry->pair.mac_mid,
&rule_entry->pair.mac_lsb, mac);
rule_entry->pair.inner_mac =
cpu_to_le16(elem->cmd_data.vlan_mac.u.vlan_mac.is_inner_mac);
/* MOVE: Add a rule that will add this MAC to the target Queue */
if (cmd == BNX2X_VLAN_MAC_MOVE) {
rule_entry++;
rule_cnt++;
/* Setup ramrod data */
bnx2x_vlan_mac_set_cmd_hdr_e2(bp,
elem->cmd_data.vlan_mac.target_obj,
true, CLASSIFY_RULE_OPCODE_PAIR,
&rule_entry->pair.header);
/* Set a VLAN itself */
rule_entry->pair.vlan = cpu_to_le16(vlan);
bnx2x_set_fw_mac_addr(&rule_entry->pair.mac_msb,
&rule_entry->pair.mac_mid,
&rule_entry->pair.mac_lsb, mac);
rule_entry->pair.inner_mac =
cpu_to_le16(elem->cmd_data.vlan_mac.u.
vlan_mac.is_inner_mac);
}
/* Set the ramrod data header */
/* TODO: take this to the higher level in order to prevent multiple
writing */
bnx2x_vlan_mac_set_rdata_hdr_e2(raw->cid, raw->state, &data->header,
rule_cnt);
}
/**
* bnx2x_set_one_vlan_mac_e1h -
*
* @bp: device handle
* @o: bnx2x_vlan_mac_obj
* @elem: bnx2x_exeq_elem
* @rule_idx: rule_idx
* @cam_offset: cam_offset
*/
static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o,
struct bnx2x_exeq_elem *elem,
int rule_idx, int cam_offset)
{
struct bnx2x_raw_obj *raw = &o->raw;
struct mac_configuration_cmd *config =
(struct mac_configuration_cmd *)(raw->rdata);
/* 57710 and 57711 do not support MOVE command,
* so it's either ADD or DEL
*/
bool add = (elem->cmd_data.vlan_mac.cmd == BNX2X_VLAN_MAC_ADD) ?
true : false;
/* Reset the ramrod data buffer */
memset(config, 0, sizeof(*config));
bnx2x_vlan_mac_set_rdata_e1x(bp, o, BNX2X_FILTER_VLAN_MAC_PENDING,
cam_offset, add,
elem->cmd_data.vlan_mac.u.vlan_mac.mac,
elem->cmd_data.vlan_mac.u.vlan_mac.vlan,
ETH_VLAN_FILTER_CLASSIFY, config);
}
/** /**
* bnx2x_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element * bnx2x_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element
* *
...@@ -1314,24 +1135,6 @@ static struct bnx2x_exeq_elem *bnx2x_exeq_get_vlan( ...@@ -1314,24 +1135,6 @@ static struct bnx2x_exeq_elem *bnx2x_exeq_get_vlan(
return NULL; return NULL;
} }
static struct bnx2x_exeq_elem *bnx2x_exeq_get_vlan_mac(
struct bnx2x_exe_queue_obj *o,
struct bnx2x_exeq_elem *elem)
{
struct bnx2x_exeq_elem *pos;
struct bnx2x_vlan_mac_ramrod_data *data =
&elem->cmd_data.vlan_mac.u.vlan_mac;
/* Check pending for execution commands */
list_for_each_entry(pos, &o->exe_queue, link)
if (!memcmp(&pos->cmd_data.vlan_mac.u.vlan_mac, data,
sizeof(*data)) &&
(pos->cmd_data.vlan_mac.cmd == elem->cmd_data.vlan_mac.cmd))
return pos;
return NULL;
}
/** /**
* bnx2x_validate_vlan_mac_add - check if an ADD command can be executed * bnx2x_validate_vlan_mac_add - check if an ADD command can be executed
* *
...@@ -2239,69 +2042,6 @@ void bnx2x_init_vlan_obj(struct bnx2x *bp, ...@@ -2239,69 +2042,6 @@ void bnx2x_init_vlan_obj(struct bnx2x *bp,
} }
} }
void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *vlan_mac_obj,
u8 cl_id, u32 cid, u8 func_id, void *rdata,
dma_addr_t rdata_mapping, int state,
unsigned long *pstate, bnx2x_obj_type type,
struct bnx2x_credit_pool_obj *macs_pool,
struct bnx2x_credit_pool_obj *vlans_pool)
{
union bnx2x_qable_obj *qable_obj =
(union bnx2x_qable_obj *)vlan_mac_obj;
bnx2x_init_vlan_mac_common(vlan_mac_obj, cl_id, cid, func_id, rdata,
rdata_mapping, state, pstate, type,
macs_pool, vlans_pool);
/* CAM pool handling */
vlan_mac_obj->get_credit = bnx2x_get_credit_vlan_mac;
vlan_mac_obj->put_credit = bnx2x_put_credit_vlan_mac;
/* CAM offset is relevant for 57710 and 57711 chips only which have a
* single CAM for both MACs and VLAN-MAC pairs. So the offset
* will be taken from MACs' pool object only.
*/
vlan_mac_obj->get_cam_offset = bnx2x_get_cam_offset_mac;
vlan_mac_obj->put_cam_offset = bnx2x_put_cam_offset_mac;
if (CHIP_IS_E1(bp)) {
BNX2X_ERR("Do not support chips others than E2\n");
BUG();
} else if (CHIP_IS_E1H(bp)) {
vlan_mac_obj->set_one_rule = bnx2x_set_one_vlan_mac_e1h;
vlan_mac_obj->check_del = bnx2x_check_vlan_mac_del;
vlan_mac_obj->check_add = bnx2x_check_vlan_mac_add;
vlan_mac_obj->check_move = bnx2x_check_move_always_err;
vlan_mac_obj->ramrod_cmd = RAMROD_CMD_ID_ETH_SET_MAC;
/* Exe Queue */
bnx2x_exe_queue_init(bp,
&vlan_mac_obj->exe_queue, 1, qable_obj,
bnx2x_validate_vlan_mac,
bnx2x_remove_vlan_mac,
bnx2x_optimize_vlan_mac,
bnx2x_execute_vlan_mac,
bnx2x_exeq_get_vlan_mac);
} else {
vlan_mac_obj->set_one_rule = bnx2x_set_one_vlan_mac_e2;
vlan_mac_obj->check_del = bnx2x_check_vlan_mac_del;
vlan_mac_obj->check_add = bnx2x_check_vlan_mac_add;
vlan_mac_obj->check_move = bnx2x_check_move;
vlan_mac_obj->ramrod_cmd =
RAMROD_CMD_ID_ETH_CLASSIFICATION_RULES;
/* Exe Queue */
bnx2x_exe_queue_init(bp,
&vlan_mac_obj->exe_queue,
CLASSIFY_RULES_COUNT,
qable_obj, bnx2x_validate_vlan_mac,
bnx2x_remove_vlan_mac,
bnx2x_optimize_vlan_mac,
bnx2x_execute_vlan_mac,
bnx2x_exeq_get_vlan_mac);
}
}
/* RX_MODE verbs: DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */ /* RX_MODE verbs: DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
static inline void __storm_memset_mac_filters(struct bnx2x *bp, static inline void __storm_memset_mac_filters(struct bnx2x *bp,
struct tstorm_eth_mac_filter_config *mac_filters, struct tstorm_eth_mac_filter_config *mac_filters,
......
...@@ -448,9 +448,6 @@ enum { ...@@ -448,9 +448,6 @@ enum {
BNX2X_LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2 BNX2X_LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2
}; };
void bnx2x_set_mac_in_nig(struct bnx2x *bp,
bool add, unsigned char *dev_addr, int index);
/** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */ /** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
/* RX_MODE ramrod special flags: set in rx_mode_flags field in /* RX_MODE ramrod special flags: set in rx_mode_flags field in
...@@ -1307,22 +1304,12 @@ void bnx2x_init_vlan_obj(struct bnx2x *bp, ...@@ -1307,22 +1304,12 @@ void bnx2x_init_vlan_obj(struct bnx2x *bp,
unsigned long *pstate, bnx2x_obj_type type, unsigned long *pstate, bnx2x_obj_type type,
struct bnx2x_credit_pool_obj *vlans_pool); struct bnx2x_credit_pool_obj *vlans_pool);
void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *vlan_mac_obj,
u8 cl_id, u32 cid, u8 func_id, void *rdata,
dma_addr_t rdata_mapping, int state,
unsigned long *pstate, bnx2x_obj_type type,
struct bnx2x_credit_pool_obj *macs_pool,
struct bnx2x_credit_pool_obj *vlans_pool);
int bnx2x_vlan_mac_h_read_lock(struct bnx2x *bp, int bnx2x_vlan_mac_h_read_lock(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o); struct bnx2x_vlan_mac_obj *o);
void bnx2x_vlan_mac_h_read_unlock(struct bnx2x *bp, void bnx2x_vlan_mac_h_read_unlock(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o); struct bnx2x_vlan_mac_obj *o);
int bnx2x_vlan_mac_h_write_lock(struct bnx2x *bp, int bnx2x_vlan_mac_h_write_lock(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o); struct bnx2x_vlan_mac_obj *o);
void bnx2x_vlan_mac_h_write_unlock(struct bnx2x *bp,
struct bnx2x_vlan_mac_obj *o);
int bnx2x_config_vlan_mac(struct bnx2x *bp, int bnx2x_config_vlan_mac(struct bnx2x *bp,
struct bnx2x_vlan_mac_ramrod_params *p); struct bnx2x_vlan_mac_ramrod_params *p);
......
...@@ -799,10 +799,10 @@ int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp, ...@@ -799,10 +799,10 @@ int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp,
return -ENOMEM; return -ENOMEM;
} }
int bnx2x_vfop_vlan_set_cmd(struct bnx2x *bp, static int bnx2x_vfop_vlan_set_cmd(struct bnx2x *bp,
struct bnx2x_virtf *vf, struct bnx2x_virtf *vf,
struct bnx2x_vfop_cmd *cmd, struct bnx2x_vfop_cmd *cmd,
int qid, u16 vid, bool add) int qid, u16 vid, bool add)
{ {
struct bnx2x_vfop *vfop = bnx2x_vfop_add(bp, vf); struct bnx2x_vfop *vfop = bnx2x_vfop_add(bp, vf);
int rc; int rc;
......
...@@ -665,11 +665,6 @@ int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp, ...@@ -665,11 +665,6 @@ int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp,
struct bnx2x_vfop_filters *macs, struct bnx2x_vfop_filters *macs,
int qid, bool drv_only); int qid, bool drv_only);
int bnx2x_vfop_vlan_set_cmd(struct bnx2x *bp,
struct bnx2x_virtf *vf,
struct bnx2x_vfop_cmd *cmd,
int qid, u16 vid, bool add);
int bnx2x_vfop_vlan_list_cmd(struct bnx2x *bp, int bnx2x_vfop_vlan_list_cmd(struct bnx2x *bp,
struct bnx2x_virtf *vf, struct bnx2x_virtf *vf,
struct bnx2x_vfop_cmd *cmd, struct bnx2x_vfop_cmd *cmd,
...@@ -727,13 +722,6 @@ void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid); ...@@ -727,13 +722,6 @@ void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid);
/* Handles an FLR (or VF_DISABLE) notification form the MCP */ /* Handles an FLR (or VF_DISABLE) notification form the MCP */
void bnx2x_vf_handle_flr_event(struct bnx2x *bp); void bnx2x_vf_handle_flr_event(struct bnx2x *bp);
void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list, u16 offset, u16 type,
u16 length);
void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv,
u16 type, u16 length);
void bnx2x_vfpf_finalize(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv);
void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list);
bool bnx2x_tlv_supported(u16 tlvtype); bool bnx2x_tlv_supported(u16 tlvtype);
u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp, u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp,
...@@ -750,7 +738,6 @@ int bnx2x_vfpf_init(struct bnx2x *bp); ...@@ -750,7 +738,6 @@ int bnx2x_vfpf_init(struct bnx2x *bp);
void bnx2x_vfpf_close_vf(struct bnx2x *bp); void bnx2x_vfpf_close_vf(struct bnx2x *bp);
int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
bool is_leading); bool is_leading);
int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx);
int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set); int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set);
int bnx2x_vfpf_config_rss(struct bnx2x *bp, int bnx2x_vfpf_config_rss(struct bnx2x *bp,
struct bnx2x_config_rss_params *params); struct bnx2x_config_rss_params *params);
...@@ -814,7 +801,6 @@ static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; } ...@@ -814,7 +801,6 @@ static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; }
static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; } static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {} static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, bool is_leading) {return 0; } static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, bool is_leading) {return 0; }
static inline int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx) {return 0; }
static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr,
u8 vf_qid, bool set) {return 0; } u8 vf_qid, bool set) {return 0; }
static inline int bnx2x_vfpf_config_rss(struct bnx2x *bp, static inline int bnx2x_vfpf_config_rss(struct bnx2x *bp,
......
...@@ -21,9 +21,11 @@ ...@@ -21,9 +21,11 @@
#include "bnx2x_cmn.h" #include "bnx2x_cmn.h"
#include <linux/crc32.h> #include <linux/crc32.h>
static int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx);
/* place a given tlv on the tlv buffer at a given offset */ /* place a given tlv on the tlv buffer at a given offset */
void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list, u16 offset, u16 type, static void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list,
u16 length) u16 offset, u16 type, u16 length)
{ {
struct channel_tlv *tl = struct channel_tlv *tl =
(struct channel_tlv *)(tlvs_list + offset); (struct channel_tlv *)(tlvs_list + offset);
...@@ -33,8 +35,8 @@ void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list, u16 offset, u16 type, ...@@ -33,8 +35,8 @@ void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list, u16 offset, u16 type,
} }
/* Clear the mailbox and init the header of the first tlv */ /* Clear the mailbox and init the header of the first tlv */
void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv, static void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv,
u16 type, u16 length) u16 type, u16 length)
{ {
mutex_lock(&bp->vf2pf_mutex); mutex_lock(&bp->vf2pf_mutex);
...@@ -52,7 +54,8 @@ void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv, ...@@ -52,7 +54,8 @@ void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv,
} }
/* releases the mailbox */ /* releases the mailbox */
void bnx2x_vfpf_finalize(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv) static void bnx2x_vfpf_finalize(struct bnx2x *bp,
struct vfpf_first_tlv *first_tlv)
{ {
DP(BNX2X_MSG_IOV, "done sending [%d] tlv over vf pf channel\n", DP(BNX2X_MSG_IOV, "done sending [%d] tlv over vf pf channel\n",
first_tlv->tl.type); first_tlv->tl.type);
...@@ -85,7 +88,7 @@ static void *bnx2x_search_tlv_list(struct bnx2x *bp, void *tlvs_list, ...@@ -85,7 +88,7 @@ static void *bnx2x_search_tlv_list(struct bnx2x *bp, void *tlvs_list,
} }
/* list the types and lengths of the tlvs on the buffer */ /* list the types and lengths of the tlvs on the buffer */
void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list) static void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list)
{ {
int i = 1; int i = 1;
struct channel_tlv *tlv = (struct channel_tlv *)tlvs_list; struct channel_tlv *tlv = (struct channel_tlv *)tlvs_list;
...@@ -633,7 +636,7 @@ int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, ...@@ -633,7 +636,7 @@ int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
return rc; return rc;
} }
int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx) static int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx)
{ {
struct vfpf_q_op_tlv *req = &bp->vf2pf_mbox->req.q_op; struct vfpf_q_op_tlv *req = &bp->vf2pf_mbox->req.q_op;
struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册