Skip to content

Commit

Permalink
qlcnic: Issue INIT_NIC command only once.
Browse files Browse the repository at this point in the history
o DCB AEN registration was reissuing INIT_NIC command. Instead, club
  all options of INIT NIC command and issue this command only once.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sucheta Chakraborty authored and David S. Miller committed Dec 17, 2013
1 parent 3c44bba commit 3720bf7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 39 deletions.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] = {
{QLCNIC_CMD_CONFIG_VPORT, 4, 4},
{QLCNIC_CMD_BC_EVENT_SETUP, 2, 1},
{QLCNIC_CMD_DCB_QUERY_CAP, 1, 2},
{QLCNIC_CMD_DCB_QUERY_PARAM, 2, 50},
{QLCNIC_CMD_DCB_QUERY_PARAM, 1, 50},
};

const u32 qlcnic_83xx_ext_reg_tbl[] = {
Expand Down Expand Up @@ -1542,6 +1542,10 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,

cmd.req.arg[1] = BIT_0 | BIT_31;
}

if (adapter->dcb)
cmd.req.arg[1] |= QLC_REGISTER_DCB_AEN;

status = qlcnic_issue_cmd(adapter, &cmd);
if (status)
dev_err(&adapter->pdev->dev,
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ enum qlc_83xx_ext_regs {
QLC_83XX_ASIC_TEMP,
};

/* Initialize/Stop NIC command bit definitions */
#define QLC_REGISTER_DCB_AEN BIT_1

/* 83xx funcitons */
int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *);
int qlcnic_83xx_issue_cmd(struct qlcnic_adapter *, struct qlcnic_cmd_args *);
Expand Down
28 changes: 0 additions & 28 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#define QLC_DCB_GET_MAP(V) (1 << V)

#define QLC_DCB_AEN_BIT 0x2
#define QLC_DCB_FW_VER 0x2
#define QLC_DCB_MAX_TC 0x8
#define QLC_DCB_MAX_APP 0x8
Expand Down Expand Up @@ -71,7 +70,6 @@ static void qlcnic_82xx_dcb_aen_handler(struct qlcnic_dcb *, void *);
static int qlcnic_83xx_dcb_get_hw_capability(struct qlcnic_dcb *);
static int qlcnic_83xx_dcb_query_cee_param(struct qlcnic_dcb *, char *, u8);
static int qlcnic_83xx_dcb_get_cee_cfg(struct qlcnic_dcb *);
static int qlcnic_83xx_dcb_register_aen(struct qlcnic_dcb *, bool);
static void qlcnic_83xx_dcb_aen_handler(struct qlcnic_dcb *, void *);

struct qlcnic_dcb_capability {
Expand Down Expand Up @@ -179,7 +177,6 @@ static struct qlcnic_dcb_ops qlcnic_83xx_dcb_ops = {
.get_hw_capability = qlcnic_83xx_dcb_get_hw_capability,
.query_cee_param = qlcnic_83xx_dcb_query_cee_param,
.get_cee_cfg = qlcnic_83xx_dcb_get_cee_cfg,
.register_aen = qlcnic_83xx_dcb_register_aen,
.aen_handler = qlcnic_83xx_dcb_aen_handler,
};

Expand Down Expand Up @@ -283,7 +280,6 @@ static void __qlcnic_dcb_free(struct qlcnic_dcb *dcb)
return;

adapter = dcb->adapter;
qlcnic_dcb_register_aen(dcb, 0);

while (test_bit(QLCNIC_DCB_AEN_MODE, &dcb->state))
usleep_range(10000, 11000);
Expand All @@ -307,7 +303,6 @@ static void __qlcnic_dcb_get_info(struct qlcnic_dcb *dcb)
{
qlcnic_dcb_get_hw_capability(dcb);
qlcnic_dcb_get_cee_cfg(dcb);
qlcnic_dcb_register_aen(dcb, 1);
}

static int __qlcnic_dcb_attach(struct qlcnic_dcb *dcb)
Expand Down Expand Up @@ -645,29 +640,6 @@ static int qlcnic_83xx_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)
return err;
}

static int qlcnic_83xx_dcb_register_aen(struct qlcnic_dcb *dcb, bool flag)
{
u8 val = (flag ? QLCNIC_CMD_INIT_NIC_FUNC : QLCNIC_CMD_STOP_NIC_FUNC);
struct qlcnic_adapter *adapter = dcb->adapter;
struct qlcnic_cmd_args cmd;
int err;

err = qlcnic_alloc_mbx_args(&cmd, adapter, val);
if (err)
return err;

cmd.req.arg[1] = QLC_DCB_AEN_BIT;

err = qlcnic_issue_cmd(adapter, &cmd);
if (err)
dev_err(&adapter->pdev->dev, "Failed to %s DCBX AEN, err %d\n",
(flag ? "register" : "unregister"), err);

qlcnic_free_mbx_args(&cmd);

return err;
}

static void qlcnic_83xx_dcb_aen_handler(struct qlcnic_dcb *dcb, void *data)
{
u32 *val = data;
Expand Down
8 changes: 0 additions & 8 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ struct qlcnic_dcb_ops {
int (*get_hw_capability) (struct qlcnic_dcb *);
int (*query_cee_param) (struct qlcnic_dcb *, char *, u8);
void (*init_dcbnl_ops) (struct qlcnic_dcb *);
int (*register_aen) (struct qlcnic_dcb *, bool);
void (*aen_handler) (struct qlcnic_dcb *, void *);
int (*get_cee_cfg) (struct qlcnic_dcb *);
void (*get_info) (struct qlcnic_dcb *);
Expand Down Expand Up @@ -103,13 +102,6 @@ static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)
return 0;
}

static inline void
qlcnic_dcb_register_aen(struct qlcnic_dcb *dcb, u8 flag)
{
if (dcb && dcb->ops->register_aen)
dcb->ops->register_aen(dcb, flag);
}

static inline void qlcnic_dcb_aen_handler(struct qlcnic_dcb *dcb, void *msg)
{
if (dcb && dcb->ops->aen_handler)
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2497,8 +2497,6 @@ static void qlcnic_remove(struct pci_dev *pdev)
qlcnic_cancel_idc_work(adapter);
ahw = adapter->ahw;

qlcnic_dcb_free(adapter->dcb);

unregister_netdev(netdev);
qlcnic_sriov_cleanup(adapter);

Expand All @@ -2511,6 +2509,8 @@ static void qlcnic_remove(struct pci_dev *pdev)
kfree(ahw->fw_info);
}

qlcnic_dcb_free(adapter->dcb);

qlcnic_detach(adapter);

if (adapter->npars != NULL)
Expand Down

0 comments on commit 3720bf7

Please sign in to comment.