Commit 0c23ad37 authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller

bnx2x: Code cleanup

This patch does several semantic things:
  - Fixing typos.
  - Removing unnecessary prints.
  - Removing unused functions and definitions.
  - Change 'strange' usage of boolean variables.
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: default avatarAriel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eeed018c
...@@ -1592,12 +1592,11 @@ struct bnx2x { ...@@ -1592,12 +1592,11 @@ struct bnx2x {
#define USING_SINGLE_MSIX_FLAG (1 << 20) #define USING_SINGLE_MSIX_FLAG (1 << 20)
#define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21) #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21)
#define IS_VF_FLAG (1 << 22) #define IS_VF_FLAG (1 << 22)
#define INTERRUPTS_ENABLED_FLAG (1 << 23) #define BC_SUPPORTS_RMMOD_CMD (1 << 23)
#define BC_SUPPORTS_RMMOD_CMD (1 << 24) #define HAS_PHYS_PORT_ID (1 << 24)
#define HAS_PHYS_PORT_ID (1 << 25) #define AER_ENABLED (1 << 25)
#define AER_ENABLED (1 << 26) #define PTP_SUPPORTED (1 << 26)
#define PTP_SUPPORTED (1 << 27) #define TX_TIMESTAMPING_EN (1 << 27)
#define TX_TIMESTAMPING_EN (1 << 28)
#define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG)
...@@ -1691,13 +1690,9 @@ struct bnx2x { ...@@ -1691,13 +1690,9 @@ struct bnx2x {
#define BNX2X_STATE_ERROR 0xf000 #define BNX2X_STATE_ERROR 0xf000
#define BNX2X_MAX_PRIORITY 8 #define BNX2X_MAX_PRIORITY 8
#define BNX2X_MAX_ENTRIES_PER_PRI 16
#define BNX2X_MAX_COS 3
#define BNX2X_MAX_TX_COS 2
int num_queues; int num_queues;
uint num_ethernet_queues; uint num_ethernet_queues;
uint num_cnic_queues; uint num_cnic_queues;
int num_napi_queues;
int disable_tpa; int disable_tpa;
u32 rx_mode; u32 rx_mode;
......
...@@ -2092,7 +2092,6 @@ static void bnx2x_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio, ...@@ -2092,7 +2092,6 @@ static void bnx2x_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio,
static u8 bnx2x_dcbnl_set_all(struct net_device *netdev) static u8 bnx2x_dcbnl_set_all(struct net_device *netdev)
{ {
struct bnx2x *bp = netdev_priv(netdev); struct bnx2x *bp = netdev_priv(netdev);
int rc = 0;
DP(BNX2X_MSG_DCB, "SET-ALL\n"); DP(BNX2X_MSG_DCB, "SET-ALL\n");
...@@ -2110,9 +2109,7 @@ static u8 bnx2x_dcbnl_set_all(struct net_device *netdev) ...@@ -2110,9 +2109,7 @@ static u8 bnx2x_dcbnl_set_all(struct net_device *netdev)
1); 1);
bnx2x_dcbx_init(bp, true); bnx2x_dcbx_init(bp, true);
} }
DP(BNX2X_MSG_DCB, "set_dcbx_params done (%d)\n", rc); DP(BNX2X_MSG_DCB, "set_dcbx_params done\n");
if (rc)
return 1;
return 0; return 0;
} }
......
...@@ -2075,8 +2075,6 @@ int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port) ...@@ -2075,8 +2075,6 @@ int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port)
else else
value = 0; value = 0;
DP(NETIF_MSG_LINK, "pin %d value 0x%x\n", gpio_num, value);
return value; return value;
} }
...@@ -4682,7 +4680,7 @@ static bool bnx2x_check_blocks_with_parity2(struct bnx2x *bp, u32 sig, ...@@ -4682,7 +4680,7 @@ static bool bnx2x_check_blocks_with_parity2(struct bnx2x *bp, u32 sig,
for (i = 0; sig; i++) { for (i = 0; sig; i++) {
cur_bit = (0x1UL << i); cur_bit = (0x1UL << i);
if (sig & cur_bit) { if (sig & cur_bit) {
res |= true; /* Each bit is real error! */ res = true; /* Each bit is real error! */
if (print) { if (print) {
switch (cur_bit) { switch (cur_bit) {
case AEU_INPUTS_ATTN_BITS_CSEMI_PARITY_ERROR: case AEU_INPUTS_ATTN_BITS_CSEMI_PARITY_ERROR:
...@@ -4761,21 +4759,21 @@ static bool bnx2x_check_blocks_with_parity3(struct bnx2x *bp, u32 sig, ...@@ -4761,21 +4759,21 @@ static bool bnx2x_check_blocks_with_parity3(struct bnx2x *bp, u32 sig,
_print_next_block((*par_num)++, _print_next_block((*par_num)++,
"MCP ROM"); "MCP ROM");
*global = true; *global = true;
res |= true; res = true;
break; break;
case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY: case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY:
if (print) if (print)
_print_next_block((*par_num)++, _print_next_block((*par_num)++,
"MCP UMP RX"); "MCP UMP RX");
*global = true; *global = true;
res |= true; res = true;
break; break;
case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY: case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY:
if (print) if (print)
_print_next_block((*par_num)++, _print_next_block((*par_num)++,
"MCP UMP TX"); "MCP UMP TX");
*global = true; *global = true;
res |= true; res = true;
break; break;
case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY: case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY:
if (print) if (print)
...@@ -4807,7 +4805,7 @@ static bool bnx2x_check_blocks_with_parity4(struct bnx2x *bp, u32 sig, ...@@ -4807,7 +4805,7 @@ static bool bnx2x_check_blocks_with_parity4(struct bnx2x *bp, u32 sig,
for (i = 0; sig; i++) { for (i = 0; sig; i++) {
cur_bit = (0x1UL << i); cur_bit = (0x1UL << i);
if (sig & cur_bit) { if (sig & cur_bit) {
res |= true; /* Each bit is real error! */ res = true; /* Each bit is real error! */
if (print) { if (print) {
switch (cur_bit) { switch (cur_bit) {
case AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR: case AEU_INPUTS_ATTN_BITS_PGLUE_PARITY_ERROR:
...@@ -6114,7 +6112,7 @@ static int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode, ...@@ -6114,7 +6112,7 @@ static int bnx2x_fill_accept_flags(struct bnx2x *bp, u32 rx_mode,
} }
/* Set ACCEPT_ANY_VLAN as we do not enable filtering by VLAN */ /* Set ACCEPT_ANY_VLAN as we do not enable filtering by VLAN */
if (bp->rx_mode != BNX2X_RX_MODE_NONE) { if (rx_mode != BNX2X_RX_MODE_NONE) {
__set_bit(BNX2X_ACCEPT_ANY_VLAN, rx_accept_flags); __set_bit(BNX2X_ACCEPT_ANY_VLAN, rx_accept_flags);
__set_bit(BNX2X_ACCEPT_ANY_VLAN, tx_accept_flags); __set_bit(BNX2X_ACCEPT_ANY_VLAN, tx_accept_flags);
} }
...@@ -9026,7 +9024,7 @@ static int bnx2x_func_wait_started(struct bnx2x *bp) ...@@ -9026,7 +9024,7 @@ static int bnx2x_func_wait_started(struct bnx2x *bp)
struct bnx2x_func_state_params func_params = {NULL}; struct bnx2x_func_state_params func_params = {NULL};
DP(NETIF_MSG_IFDOWN, DP(NETIF_MSG_IFDOWN,
"Hmmm... Unexpected function state! Forcing STARTED-->TX_ST0PPED-->STARTED\n"); "Hmmm... Unexpected function state! Forcing STARTED-->TX_STOPPED-->STARTED\n");
func_params.f_obj = &bp->func_obj; func_params.f_obj = &bp->func_obj;
__set_bit(RAMROD_DRV_CLR_ONLY, __set_bit(RAMROD_DRV_CLR_ONLY,
......
...@@ -1321,8 +1321,6 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, ...@@ -1321,8 +1321,6 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
BNX2X_MAX_NUM_VF_QUEUES * sizeof(struct bnx2x_vf_queue), BNX2X_MAX_NUM_VF_QUEUES * sizeof(struct bnx2x_vf_queue),
GFP_KERNEL); GFP_KERNEL);
DP(BNX2X_MSG_IOV, "bp->vfdb->vfqs was %p\n", bp->vfdb->vfqs);
if (!bp->vfdb->vfqs) { if (!bp->vfdb->vfqs) {
BNX2X_ERR("failed to allocate vf queue array\n"); BNX2X_ERR("failed to allocate vf queue array\n");
err = -ENOMEM; err = -ENOMEM;
...@@ -1985,21 +1983,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) ...@@ -1985,21 +1983,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp)
bp->fw_stats_req->hdr.cmd_num = bp->fw_stats_num + stats_count; bp->fw_stats_req->hdr.cmd_num = bp->fw_stats_num + stats_count;
} }
static inline
struct bnx2x_virtf *__vf_from_stat_id(struct bnx2x *bp, u8 stat_id)
{
int i;
struct bnx2x_virtf *vf = NULL;
for_each_vf(bp, i) {
vf = BP_VF(bp, i);
if (stat_id >= vf->igu_base_id &&
stat_id < vf->igu_base_id + vf_sb_count(vf))
break;
}
return vf;
}
/* VF API helpers */ /* VF API helpers */
static void bnx2x_vf_qtbl_set_q(struct bnx2x *bp, u8 abs_vfid, u8 qid, static void bnx2x_vf_qtbl_set_q(struct bnx2x *bp, u8 abs_vfid, u8 qid,
u8 enable) u8 enable)
...@@ -2362,12 +2345,6 @@ int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf) ...@@ -2362,12 +2345,6 @@ int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf)
return rc; return rc;
} }
static inline void bnx2x_vf_get_sbdf(struct bnx2x *bp,
struct bnx2x_virtf *vf, u32 *sbdf)
{
*sbdf = vf->devfn | (vf->bus << 8);
}
void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
enum channel_tlvs tlv) enum channel_tlvs tlv)
{ {
...@@ -2416,7 +2393,7 @@ void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, ...@@ -2416,7 +2393,7 @@ void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
/* log the unlock */ /* log the unlock */
DP(BNX2X_MSG_IOV, "VF[%d]: vf pf channel unlocked by %d\n", DP(BNX2X_MSG_IOV, "VF[%d]: vf pf channel unlocked by %d\n",
vf->abs_vfid, vf->op_current); vf->abs_vfid, current_tlv);
} }
static int bnx2x_set_pf_tx_switching(struct bnx2x *bp, bool enable) static int bnx2x_set_pf_tx_switching(struct bnx2x *bp, bool enable)
...@@ -2628,7 +2605,7 @@ static int bnx2x_vf_op_prep(struct bnx2x *bp, int vfidx, ...@@ -2628,7 +2605,7 @@ static int bnx2x_vf_op_prep(struct bnx2x *bp, int vfidx,
} }
if (!IS_SRIOV(bp)) { if (!IS_SRIOV(bp)) {
BNX2X_ERR("sriov is disabled - can't utilize iov-realted functionality\n"); BNX2X_ERR("sriov is disabled - can't utilize iov-related functionality\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -137,7 +137,7 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp) ...@@ -137,7 +137,7 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
cpu_to_le16(bp->stats_counter++); cpu_to_le16(bp->stats_counter++);
DP(BNX2X_MSG_STATS, "Sending statistics ramrod %d\n", DP(BNX2X_MSG_STATS, "Sending statistics ramrod %d\n",
bp->fw_stats_req->hdr.drv_stats_counter); le16_to_cpu(bp->fw_stats_req->hdr.drv_stats_counter));
/* adjust the ramrod to include VF queues statistics */ /* adjust the ramrod to include VF queues statistics */
bnx2x_iov_adjust_stats_req(bp); bnx2x_iov_adjust_stats_req(bp);
...@@ -200,7 +200,7 @@ static void bnx2x_hw_stats_post(struct bnx2x *bp) ...@@ -200,7 +200,7 @@ static void bnx2x_hw_stats_post(struct bnx2x *bp)
} }
} }
static int bnx2x_stats_comp(struct bnx2x *bp) static void bnx2x_stats_comp(struct bnx2x *bp)
{ {
u32 *stats_comp = bnx2x_sp(bp, stats_comp); u32 *stats_comp = bnx2x_sp(bp, stats_comp);
int cnt = 10; int cnt = 10;
...@@ -214,7 +214,6 @@ static int bnx2x_stats_comp(struct bnx2x *bp) ...@@ -214,7 +214,6 @@ static int bnx2x_stats_comp(struct bnx2x *bp)
cnt--; cnt--;
usleep_range(1000, 2000); usleep_range(1000, 2000);
} }
return 1;
} }
/* /*
......
...@@ -583,7 +583,6 @@ int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, ...@@ -583,7 +583,6 @@ int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
flags |= VFPF_QUEUE_FLG_STATS; flags |= VFPF_QUEUE_FLG_STATS;
flags |= VFPF_QUEUE_FLG_CACHE_ALIGN; flags |= VFPF_QUEUE_FLG_CACHE_ALIGN;
flags |= VFPF_QUEUE_FLG_VLAN; flags |= VFPF_QUEUE_FLG_VLAN;
DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
/* Common */ /* Common */
req->vf_qid = fp_idx; req->vf_qid = fp_idx;
...@@ -952,14 +951,6 @@ static void storm_memset_vf_mbx_valid(struct bnx2x *bp, u16 abs_fid) ...@@ -952,14 +951,6 @@ static void storm_memset_vf_mbx_valid(struct bnx2x *bp, u16 abs_fid)
REG_WR8(bp, addr, 1); REG_WR8(bp, addr, 1);
} }
static inline void bnx2x_set_vf_mbxs_valid(struct bnx2x *bp)
{
int i;
for_each_vf(bp, i)
storm_memset_vf_mbx_valid(bp, bnx2x_vf(bp, i, abs_vfid));
}
/* enable vf_pf mailbox (aka vf-pf-channel) */ /* enable vf_pf mailbox (aka vf-pf-channel) */
void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid) void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment