Commit 79788450 authored by Sony Chacko's avatar Sony Chacko Committed by David S. Miller

qlcnic: move HW specific data to seperate structure

Move HW specific data to a seperate structure as part of
refactoring 82xx adapter driver.
Signed-off-by: default avatarAnirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: default avatarSony Chacko <sony.chacko@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 97ee45eb
...@@ -365,11 +365,41 @@ struct qlcnic_hardware_context { ...@@ -365,11 +365,41 @@ struct qlcnic_hardware_context {
u8 pci_func; u8 pci_func;
u8 linkup; u8 linkup;
u8 loopback_state; u8 loopback_state;
u8 beacon_state;
u8 has_link_events;
u8 fw_type;
u8 physical_port;
u8 reset_context;
u8 msix_supported;
u8 max_mac_filters;
u8 mc_enabled;
u8 max_mc_count;
u8 diag_test;
u8 num_msix;
u8 nic_mode;
char diag_cnt;
u16 port_type; u16 port_type;
u16 board_type; u16 board_type;
u8 beacon_state; u16 link_speed;
u16 link_duplex;
u16 link_autoneg;
u16 module_type;
u16 op_mode;
u16 switch_mode;
u16 max_tx_ques;
u16 max_rx_ques;
u16 max_mtu;
u32 msg_enable;
u16 act_pci_func;
u32 capabilities;
u32 temp;
u32 int_vec_bit;
u32 fw_hal_version;
struct qlcnic_hardware_ops *hw_ops;
struct qlcnic_nic_intr_coalesce coal; struct qlcnic_nic_intr_coalesce coal;
struct qlcnic_fw_dump fw_dump; struct qlcnic_fw_dump fw_dump;
}; };
...@@ -430,6 +460,7 @@ struct qlcnic_host_sds_ring { ...@@ -430,6 +460,7 @@ struct qlcnic_host_sds_ring {
} ____cacheline_internodealigned_in_smp; } ____cacheline_internodealigned_in_smp;
struct qlcnic_host_tx_ring { struct qlcnic_host_tx_ring {
u16 ctx_id;
u32 producer; u32 producer;
u32 sw_consumer; u32 sw_consumer;
u32 num_desc; u32 num_desc;
...@@ -894,6 +925,7 @@ struct qlcnic_adapter { ...@@ -894,6 +925,7 @@ struct qlcnic_adapter {
unsigned long state; unsigned long state;
u32 flags; u32 flags;
int max_drv_tx_rings;
u16 num_txd; u16 num_txd;
u16 num_rxd; u16 num_rxd;
u16 num_jumbo_rxd; u16 num_jumbo_rxd;
...@@ -902,57 +934,28 @@ struct qlcnic_adapter { ...@@ -902,57 +934,28 @@ struct qlcnic_adapter {
u8 max_rds_rings; u8 max_rds_rings;
u8 max_sds_rings; u8 max_sds_rings;
u8 msix_supported;
u8 portnum; u8 portnum;
u8 physical_port;
u8 reset_context;
u8 mc_enabled;
u8 max_mc_count;
u8 fw_wait_cnt; u8 fw_wait_cnt;
u8 fw_fail_cnt; u8 fw_fail_cnt;
u8 tx_timeo_cnt; u8 tx_timeo_cnt;
u8 need_fw_reset; u8 need_fw_reset;
u8 has_link_events;
u8 fw_type;
u16 tx_context_id;
u16 is_up; u16 is_up;
u16 link_speed;
u16 link_duplex;
u16 link_autoneg;
u16 module_type;
u16 op_mode;
u16 switch_mode;
u16 max_tx_ques;
u16 max_rx_ques;
u16 max_mtu;
u16 pvid; u16 pvid;
u32 fw_hal_version;
u32 capabilities;
u32 irq; u32 irq;
u32 temp;
u32 int_vec_bit;
u32 heartbeat; u32 heartbeat;
u8 max_mac_filters;
u8 dev_state; u8 dev_state;
u8 diag_test;
char diag_cnt;
u8 reset_ack_timeo; u8 reset_ack_timeo;
u8 dev_init_timeo; u8 dev_init_timeo;
u16 msg_enable;
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u64 dev_rst_time; u64 dev_rst_time;
u8 mac_learn; u8 mac_learn;
unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)]; unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)];
struct qlcnic_npar_info *npars; struct qlcnic_npar_info *npars;
struct qlcnic_eswitch *eswitch; struct qlcnic_eswitch *eswitch;
struct qlcnic_nic_template *nic_ops; struct qlcnic_nic_template *nic_ops;
...@@ -966,10 +969,8 @@ struct qlcnic_adapter { ...@@ -966,10 +969,8 @@ struct qlcnic_adapter {
void __iomem *isr_int_vec; void __iomem *isr_int_vec;
struct msix_entry *msix_entries; struct msix_entry *msix_entries;
struct delayed_work fw_work; struct delayed_work fw_work;
struct qlcnic_filter_hash fhash; struct qlcnic_filter_hash fhash;
spinlock_t tx_clean_lock; spinlock_t tx_clean_lock;
...@@ -1509,7 +1510,7 @@ struct qlcnic_nic_template { ...@@ -1509,7 +1510,7 @@ struct qlcnic_nic_template {
}; };
#define QLCDB(adapter, lvl, _fmt, _args...) do { \ #define QLCDB(adapter, lvl, _fmt, _args...) do { \
if (NETIF_MSG_##lvl & adapter->msg_enable) \ if (NETIF_MSG_##lvl & adapter->ahw->msg_enable) \
printk(KERN_INFO "%s: %s: " _fmt, \ printk(KERN_INFO "%s: %s: " _fmt, \
dev_name(&adapter->pdev->dev), \ dev_name(&adapter->pdev->dev), \
__func__, ##_args); \ __func__, ##_args); \
......
...@@ -35,7 +35,7 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) ...@@ -35,7 +35,7 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd)
struct qlcnic_hardware_context *ahw = adapter->ahw; struct qlcnic_hardware_context *ahw = adapter->ahw;
signature = QLCNIC_CDRP_SIGNATURE_MAKE(ahw->pci_func, signature = QLCNIC_CDRP_SIGNATURE_MAKE(ahw->pci_func,
adapter->fw_hal_version); adapter->ahw->fw_hal_version);
/* Acquire semaphore before accessing CRB */ /* Acquire semaphore before accessing CRB */
if (qlcnic_api_lock(adapter)) { if (qlcnic_api_lock(adapter)) {
...@@ -455,8 +455,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) ...@@ -455,8 +455,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter)
temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); temp = le32_to_cpu(prsp->cds_ring.host_producer_crb);
tx_ring->crb_cmd_producer = adapter->ahw->pci_base0 + temp; tx_ring->crb_cmd_producer = adapter->ahw->pci_base0 + temp;
adapter->tx_context_id = adapter->tx_ring->ctx_id = le16_to_cpu(prsp->context_id);
le16_to_cpu(prsp->context_id);
} else { } else {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Failed to create tx ctx in firmware%d\n", err); "Failed to create tx ctx in firmware%d\n", err);
...@@ -478,7 +477,7 @@ qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter) ...@@ -478,7 +477,7 @@ qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter)
struct qlcnic_cmd_args cmd; struct qlcnic_cmd_args cmd;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.req.arg1 = adapter->tx_context_id; cmd.req.arg1 = adapter->tx_ring->ctx_id;
cmd.req.arg2 = QLCNIC_DESTROY_CTX_RESET; cmd.req.arg2 = QLCNIC_DESTROY_CTX_RESET;
cmd.req.arg3 = 0; cmd.req.arg3 = 0;
cmd.req.cmd = QLCNIC_CDRP_CMD_DESTROY_TX_CTX; cmd.req.cmd = QLCNIC_CDRP_CMD_DESTROY_TX_CTX;
...@@ -750,7 +749,7 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic) ...@@ -750,7 +749,7 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic)
struct qlcnic_info_le *nic_info; struct qlcnic_info_le *nic_info;
size_t nic_size = sizeof(struct qlcnic_info_le); size_t nic_size = sizeof(struct qlcnic_info_le);
if (adapter->op_mode != QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
return err; return err;
nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
...@@ -850,8 +849,8 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id, ...@@ -850,8 +849,8 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id,
u32 arg1; u32 arg1;
struct qlcnic_cmd_args cmd; struct qlcnic_cmd_args cmd;
if (adapter->op_mode != QLCNIC_MGMT_FUNC || if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC ||
!(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) !(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE))
return err; return err;
arg1 = id | (enable_mirroring ? BIT_4 : 0); arg1 = id | (enable_mirroring ? BIT_4 : 0);
...@@ -890,8 +889,8 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, ...@@ -890,8 +889,8 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func,
if (esw_stats == NULL) if (esw_stats == NULL)
return -ENOMEM; return -ENOMEM;
if (adapter->op_mode != QLCNIC_MGMT_FUNC && if ((adapter->ahw->op_mode != QLCNIC_MGMT_FUNC) &&
func != adapter->ahw->pci_func) { (func != adapter->ahw->pci_func)) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Not privilege to query stats for func=%d", func); "Not privilege to query stats for func=%d", func);
return -EIO; return -EIO;
...@@ -1002,7 +1001,7 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch, ...@@ -1002,7 +1001,7 @@ int qlcnic_get_eswitch_stats(struct qlcnic_adapter *adapter, const u8 eswitch,
if (esw_stats == NULL) if (esw_stats == NULL)
return -ENOMEM; return -ENOMEM;
if (adapter->op_mode != QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
return -EIO; return -EIO;
if (adapter->npars == NULL) if (adapter->npars == NULL)
return -EIO; return -EIO;
...@@ -1053,7 +1052,7 @@ int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, const u8 func_esw, ...@@ -1053,7 +1052,7 @@ int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, const u8 func_esw,
u32 arg1; u32 arg1;
struct qlcnic_cmd_args cmd; struct qlcnic_cmd_args cmd;
if (adapter->op_mode != QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
return -EIO; return -EIO;
if (func_esw == QLCNIC_STATS_PORT) { if (func_esw == QLCNIC_STATS_PORT) {
...@@ -1126,7 +1125,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, ...@@ -1126,7 +1125,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter,
struct qlcnic_cmd_args cmd; struct qlcnic_cmd_args cmd;
u8 pci_func; u8 pci_func;
if (adapter->op_mode != QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
return err; return err;
pci_func = esw_cfg->pci_func; pci_func = esw_cfg->pci_func;
arg1 = (adapter->npars[pci_func].phy_port & BIT_0); arg1 = (adapter->npars[pci_func].phy_port & BIT_0);
...@@ -1141,7 +1140,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, ...@@ -1141,7 +1140,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter,
case QLCNIC_PORT_DEFAULTS: case QLCNIC_PORT_DEFAULTS:
arg1 |= (BIT_4 | BIT_6 | BIT_7); arg1 |= (BIT_4 | BIT_6 | BIT_7);
arg2 |= (BIT_0 | BIT_1); arg2 |= (BIT_0 | BIT_1);
if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
arg2 |= (BIT_2 | BIT_3); arg2 |= (BIT_2 | BIT_3);
if (!(esw_cfg->discard_tagged)) if (!(esw_cfg->discard_tagged))
arg1 &= ~BIT_4; arg1 &= ~BIT_4;
...@@ -1194,10 +1193,10 @@ qlcnic_get_eswitch_port_config(struct qlcnic_adapter *adapter, ...@@ -1194,10 +1193,10 @@ qlcnic_get_eswitch_port_config(struct qlcnic_adapter *adapter,
{ {
u32 arg1, arg2; u32 arg1, arg2;
u8 phy_port; u8 phy_port;
if (adapter->op_mode == QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC)
phy_port = adapter->npars[esw_cfg->pci_func].phy_port; phy_port = adapter->npars[esw_cfg->pci_func].phy_port;
else else
phy_port = adapter->physical_port; phy_port = adapter->ahw->physical_port;
arg1 = phy_port; arg1 = phy_port;
arg1 |= (esw_cfg->pci_func << 8); arg1 |= (esw_cfg->pci_func << 8);
if (__qlcnic_get_eswitch_port_config(adapter, &arg1, &arg2)) if (__qlcnic_get_eswitch_port_config(adapter, &arg1, &arg2))
......
...@@ -208,9 +208,9 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -208,9 +208,9 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseT_Full); ADVERTISED_1000baseT_Full);
ethtool_cmd_speed_set(ecmd, adapter->link_speed); ethtool_cmd_speed_set(ecmd, adapter->ahw->link_speed);
ecmd->duplex = adapter->link_duplex; ecmd->duplex = adapter->ahw->link_duplex;
ecmd->autoneg = adapter->link_autoneg; ecmd->autoneg = adapter->ahw->link_autoneg;
} else if (adapter->ahw->port_type == QLCNIC_XGBE) { } else if (adapter->ahw->port_type == QLCNIC_XGBE) {
u32 val; u32 val;
...@@ -224,10 +224,10 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -224,10 +224,10 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->advertising = ADVERTISED_10000baseT_Full; ecmd->advertising = ADVERTISED_10000baseT_Full;
} }
if (netif_running(dev) && adapter->has_link_events) { if (netif_running(dev) && adapter->ahw->has_link_events) {
ethtool_cmd_speed_set(ecmd, adapter->link_speed); ethtool_cmd_speed_set(ecmd, adapter->ahw->link_speed);
ecmd->autoneg = adapter->link_autoneg; ecmd->autoneg = adapter->ahw->link_autoneg;
ecmd->duplex = adapter->link_duplex; ecmd->duplex = adapter->ahw->link_duplex;
goto skip; goto skip;
} }
...@@ -238,7 +238,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -238,7 +238,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
return -EIO; return -EIO;
skip: skip:
ecmd->phy_address = adapter->physical_port; ecmd->phy_address = adapter->ahw->physical_port;
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
switch (adapter->ahw->board_type) { switch (adapter->ahw->board_type) {
...@@ -254,7 +254,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -254,7 +254,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->supported |= SUPPORTED_TP; ecmd->supported |= SUPPORTED_TP;
ecmd->advertising |= ADVERTISED_TP; ecmd->advertising |= ADVERTISED_TP;
ecmd->port = PORT_TP; ecmd->port = PORT_TP;
ecmd->autoneg = adapter->link_autoneg; ecmd->autoneg = adapter->ahw->link_autoneg;
break; break;
case QLCNIC_BRDTYPE_P3P_IMEZ: case QLCNIC_BRDTYPE_P3P_IMEZ:
case QLCNIC_BRDTYPE_P3P_XG_LOM: case QLCNIC_BRDTYPE_P3P_XG_LOM:
...@@ -270,7 +270,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -270,7 +270,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->advertising |= ADVERTISED_TP; ecmd->advertising |= ADVERTISED_TP;
ecmd->supported |= SUPPORTED_TP; ecmd->supported |= SUPPORTED_TP;
check_sfp_module = netif_running(dev) && check_sfp_module = netif_running(dev) &&
adapter->has_link_events; adapter->ahw->has_link_events;
case QLCNIC_BRDTYPE_P3P_10G_XFP: case QLCNIC_BRDTYPE_P3P_10G_XFP:
ecmd->supported |= SUPPORTED_FIBRE; ecmd->supported |= SUPPORTED_FIBRE;
ecmd->advertising |= ADVERTISED_FIBRE; ecmd->advertising |= ADVERTISED_FIBRE;
...@@ -285,7 +285,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -285,7 +285,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
(ADVERTISED_FIBRE | ADVERTISED_TP); (ADVERTISED_FIBRE | ADVERTISED_TP);
ecmd->port = PORT_FIBRE; ecmd->port = PORT_FIBRE;
check_sfp_module = netif_running(dev) && check_sfp_module = netif_running(dev) &&
adapter->has_link_events; adapter->ahw->has_link_events;
} else { } else {
ecmd->autoneg = AUTONEG_ENABLE; ecmd->autoneg = AUTONEG_ENABLE;
ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg);
...@@ -301,7 +301,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -301,7 +301,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
} }
if (check_sfp_module) { if (check_sfp_module) {
switch (adapter->module_type) { switch (adapter->ahw->module_type) {
case LINKEVENT_MODULE_OPTICAL_UNKNOWN: case LINKEVENT_MODULE_OPTICAL_UNKNOWN:
case LINKEVENT_MODULE_OPTICAL_SRLR: case LINKEVENT_MODULE_OPTICAL_SRLR:
case LINKEVENT_MODULE_OPTICAL_LRM: case LINKEVENT_MODULE_OPTICAL_LRM:
...@@ -359,9 +359,9 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -359,9 +359,9 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
else if (ret) else if (ret)
return -EIO; return -EIO;
adapter->link_speed = ethtool_cmd_speed(ecmd); adapter->ahw->link_speed = ethtool_cmd_speed(ecmd);
adapter->link_duplex = ecmd->duplex; adapter->ahw->link_duplex = ecmd->duplex;
adapter->link_autoneg = ecmd->autoneg; adapter->ahw->link_autoneg = ecmd->autoneg;
if (!netif_running(dev)) if (!netif_running(dev))
return 0; return 0;
...@@ -508,14 +508,15 @@ qlcnic_set_ringparam(struct net_device *dev, ...@@ -508,14 +508,15 @@ qlcnic_set_ringparam(struct net_device *dev,
static void qlcnic_get_channels(struct net_device *dev, static void qlcnic_get_channels(struct net_device *dev,
struct ethtool_channels *channel) struct ethtool_channels *channel)
{ {
int min;
struct qlcnic_adapter *adapter = netdev_priv(dev); struct qlcnic_adapter *adapter = netdev_priv(dev);
channel->max_rx = rounddown_pow_of_two(min_t(int, min = min_t(int, adapter->ahw->max_rx_ques, num_online_cpus());
adapter->max_rx_ques, num_online_cpus())); channel->max_rx = rounddown_pow_of_two(min);
channel->max_tx = adapter->max_tx_ques; channel->max_tx = adapter->ahw->max_tx_ques;
channel->rx_count = adapter->max_sds_rings; channel->rx_count = adapter->max_sds_rings;
channel->tx_count = adapter->max_tx_ques; channel->tx_count = adapter->ahw->max_tx_ques;
} }
static int qlcnic_set_channels(struct net_device *dev, static int qlcnic_set_channels(struct net_device *dev,
...@@ -543,7 +544,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, ...@@ -543,7 +544,7 @@ qlcnic_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause) struct ethtool_pauseparam *pause)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
int port = adapter->physical_port; int port = adapter->ahw->physical_port;
__u32 val; __u32 val;
if (adapter->ahw->port_type == QLCNIC_GBE) { if (adapter->ahw->port_type == QLCNIC_GBE) {
...@@ -588,7 +589,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, ...@@ -588,7 +589,7 @@ qlcnic_set_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause) struct ethtool_pauseparam *pause)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
int port = adapter->physical_port; int port = adapter->ahw->physical_port;
__u32 val; __u32 val;
/* read mode */ /* read mode */
...@@ -703,7 +704,7 @@ static int qlcnic_irq_test(struct net_device *netdev) ...@@ -703,7 +704,7 @@ static int qlcnic_irq_test(struct net_device *netdev)
if (ret) if (ret)
goto clear_it; goto clear_it;
adapter->diag_cnt = 0; adapter->ahw->diag_cnt = 0;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.req.cmd = QLCNIC_CDRP_CMD_INTRPT_TEST; cmd.req.cmd = QLCNIC_CDRP_CMD_INTRPT_TEST;
cmd.req.arg1 = adapter->ahw->pci_func; cmd.req.arg1 = adapter->ahw->pci_func;
...@@ -715,7 +716,7 @@ static int qlcnic_irq_test(struct net_device *netdev) ...@@ -715,7 +716,7 @@ static int qlcnic_irq_test(struct net_device *netdev)
msleep(10); msleep(10);
ret = !adapter->diag_cnt; ret = !adapter->ahw->diag_cnt;
done: done:
qlcnic_diag_free_res(netdev, max_sds_rings); qlcnic_diag_free_res(netdev, max_sds_rings);
...@@ -761,7 +762,7 @@ static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) ...@@ -761,7 +762,7 @@ static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
qlcnic_create_loopback_buff(skb->data, adapter->mac_addr); qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
skb_put(skb, QLCNIC_ILB_PKT_SIZE); skb_put(skb, QLCNIC_ILB_PKT_SIZE);
adapter->diag_cnt = 0; adapter->ahw->diag_cnt = 0;
qlcnic_xmit_frame(skb, adapter->netdev); qlcnic_xmit_frame(skb, adapter->netdev);
loop = 0; loop = 0;
...@@ -770,11 +771,11 @@ static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) ...@@ -770,11 +771,11 @@ static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
qlcnic_process_rcv_ring_diag(sds_ring); qlcnic_process_rcv_ring_diag(sds_ring);
if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP)
break; break;
} while (!adapter->diag_cnt); } while (!adapter->ahw->diag_cnt);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
if (!adapter->diag_cnt) if (!adapter->ahw->diag_cnt)
QLCDB(adapter, DRV, QLCDB(adapter, DRV,
"LB Test: packet #%d was not received\n", i + 1); "LB Test: packet #%d was not received\n", i + 1);
else else
...@@ -800,14 +801,15 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode) ...@@ -800,14 +801,15 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode)
int loop = 0; int loop = 0;
int ret; int ret;
if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_MULTI_LOOPBACK)) { if (!(adapter->ahw->capabilities &
QLCNIC_FW_CAPABILITY_MULTI_LOOPBACK)) {
netdev_info(netdev, "Firmware is not loopback test capable\n"); netdev_info(netdev, "Firmware is not loopback test capable\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
QLCDB(adapter, DRV, "%s loopback test in progress\n", QLCDB(adapter, DRV, "%s loopback test in progress\n",
mode == QLCNIC_ILB_MODE ? "internal" : "external"); mode == QLCNIC_ILB_MODE ? "internal" : "external");
if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) { if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
netdev_warn(netdev, "Loopback test not supported for non " netdev_warn(netdev, "Loopback test not supported for non "
"privilege function\n"); "privilege function\n");
return 0; return 0;
...@@ -826,7 +828,7 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode) ...@@ -826,7 +828,7 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode)
if (ret) if (ret)
goto free_res; goto free_res;
adapter->diag_cnt = 0; adapter->ahw->diag_cnt = 0;
do { do {
msleep(500); msleep(500);
qlcnic_process_rcv_ring_diag(sds_ring); qlcnic_process_rcv_ring_diag(sds_ring);
...@@ -835,8 +837,8 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode) ...@@ -835,8 +837,8 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode)
" configure request\n"); " configure request\n");
ret = -QLCNIC_FW_NOT_RESPOND; ret = -QLCNIC_FW_NOT_RESPOND;
goto free_res; goto free_res;
} else if (adapter->diag_cnt) { } else if (adapter->ahw->diag_cnt) {
ret = adapter->diag_cnt; ret = adapter->ahw->diag_cnt;
goto free_res; goto free_res;
} }
} while (!QLCNIC_IS_LB_CONFIGURED(adapter->ahw->loopback_state)); } while (!QLCNIC_IS_LB_CONFIGURED(adapter->ahw->loopback_state));
...@@ -1028,7 +1030,7 @@ static int qlcnic_set_led(struct net_device *dev, ...@@ -1028,7 +1030,7 @@ static int qlcnic_set_led(struct net_device *dev,
int max_sds_rings = adapter->max_sds_rings; int max_sds_rings = adapter->max_sds_rings;
int err = -EIO, active = 1; int err = -EIO, active = 1;
if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) { if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
netdev_warn(dev, "LED test not supported for non " netdev_warn(dev, "LED test not supported for non "
"privilege function\n"); "privilege function\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1207,14 +1209,14 @@ static u32 qlcnic_get_msglevel(struct net_device *netdev) ...@@ -1207,14 +1209,14 @@ static u32 qlcnic_get_msglevel(struct net_device *netdev)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
return adapter->msg_enable; return adapter->ahw->msg_enable;
} }
static void qlcnic_set_msglevel(struct net_device *netdev, u32 msglvl) static void qlcnic_set_msglevel(struct net_device *netdev, u32 msglvl)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
adapter->msg_enable = msglvl; adapter->ahw->msg_enable = msglvl;
} }
static int static int
......
...@@ -434,7 +434,7 @@ void qlcnic_set_multi(struct net_device *netdev) ...@@ -434,7 +434,7 @@ void qlcnic_set_multi(struct net_device *netdev)
} }
if ((netdev->flags & IFF_ALLMULTI) || if ((netdev->flags & IFF_ALLMULTI) ||
(netdev_mc_count(netdev) > adapter->max_mc_count)) { (netdev_mc_count(netdev) > adapter->ahw->max_mc_count)) {
mode = VPORT_MISS_MODE_ACCEPT_MULTI; mode = VPORT_MISS_MODE_ACCEPT_MULTI;
goto send_fw_cmd; goto send_fw_cmd;
} }
......
...@@ -246,7 +246,8 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter) ...@@ -246,7 +246,8 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
rds_ring->dma_size = rds_ring->dma_size =
QLCNIC_P3P_RX_JUMBO_BUF_MAX_LEN; QLCNIC_P3P_RX_JUMBO_BUF_MAX_LEN;
if (adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) if (adapter->ahw->capabilities &
QLCNIC_FW_CAPABILITY_HW_LRO)
rds_ring->dma_size += QLCNIC_LRO_BUFFER_EXTRA; rds_ring->dma_size += QLCNIC_LRO_BUFFER_EXTRA;
rds_ring->skb_size = rds_ring->skb_size =
...@@ -655,7 +656,7 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) { ...@@ -655,7 +656,7 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
"Not an Ethernet NIC func=%u\n", val); "Not an Ethernet NIC func=%u\n", val);
return -EIO; return -EIO;
} }
adapter->physical_port = (val >> 2); adapter->ahw->physical_port = (val >> 2);
if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo)) if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
timeo = QLCNIC_INIT_TIMEOUT_SECS; timeo = QLCNIC_INIT_TIMEOUT_SECS;
...@@ -996,7 +997,7 @@ qlcnic_get_bootld_offs(struct qlcnic_adapter *adapter) ...@@ -996,7 +997,7 @@ qlcnic_get_bootld_offs(struct qlcnic_adapter *adapter)
data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_BOOTLD, data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_BOOTLD,
QLCNIC_UNI_BOOTLD_IDX_OFF); QLCNIC_UNI_BOOTLD_IDX_OFF);
if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) if (adapter->ahw->fw_type == QLCNIC_UNIFIED_ROMIMAGE)
offs = le32_to_cpu(data_desc->findex); offs = le32_to_cpu(data_desc->findex);
return (u8 *)&adapter->fw->data[offs]; return (u8 *)&adapter->fw->data[offs];
...@@ -1010,7 +1011,7 @@ qlcnic_get_fw_offs(struct qlcnic_adapter *adapter) ...@@ -1010,7 +1011,7 @@ qlcnic_get_fw_offs(struct qlcnic_adapter *adapter)
data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW,
QLCNIC_UNI_FIRMWARE_IDX_OFF); QLCNIC_UNI_FIRMWARE_IDX_OFF);
if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) if (adapter->ahw->fw_type == QLCNIC_UNIFIED_ROMIMAGE)
offs = le32_to_cpu(data_desc->findex); offs = le32_to_cpu(data_desc->findex);
return (u8 *)&adapter->fw->data[offs]; return (u8 *)&adapter->fw->data[offs];
...@@ -1024,7 +1025,7 @@ static u32 qlcnic_get_fw_size(struct qlcnic_adapter *adapter) ...@@ -1024,7 +1025,7 @@ static u32 qlcnic_get_fw_size(struct qlcnic_adapter *adapter)
data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW, data_desc = qlcnic_get_data_desc(adapter, QLCNIC_UNI_DIR_SECT_FW,
QLCNIC_UNI_FIRMWARE_IDX_OFF); QLCNIC_UNI_FIRMWARE_IDX_OFF);
if (adapter->fw_type == QLCNIC_UNIFIED_ROMIMAGE) if (adapter->ahw->fw_type == QLCNIC_UNIFIED_ROMIMAGE)
return le32_to_cpu(data_desc->size); return le32_to_cpu(data_desc->size);
else else
return le32_to_cpu(*(__le32 *)&unirom[QLCNIC_FW_SIZE_OFFSET]); return le32_to_cpu(*(__le32 *)&unirom[QLCNIC_FW_SIZE_OFFSET]);
...@@ -1039,7 +1040,7 @@ static u32 qlcnic_get_fw_version(struct qlcnic_adapter *adapter) ...@@ -1039,7 +1040,7 @@ static u32 qlcnic_get_fw_version(struct qlcnic_adapter *adapter)
const u8 *ver_str; const u8 *ver_str;
int i, ret; int i, ret;
if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) { if (adapter->ahw->fw_type != QLCNIC_UNIFIED_ROMIMAGE) {
version_offset = *(__le32 *)&fw->data[QLCNIC_FW_VERSION_OFFSET]; version_offset = *(__le32 *)&fw->data[QLCNIC_FW_VERSION_OFFSET];
return le32_to_cpu(version_offset); return le32_to_cpu(version_offset);
} }
...@@ -1070,7 +1071,7 @@ static u32 qlcnic_get_bios_version(struct qlcnic_adapter *adapter) ...@@ -1070,7 +1071,7 @@ static u32 qlcnic_get_bios_version(struct qlcnic_adapter *adapter)
u8 *version_offset; u8 *version_offset;
__le32 temp; __le32 temp;
if (adapter->fw_type != QLCNIC_UNIFIED_ROMIMAGE) { if (adapter->ahw->fw_type != QLCNIC_UNIFIED_ROMIMAGE) {
version_offset = (u8 *)&fw->data[QLCNIC_BIOS_VERSION_OFFSET]; version_offset = (u8 *)&fw->data[QLCNIC_BIOS_VERSION_OFFSET];
return le32_to_cpu(*(__le32 *)version_offset); return le32_to_cpu(*(__le32 *)version_offset);
} }
...@@ -1141,7 +1142,7 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter) ...@@ -1141,7 +1142,7 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter)
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
dev_info(&pdev->dev, "loading firmware from %s\n", dev_info(&pdev->dev, "loading firmware from %s\n",
fw_name[adapter->fw_type]); fw_name[adapter->ahw->fw_type]);
if (fw) { if (fw) {
u64 data; u64 data;
...@@ -1233,7 +1234,7 @@ qlcnic_validate_firmware(struct qlcnic_adapter *adapter) ...@@ -1233,7 +1234,7 @@ qlcnic_validate_firmware(struct qlcnic_adapter *adapter)
u32 ver, bios, min_size; u32 ver, bios, min_size;
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
const struct firmware *fw = adapter->fw; const struct firmware *fw = adapter->fw;
u8 fw_type = adapter->fw_type; u8 fw_type = adapter->ahw->fw_type;
if (fw_type == QLCNIC_UNIFIED_ROMIMAGE) { if (fw_type == QLCNIC_UNIFIED_ROMIMAGE) {
if (qlcnic_validate_unified_romimage(adapter)) if (qlcnic_validate_unified_romimage(adapter))
...@@ -1278,7 +1279,7 @@ qlcnic_get_next_fwtype(struct qlcnic_adapter *adapter) ...@@ -1278,7 +1279,7 @@ qlcnic_get_next_fwtype(struct qlcnic_adapter *adapter)
{ {
u8 fw_type; u8 fw_type;
switch (adapter->fw_type) { switch (adapter->ahw->fw_type) {
case QLCNIC_UNKNOWN_ROMIMAGE: case QLCNIC_UNKNOWN_ROMIMAGE:
fw_type = QLCNIC_UNIFIED_ROMIMAGE; fw_type = QLCNIC_UNIFIED_ROMIMAGE;
break; break;
...@@ -1289,7 +1290,7 @@ qlcnic_get_next_fwtype(struct qlcnic_adapter *adapter) ...@@ -1289,7 +1290,7 @@ qlcnic_get_next_fwtype(struct qlcnic_adapter *adapter)
break; break;
} }
adapter->fw_type = fw_type; adapter->ahw->fw_type = fw_type;
} }
...@@ -1299,16 +1300,17 @@ void qlcnic_request_firmware(struct qlcnic_adapter *adapter) ...@@ -1299,16 +1300,17 @@ void qlcnic_request_firmware(struct qlcnic_adapter *adapter)
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
int rc; int rc;
adapter->fw_type = QLCNIC_UNKNOWN_ROMIMAGE; adapter->ahw->fw_type = QLCNIC_UNKNOWN_ROMIMAGE;
next: next:
qlcnic_get_next_fwtype(adapter); qlcnic_get_next_fwtype(adapter);
if (adapter->fw_type == QLCNIC_FLASH_ROMIMAGE) { if (adapter->ahw->fw_type == QLCNIC_FLASH_ROMIMAGE) {
adapter->fw = NULL; adapter->fw = NULL;
} else { } else {
rc = request_firmware(&adapter->fw, rc = request_firmware(&adapter->fw,
fw_name[adapter->fw_type], &pdev->dev); fw_name[adapter->ahw->fw_type],
&pdev->dev);
if (rc != 0) if (rc != 0)
goto next; goto next;
......
...@@ -709,7 +709,7 @@ static void qlcnic_handle_linkevent(struct qlcnic_adapter *adapter, ...@@ -709,7 +709,7 @@ static void qlcnic_handle_linkevent(struct qlcnic_adapter *adapter,
u8 link_status, module, duplex, autoneg, lb_status = 0; u8 link_status, module, duplex, autoneg, lb_status = 0;
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
adapter->has_link_events = 1; adapter->ahw->has_link_events = 1;
cable_OUI = msg->body[1] & 0xffffffff; cable_OUI = msg->body[1] & 0xffffffff;
cable_len = (msg->body[1] >> 32) & 0xffff; cable_len = (msg->body[1] >> 32) & 0xffff;
...@@ -736,18 +736,18 @@ static void qlcnic_handle_linkevent(struct qlcnic_adapter *adapter, ...@@ -736,18 +736,18 @@ static void qlcnic_handle_linkevent(struct qlcnic_adapter *adapter,
qlcnic_advert_link_change(adapter, link_status); qlcnic_advert_link_change(adapter, link_status);
if (duplex == LINKEVENT_FULL_DUPLEX) if (duplex == LINKEVENT_FULL_DUPLEX)
adapter->link_duplex = DUPLEX_FULL; adapter->ahw->link_duplex = DUPLEX_FULL;
else else
adapter->link_duplex = DUPLEX_HALF; adapter->ahw->link_duplex = DUPLEX_HALF;
adapter->module_type = module; adapter->ahw->module_type = module;
adapter->link_autoneg = autoneg; adapter->ahw->link_autoneg = autoneg;
if (link_status) { if (link_status) {
adapter->link_speed = link_speed; adapter->ahw->link_speed = link_speed;
} else { } else {
adapter->link_speed = SPEED_UNKNOWN; adapter->ahw->link_speed = SPEED_UNKNOWN;
adapter->link_duplex = DUPLEX_UNKNOWN; adapter->ahw->link_duplex = DUPLEX_UNKNOWN;
} }
} }
...@@ -785,17 +785,17 @@ static void qlcnic_handle_fw_message(int desc_cnt, int index, ...@@ -785,17 +785,17 @@ static void qlcnic_handle_fw_message(int desc_cnt, int index,
break; break;
case 1: case 1:
dev_info(dev, "loopback already in progress\n"); dev_info(dev, "loopback already in progress\n");
adapter->diag_cnt = -QLCNIC_TEST_IN_PROGRESS; adapter->ahw->diag_cnt = -QLCNIC_TEST_IN_PROGRESS;
break; break;
case 2: case 2:
dev_info(dev, "loopback cable is not connected\n"); dev_info(dev, "loopback cable is not connected\n");
adapter->diag_cnt = -QLCNIC_LB_CABLE_NOT_CONN; adapter->ahw->diag_cnt = -QLCNIC_LB_CABLE_NOT_CONN;
break; break;
default: default:
dev_info(dev, dev_info(dev,
"loopback configure request failed, err %x\n", "loopback configure request failed, err %x\n",
ret); ret);
adapter->diag_cnt = -QLCNIC_UNDEFINED_ERROR; adapter->ahw->diag_cnt = -QLCNIC_UNDEFINED_ERROR;
break; break;
} }
break; break;
...@@ -1169,7 +1169,7 @@ static void qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter, int ring, ...@@ -1169,7 +1169,7 @@ static void qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter, int ring,
skb_pull(skb, pkt_offset); skb_pull(skb, pkt_offset);
if (!qlcnic_check_loopback_buff(skb->data, adapter->mac_addr)) if (!qlcnic_check_loopback_buff(skb->data, adapter->mac_addr))
adapter->diag_cnt++; adapter->ahw->diag_cnt++;
else else
dump_skb(skb, adapter); dump_skb(skb, adapter);
......
...@@ -31,7 +31,7 @@ static ssize_t qlcnic_store_bridged_mode(struct device *dev, ...@@ -31,7 +31,7 @@ static ssize_t qlcnic_store_bridged_mode(struct device *dev,
unsigned long new; unsigned long new;
int ret = -EINVAL; int ret = -EINVAL;
if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG)) if (!(adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG))
goto err_out; goto err_out;
if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) if (!test_bit(__QLCNIC_DEV_UP, &adapter->state))
...@@ -54,7 +54,7 @@ static ssize_t qlcnic_show_bridged_mode(struct device *dev, ...@@ -54,7 +54,7 @@ static ssize_t qlcnic_show_bridged_mode(struct device *dev,
struct qlcnic_adapter *adapter = dev_get_drvdata(dev); struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
int bridged_mode = 0; int bridged_mode = 0;
if (adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG) if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG)
bridged_mode = !!(adapter->flags & QLCNIC_BRIDGE_ENABLED); bridged_mode = !!(adapter->flags & QLCNIC_BRIDGE_ENABLED);
return sprintf(buf, "%d\n", bridged_mode); return sprintf(buf, "%d\n", bridged_mode);
...@@ -116,7 +116,7 @@ static ssize_t qlcnic_store_beacon(struct device *dev, ...@@ -116,7 +116,7 @@ static ssize_t qlcnic_store_beacon(struct device *dev,
u8 b_state, b_rate; u8 b_state, b_rate;
int err; int err;
if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) { if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
dev_warn(dev, dev_warn(dev,
"LED test not supported in non privileged mode\n"); "LED test not supported in non privileged mode\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -413,7 +413,7 @@ static int validate_esw_config(struct qlcnic_adapter *adapter, ...@@ -413,7 +413,7 @@ static int validate_esw_config(struct qlcnic_adapter *adapter,
if (pci_func >= QLCNIC_MAX_PCI_FUNC) if (pci_func >= QLCNIC_MAX_PCI_FUNC)
return QL_STATUS_INVALID_PARAM; return QL_STATUS_INVALID_PARAM;
if (adapter->op_mode == QLCNIC_MGMT_FUNC) { if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC) {
if (adapter->npars[pci_func].type != QLCNIC_TYPE_NIC) if (adapter->npars[pci_func].type != QLCNIC_TYPE_NIC)
return QL_STATUS_INVALID_PARAM; return QL_STATUS_INVALID_PARAM;
} }
...@@ -471,7 +471,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file, ...@@ -471,7 +471,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
return ret; return ret;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (adapter->op_mode == QLCNIC_MGMT_FUNC) { if (adapter->ahw->op_mode == QLCNIC_MGMT_FUNC) {
if (qlcnic_config_switch_port(adapter, &esw_cfg[i])) if (qlcnic_config_switch_port(adapter, &esw_cfg[i]))
return QL_STATUS_INVALID_PARAM; return QL_STATUS_INVALID_PARAM;
} }
...@@ -498,7 +498,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file, ...@@ -498,7 +498,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
} }
} }
if (adapter->op_mode != QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
goto out; goto out;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
...@@ -880,7 +880,7 @@ void qlcnic_create_sysfs_entries(struct qlcnic_adapter *adapter) ...@@ -880,7 +880,7 @@ void qlcnic_create_sysfs_entries(struct qlcnic_adapter *adapter)
{ {
struct device *dev = &adapter->pdev->dev; struct device *dev = &adapter->pdev->dev;
if (adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG) if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG)
if (device_create_file(dev, &dev_attr_bridged_mode)) if (device_create_file(dev, &dev_attr_bridged_mode))
dev_warn(dev, dev_warn(dev,
"failed to create bridged_mode sysfs entry\n"); "failed to create bridged_mode sysfs entry\n");
...@@ -890,7 +890,7 @@ void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter) ...@@ -890,7 +890,7 @@ void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter)
{ {
struct device *dev = &adapter->pdev->dev; struct device *dev = &adapter->pdev->dev;
if (adapter->capabilities & QLCNIC_FW_CAPABILITY_BDG) if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_BDG)
device_remove_file(dev, &dev_attr_bridged_mode); device_remove_file(dev, &dev_attr_bridged_mode);
} }
...@@ -902,7 +902,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter) ...@@ -902,7 +902,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter)
if (device_create_bin_file(dev, &bin_attr_port_stats)) if (device_create_bin_file(dev, &bin_attr_port_stats))
dev_info(dev, "failed to create port stats sysfs entry"); dev_info(dev, "failed to create port stats sysfs entry");
if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC)
return; return;
if (device_create_file(dev, &dev_attr_diag_mode)) if (device_create_file(dev, &dev_attr_diag_mode))
dev_info(dev, "failed to create diag_mode sysfs entry\n"); dev_info(dev, "failed to create diag_mode sysfs entry\n");
...@@ -923,7 +923,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter) ...@@ -923,7 +923,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter)
return; return;
if (device_create_bin_file(dev, &bin_attr_esw_config)) if (device_create_bin_file(dev, &bin_attr_esw_config))
dev_info(dev, "failed to create esw config sysfs entry"); dev_info(dev, "failed to create esw config sysfs entry");
if (adapter->op_mode != QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
return; return;
if (device_create_bin_file(dev, &bin_attr_npar_config)) if (device_create_bin_file(dev, &bin_attr_npar_config))
dev_info(dev, "failed to create npar config sysfs entry"); dev_info(dev, "failed to create npar config sysfs entry");
...@@ -940,7 +940,7 @@ void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter) ...@@ -940,7 +940,7 @@ void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter)
device_remove_bin_file(dev, &bin_attr_port_stats); device_remove_bin_file(dev, &bin_attr_port_stats);
if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) if (adapter->ahw->op_mode == QLCNIC_NON_PRIV_FUNC)
return; return;
device_remove_file(dev, &dev_attr_diag_mode); device_remove_file(dev, &dev_attr_diag_mode);
device_remove_bin_file(dev, &bin_attr_crb); device_remove_bin_file(dev, &bin_attr_crb);
...@@ -952,7 +952,7 @@ void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter) ...@@ -952,7 +952,7 @@ void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter)
if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED))
return; return;
device_remove_bin_file(dev, &bin_attr_esw_config); device_remove_bin_file(dev, &bin_attr_esw_config);
if (adapter->op_mode != QLCNIC_MGMT_FUNC) if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
return; return;
device_remove_bin_file(dev, &bin_attr_npar_config); device_remove_bin_file(dev, &bin_attr_npar_config);
device_remove_bin_file(dev, &bin_attr_pm_config); device_remove_bin_file(dev, &bin_attr_pm_config);
......
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