Commit 3720bf79 authored by Sucheta Chakraborty's avatar Sucheta Chakraborty Committed by David S. Miller

qlcnic: Issue INIT_NIC command only once.

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: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarManish Chopra <manish.chopra@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c44bba1
...@@ -68,7 +68,7 @@ static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] = { ...@@ -68,7 +68,7 @@ static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] = {
{QLCNIC_CMD_CONFIG_VPORT, 4, 4}, {QLCNIC_CMD_CONFIG_VPORT, 4, 4},
{QLCNIC_CMD_BC_EVENT_SETUP, 2, 1}, {QLCNIC_CMD_BC_EVENT_SETUP, 2, 1},
{QLCNIC_CMD_DCB_QUERY_CAP, 1, 2}, {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[] = { const u32 qlcnic_83xx_ext_reg_tbl[] = {
...@@ -1542,6 +1542,10 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter, ...@@ -1542,6 +1542,10 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,
cmd.req.arg[1] = BIT_0 | BIT_31; 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); status = qlcnic_issue_cmd(adapter, &cmd);
if (status) if (status)
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
......
...@@ -518,6 +518,9 @@ enum qlc_83xx_ext_regs { ...@@ -518,6 +518,9 @@ enum qlc_83xx_ext_regs {
QLC_83XX_ASIC_TEMP, QLC_83XX_ASIC_TEMP,
}; };
/* Initialize/Stop NIC command bit definitions */
#define QLC_REGISTER_DCB_AEN BIT_1
/* 83xx funcitons */ /* 83xx funcitons */
int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *); int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *);
int qlcnic_83xx_issue_cmd(struct qlcnic_adapter *, struct qlcnic_cmd_args *); int qlcnic_83xx_issue_cmd(struct qlcnic_adapter *, struct qlcnic_cmd_args *);
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#define QLC_DCB_GET_MAP(V) (1 << V) #define QLC_DCB_GET_MAP(V) (1 << V)
#define QLC_DCB_AEN_BIT 0x2
#define QLC_DCB_FW_VER 0x2 #define QLC_DCB_FW_VER 0x2
#define QLC_DCB_MAX_TC 0x8 #define QLC_DCB_MAX_TC 0x8
#define QLC_DCB_MAX_APP 0x8 #define QLC_DCB_MAX_APP 0x8
...@@ -71,7 +70,6 @@ static void qlcnic_82xx_dcb_aen_handler(struct qlcnic_dcb *, void *); ...@@ -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_get_hw_capability(struct qlcnic_dcb *);
static int qlcnic_83xx_dcb_query_cee_param(struct qlcnic_dcb *, char *, u8); 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_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 *); static void qlcnic_83xx_dcb_aen_handler(struct qlcnic_dcb *, void *);
struct qlcnic_dcb_capability { struct qlcnic_dcb_capability {
...@@ -179,7 +177,6 @@ static struct qlcnic_dcb_ops qlcnic_83xx_dcb_ops = { ...@@ -179,7 +177,6 @@ static struct qlcnic_dcb_ops qlcnic_83xx_dcb_ops = {
.get_hw_capability = qlcnic_83xx_dcb_get_hw_capability, .get_hw_capability = qlcnic_83xx_dcb_get_hw_capability,
.query_cee_param = qlcnic_83xx_dcb_query_cee_param, .query_cee_param = qlcnic_83xx_dcb_query_cee_param,
.get_cee_cfg = qlcnic_83xx_dcb_get_cee_cfg, .get_cee_cfg = qlcnic_83xx_dcb_get_cee_cfg,
.register_aen = qlcnic_83xx_dcb_register_aen,
.aen_handler = qlcnic_83xx_dcb_aen_handler, .aen_handler = qlcnic_83xx_dcb_aen_handler,
}; };
...@@ -283,7 +280,6 @@ static void __qlcnic_dcb_free(struct qlcnic_dcb *dcb) ...@@ -283,7 +280,6 @@ static void __qlcnic_dcb_free(struct qlcnic_dcb *dcb)
return; return;
adapter = dcb->adapter; adapter = dcb->adapter;
qlcnic_dcb_register_aen(dcb, 0);
while (test_bit(QLCNIC_DCB_AEN_MODE, &dcb->state)) while (test_bit(QLCNIC_DCB_AEN_MODE, &dcb->state))
usleep_range(10000, 11000); usleep_range(10000, 11000);
...@@ -307,7 +303,6 @@ static void __qlcnic_dcb_get_info(struct qlcnic_dcb *dcb) ...@@ -307,7 +303,6 @@ static void __qlcnic_dcb_get_info(struct qlcnic_dcb *dcb)
{ {
qlcnic_dcb_get_hw_capability(dcb); qlcnic_dcb_get_hw_capability(dcb);
qlcnic_dcb_get_cee_cfg(dcb); qlcnic_dcb_get_cee_cfg(dcb);
qlcnic_dcb_register_aen(dcb, 1);
} }
static int __qlcnic_dcb_attach(struct qlcnic_dcb *dcb) static int __qlcnic_dcb_attach(struct qlcnic_dcb *dcb)
...@@ -645,29 +640,6 @@ static int qlcnic_83xx_dcb_get_cee_cfg(struct qlcnic_dcb *dcb) ...@@ -645,29 +640,6 @@ static int qlcnic_83xx_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)
return err; 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) static void qlcnic_83xx_dcb_aen_handler(struct qlcnic_dcb *dcb, void *data)
{ {
u32 *val = data; u32 *val = data;
......
...@@ -25,7 +25,6 @@ struct qlcnic_dcb_ops { ...@@ -25,7 +25,6 @@ struct qlcnic_dcb_ops {
int (*get_hw_capability) (struct qlcnic_dcb *); int (*get_hw_capability) (struct qlcnic_dcb *);
int (*query_cee_param) (struct qlcnic_dcb *, char *, u8); int (*query_cee_param) (struct qlcnic_dcb *, char *, u8);
void (*init_dcbnl_ops) (struct qlcnic_dcb *); void (*init_dcbnl_ops) (struct qlcnic_dcb *);
int (*register_aen) (struct qlcnic_dcb *, bool);
void (*aen_handler) (struct qlcnic_dcb *, void *); void (*aen_handler) (struct qlcnic_dcb *, void *);
int (*get_cee_cfg) (struct qlcnic_dcb *); int (*get_cee_cfg) (struct qlcnic_dcb *);
void (*get_info) (struct qlcnic_dcb *); void (*get_info) (struct qlcnic_dcb *);
...@@ -103,13 +102,6 @@ static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb) ...@@ -103,13 +102,6 @@ static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)
return 0; 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) static inline void qlcnic_dcb_aen_handler(struct qlcnic_dcb *dcb, void *msg)
{ {
if (dcb && dcb->ops->aen_handler) if (dcb && dcb->ops->aen_handler)
......
...@@ -2497,8 +2497,6 @@ static void qlcnic_remove(struct pci_dev *pdev) ...@@ -2497,8 +2497,6 @@ static void qlcnic_remove(struct pci_dev *pdev)
qlcnic_cancel_idc_work(adapter); qlcnic_cancel_idc_work(adapter);
ahw = adapter->ahw; ahw = adapter->ahw;
qlcnic_dcb_free(adapter->dcb);
unregister_netdev(netdev); unregister_netdev(netdev);
qlcnic_sriov_cleanup(adapter); qlcnic_sriov_cleanup(adapter);
...@@ -2511,6 +2509,8 @@ static void qlcnic_remove(struct pci_dev *pdev) ...@@ -2511,6 +2509,8 @@ static void qlcnic_remove(struct pci_dev *pdev)
kfree(ahw->fw_info); kfree(ahw->fw_info);
} }
qlcnic_dcb_free(adapter->dcb);
qlcnic_detach(adapter); qlcnic_detach(adapter);
if (adapter->npars != NULL) if (adapter->npars != NULL)
......
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