Commit b1fc6d3c authored by Anirban Chakraborty's avatar Anirban Chakraborty Committed by David S. Miller

qlcnic: Cleanup patch

 1. Changed adapter structure to move away from embedding hardware and
    receive context structs and use pointers to those objects
 2. Packed all the structs that interface with FW
 3. Removed unused code and structs
Signed-off-by: default avatarAnirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f848d6dd
This diff is collapsed.
This diff is collapsed.
...@@ -150,10 +150,10 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -150,10 +150,10 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{ {
struct qlcnic_adapter *adapter = netdev_priv(dev); struct qlcnic_adapter *adapter = netdev_priv(dev);
int check_sfp_module = 0; int check_sfp_module = 0;
u16 pcifn = adapter->ahw.pci_func; u16 pcifn = adapter->ahw->pci_func;
/* read which mode */ /* read which mode */
if (adapter->ahw.port_type == QLCNIC_GBE) { if (adapter->ahw->port_type == QLCNIC_GBE) {
ecmd->supported = (SUPPORTED_10baseT_Half | ecmd->supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Half |
...@@ -170,7 +170,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -170,7 +170,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->duplex = adapter->link_duplex; ecmd->duplex = adapter->link_duplex;
ecmd->autoneg = adapter->link_autoneg; ecmd->autoneg = adapter->link_autoneg;
} else if (adapter->ahw.port_type == QLCNIC_XGBE) { } else if (adapter->ahw->port_type == QLCNIC_XGBE) {
u32 val; u32 val;
val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR);
...@@ -201,7 +201,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -201,7 +201,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->phy_address = adapter->physical_port; ecmd->phy_address = adapter->physical_port;
ecmd->transceiver = XCVR_EXTERNAL; ecmd->transceiver = XCVR_EXTERNAL;
switch (adapter->ahw.board_type) { switch (adapter->ahw->board_type) {
case QLCNIC_BRDTYPE_P3P_REF_QG: case QLCNIC_BRDTYPE_P3P_REF_QG:
case QLCNIC_BRDTYPE_P3P_4_GB: case QLCNIC_BRDTYPE_P3P_4_GB:
case QLCNIC_BRDTYPE_P3P_4_GB_MM: case QLCNIC_BRDTYPE_P3P_4_GB_MM:
...@@ -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)
ecmd->autoneg = AUTONEG_DISABLE; ecmd->autoneg = AUTONEG_DISABLE;
break; break;
case QLCNIC_BRDTYPE_P3P_10G_TP: case QLCNIC_BRDTYPE_P3P_10G_TP:
if (adapter->ahw.port_type == QLCNIC_XGBE) { if (adapter->ahw->port_type == QLCNIC_XGBE) {
ecmd->autoneg = AUTONEG_DISABLE; ecmd->autoneg = AUTONEG_DISABLE;
ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP);
ecmd->advertising |= ecmd->advertising |=
...@@ -256,7 +256,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -256,7 +256,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
break; break;
default: default:
dev_err(&adapter->pdev->dev, "Unsupported board model %d\n", dev_err(&adapter->pdev->dev, "Unsupported board model %d\n",
adapter->ahw.board_type); adapter->ahw->board_type);
return -EIO; return -EIO;
} }
...@@ -288,7 +288,7 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -288,7 +288,7 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
__u32 status; __u32 status;
/* read which mode */ /* read which mode */
if (adapter->ahw.port_type == QLCNIC_GBE) { if (adapter->ahw->port_type == QLCNIC_GBE) {
/* autonegotiation */ /* autonegotiation */
if (qlcnic_fw_cmd_set_phy(adapter, if (qlcnic_fw_cmd_set_phy(adapter,
QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG, QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG,
...@@ -340,14 +340,14 @@ static void ...@@ -340,14 +340,14 @@ static void
qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
{ {
struct qlcnic_adapter *adapter = netdev_priv(dev); struct qlcnic_adapter *adapter = netdev_priv(dev);
struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
struct qlcnic_host_sds_ring *sds_ring; struct qlcnic_host_sds_ring *sds_ring;
u32 *regs_buff = p; u32 *regs_buff = p;
int ring, i = 0, j = 0; int ring, i = 0, j = 0;
memset(p, 0, qlcnic_get_regs_len(dev)); memset(p, 0, qlcnic_get_regs_len(dev));
regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) | regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) |
(adapter->ahw.revision_id << 16) | (adapter->pdev)->device; (adapter->ahw->revision_id << 16) | (adapter->pdev)->device;
regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE & 0xffff)); regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE & 0xffff));
regs_buff[1] = QLCNIC_MGMT_API_VERSION; regs_buff[1] = QLCNIC_MGMT_API_VERSION;
...@@ -382,7 +382,7 @@ static u32 qlcnic_test_link(struct net_device *dev) ...@@ -382,7 +382,7 @@ static u32 qlcnic_test_link(struct net_device *dev)
u32 val; u32 val;
val = QLCRD32(adapter, CRB_XG_STATE_P3P); val = QLCRD32(adapter, CRB_XG_STATE_P3P);
val = XG_LINK_STATE_P3P(adapter->ahw.pci_func, val); val = XG_LINK_STATE_P3P(adapter->ahw->pci_func, val);
return (val == XG_LINK_UP_P3P) ? 0 : 1; return (val == XG_LINK_UP_P3P) ? 0 : 1;
} }
...@@ -482,7 +482,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, ...@@ -482,7 +482,7 @@ qlcnic_get_pauseparam(struct net_device *netdev,
int port = adapter->physical_port; int port = adapter->physical_port;
__u32 val; __u32 val;
if (adapter->ahw.port_type == QLCNIC_GBE) { if (adapter->ahw->port_type == QLCNIC_GBE) {
if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS))
return; return;
/* get flow control settings */ /* get flow control settings */
...@@ -504,7 +504,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, ...@@ -504,7 +504,7 @@ qlcnic_get_pauseparam(struct net_device *netdev,
pause->tx_pause = !(qlcnic_gb_get_gb3_mask(val)); pause->tx_pause = !(qlcnic_gb_get_gb3_mask(val));
break; break;
} }
} else if (adapter->ahw.port_type == QLCNIC_XGBE) { } else if (adapter->ahw->port_type == QLCNIC_XGBE) {
if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS))
return; return;
pause->rx_pause = 1; pause->rx_pause = 1;
...@@ -515,7 +515,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, ...@@ -515,7 +515,7 @@ qlcnic_get_pauseparam(struct net_device *netdev,
pause->tx_pause = !(qlcnic_xg_get_xg1_mask(val)); pause->tx_pause = !(qlcnic_xg_get_xg1_mask(val));
} else { } else {
dev_err(&netdev->dev, "Unknown board type: %x\n", dev_err(&netdev->dev, "Unknown board type: %x\n",
adapter->ahw.port_type); adapter->ahw->port_type);
} }
} }
...@@ -528,7 +528,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, ...@@ -528,7 +528,7 @@ qlcnic_set_pauseparam(struct net_device *netdev,
__u32 val; __u32 val;
/* read mode */ /* read mode */
if (adapter->ahw.port_type == QLCNIC_GBE) { if (adapter->ahw->port_type == QLCNIC_GBE) {
if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS))
return -EIO; return -EIO;
/* set flow control */ /* set flow control */
...@@ -571,7 +571,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, ...@@ -571,7 +571,7 @@ qlcnic_set_pauseparam(struct net_device *netdev,
break; break;
} }
QLCWR32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, val); QLCWR32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, val);
} else if (adapter->ahw.port_type == QLCNIC_XGBE) { } else if (adapter->ahw->port_type == QLCNIC_XGBE) {
if (!pause->rx_pause || pause->autoneg) if (!pause->rx_pause || pause->autoneg)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -593,7 +593,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, ...@@ -593,7 +593,7 @@ qlcnic_set_pauseparam(struct net_device *netdev,
QLCWR32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, val); QLCWR32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, val);
} else { } else {
dev_err(&netdev->dev, "Unknown board type: %x\n", dev_err(&netdev->dev, "Unknown board type: %x\n",
adapter->ahw.port_type); adapter->ahw->port_type);
} }
return 0; return 0;
} }
...@@ -639,8 +639,8 @@ static int qlcnic_irq_test(struct net_device *netdev) ...@@ -639,8 +639,8 @@ static int qlcnic_irq_test(struct net_device *netdev)
goto clear_it; goto clear_it;
adapter->diag_cnt = 0; adapter->diag_cnt = 0;
ret = qlcnic_issue_cmd(adapter, adapter->ahw.pci_func, ret = qlcnic_issue_cmd(adapter, adapter->ahw->pci_func,
adapter->fw_hal_version, adapter->portnum, adapter->fw_hal_version, adapter->ahw->pci_func,
0, 0, 0x00000011); 0, 0, 0x00000011);
if (ret) if (ret)
goto done; goto done;
...@@ -749,14 +749,14 @@ qlcnic_get_ethtool_stats(struct net_device *dev, ...@@ -749,14 +749,14 @@ qlcnic_get_ethtool_stats(struct net_device *dev,
return; return;
memset(&port_stats, 0, sizeof(struct qlcnic_esw_statistics)); memset(&port_stats, 0, sizeof(struct qlcnic_esw_statistics));
ret = qlcnic_get_port_stats(adapter, adapter->ahw.pci_func, ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func,
QLCNIC_QUERY_RX_COUNTER, &port_stats.rx); QLCNIC_QUERY_RX_COUNTER, &port_stats.rx);
if (ret) if (ret)
return; return;
qlcnic_fill_device_stats(&index, data, &port_stats.rx); qlcnic_fill_device_stats(&index, data, &port_stats.rx);
ret = qlcnic_get_port_stats(adapter, adapter->ahw.pci_func, ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func,
QLCNIC_QUERY_TX_COUNTER, &port_stats.tx); QLCNIC_QUERY_TX_COUNTER, &port_stats.tx);
if (ret) if (ret)
return; return;
......
...@@ -457,7 +457,7 @@ int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode) ...@@ -457,7 +457,7 @@ int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode)
req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23); req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23);
word = QLCNIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE | word = QLCNIC_H2C_OPCODE_SET_MAC_RECEIVE_MODE |
((u64)adapter->portnum << 16); ((u64)adapter->portnum << 16);
req.req_hdr = cpu_to_le64(word); req.req_hdr = cpu_to_le64(word);
...@@ -780,7 +780,7 @@ qlcnic_pci_get_crb_addr_2M(struct qlcnic_adapter *adapter, ...@@ -780,7 +780,7 @@ qlcnic_pci_get_crb_addr_2M(struct qlcnic_adapter *adapter,
m = &crb_128M_2M_map[CRB_BLK(off)].sub_block[CRB_SUBBLK(off)]; m = &crb_128M_2M_map[CRB_BLK(off)].sub_block[CRB_SUBBLK(off)];
if (m->valid && (m->start_128M <= off) && (m->end_128M > off)) { if (m->valid && (m->start_128M <= off) && (m->end_128M > off)) {
*addr = adapter->ahw.pci_base0 + m->start_2M + *addr = adapter->ahw->pci_base0 + m->start_2M +
(off - m->start_128M); (off - m->start_128M);
return 0; return 0;
} }
...@@ -788,7 +788,7 @@ qlcnic_pci_get_crb_addr_2M(struct qlcnic_adapter *adapter, ...@@ -788,7 +788,7 @@ qlcnic_pci_get_crb_addr_2M(struct qlcnic_adapter *adapter,
/* /*
* Not in direct map, use crb window * Not in direct map, use crb window
*/ */
*addr = adapter->ahw.pci_base0 + CRB_INDIRECT_2M + (off & MASK(16)); *addr = adapter->ahw->pci_base0 + CRB_INDIRECT_2M + (off & MASK(16));
return 1; return 1;
} }
...@@ -801,7 +801,7 @@ static int ...@@ -801,7 +801,7 @@ static int
qlcnic_pci_set_crbwindow_2M(struct qlcnic_adapter *adapter, ulong off) qlcnic_pci_set_crbwindow_2M(struct qlcnic_adapter *adapter, ulong off)
{ {
u32 window; u32 window;
void __iomem *addr = adapter->ahw.pci_base0 + CRB_WINDOW_2M; void __iomem *addr = adapter->ahw->pci_base0 + CRB_WINDOW_2M;
off -= QLCNIC_PCI_CRBSPACE; off -= QLCNIC_PCI_CRBSPACE;
...@@ -838,13 +838,13 @@ qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, ulong off, u32 data) ...@@ -838,13 +838,13 @@ qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, ulong off, u32 data)
if (rv > 0) { if (rv > 0) {
/* indirect access */ /* indirect access */
write_lock_irqsave(&adapter->ahw.crb_lock, flags); write_lock_irqsave(&adapter->ahw->crb_lock, flags);
crb_win_lock(adapter); crb_win_lock(adapter);
rv = qlcnic_pci_set_crbwindow_2M(adapter, off); rv = qlcnic_pci_set_crbwindow_2M(adapter, off);
if (!rv) if (!rv)
writel(data, addr); writel(data, addr);
crb_win_unlock(adapter); crb_win_unlock(adapter);
write_unlock_irqrestore(&adapter->ahw.crb_lock, flags); write_unlock_irqrestore(&adapter->ahw->crb_lock, flags);
return rv; return rv;
} }
...@@ -869,12 +869,12 @@ qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off) ...@@ -869,12 +869,12 @@ qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off)
if (rv > 0) { if (rv > 0) {
/* indirect access */ /* indirect access */
write_lock_irqsave(&adapter->ahw.crb_lock, flags); write_lock_irqsave(&adapter->ahw->crb_lock, flags);
crb_win_lock(adapter); crb_win_lock(adapter);
if (!qlcnic_pci_set_crbwindow_2M(adapter, off)) if (!qlcnic_pci_set_crbwindow_2M(adapter, off))
data = readl(addr); data = readl(addr);
crb_win_unlock(adapter); crb_win_unlock(adapter);
write_unlock_irqrestore(&adapter->ahw.crb_lock, flags); write_unlock_irqrestore(&adapter->ahw->crb_lock, flags);
return data; return data;
} }
...@@ -904,9 +904,9 @@ qlcnic_pci_set_window_2M(struct qlcnic_adapter *adapter, ...@@ -904,9 +904,9 @@ qlcnic_pci_set_window_2M(struct qlcnic_adapter *adapter,
window = OCM_WIN_P3P(addr); window = OCM_WIN_P3P(addr);
writel(window, adapter->ahw.ocm_win_crb); writel(window, adapter->ahw->ocm_win_crb);
/* read back to flush */ /* read back to flush */
readl(adapter->ahw.ocm_win_crb); readl(adapter->ahw->ocm_win_crb);
*start = QLCNIC_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr); *start = QLCNIC_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr);
return 0; return 0;
...@@ -920,13 +920,13 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off, ...@@ -920,13 +920,13 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off,
int ret; int ret;
u32 start; u32 start;
mutex_lock(&adapter->ahw.mem_lock); mutex_lock(&adapter->ahw->mem_lock);
ret = qlcnic_pci_set_window_2M(adapter, off, &start); ret = qlcnic_pci_set_window_2M(adapter, off, &start);
if (ret != 0) if (ret != 0)
goto unlock; goto unlock;
addr = adapter->ahw.pci_base0 + start; addr = adapter->ahw->pci_base0 + start;
if (op == 0) /* read */ if (op == 0) /* read */
*data = readq(addr); *data = readq(addr);
...@@ -934,7 +934,7 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off, ...@@ -934,7 +934,7 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off,
writeq(*data, addr); writeq(*data, addr);
unlock: unlock:
mutex_unlock(&adapter->ahw.mem_lock); mutex_unlock(&adapter->ahw->mem_lock);
return ret; return ret;
} }
...@@ -942,23 +942,23 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off, ...@@ -942,23 +942,23 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off,
void void
qlcnic_pci_camqm_read_2M(struct qlcnic_adapter *adapter, u64 off, u64 *data) qlcnic_pci_camqm_read_2M(struct qlcnic_adapter *adapter, u64 off, u64 *data)
{ {
void __iomem *addr = adapter->ahw.pci_base0 + void __iomem *addr = adapter->ahw->pci_base0 +
QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM); QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM);
mutex_lock(&adapter->ahw.mem_lock); mutex_lock(&adapter->ahw->mem_lock);
*data = readq(addr); *data = readq(addr);
mutex_unlock(&adapter->ahw.mem_lock); mutex_unlock(&adapter->ahw->mem_lock);
} }
void void
qlcnic_pci_camqm_write_2M(struct qlcnic_adapter *adapter, u64 off, u64 data) qlcnic_pci_camqm_write_2M(struct qlcnic_adapter *adapter, u64 off, u64 data)
{ {
void __iomem *addr = adapter->ahw.pci_base0 + void __iomem *addr = adapter->ahw->pci_base0 +
QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM); QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM);
mutex_lock(&adapter->ahw.mem_lock); mutex_lock(&adapter->ahw->mem_lock);
writeq(data, addr); writeq(data, addr);
mutex_unlock(&adapter->ahw.mem_lock); mutex_unlock(&adapter->ahw->mem_lock);
} }
#define MAX_CTL_CHECK 1000 #define MAX_CTL_CHECK 1000
...@@ -997,7 +997,7 @@ qlcnic_pci_mem_write_2M(struct qlcnic_adapter *adapter, ...@@ -997,7 +997,7 @@ qlcnic_pci_mem_write_2M(struct qlcnic_adapter *adapter,
correct: correct:
off8 = off & ~0xf; off8 = off & ~0xf;
mutex_lock(&adapter->ahw.mem_lock); mutex_lock(&adapter->ahw->mem_lock);
writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO));
writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI));
...@@ -1049,7 +1049,7 @@ qlcnic_pci_mem_write_2M(struct qlcnic_adapter *adapter, ...@@ -1049,7 +1049,7 @@ qlcnic_pci_mem_write_2M(struct qlcnic_adapter *adapter,
ret = 0; ret = 0;
done: done:
mutex_unlock(&adapter->ahw.mem_lock); mutex_unlock(&adapter->ahw->mem_lock);
return ret; return ret;
} }
...@@ -1091,7 +1091,7 @@ qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter, ...@@ -1091,7 +1091,7 @@ qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter,
correct: correct:
off8 = off & ~0xf; off8 = off & ~0xf;
mutex_lock(&adapter->ahw.mem_lock); mutex_lock(&adapter->ahw->mem_lock);
writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO));
writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI));
...@@ -1121,7 +1121,7 @@ qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter, ...@@ -1121,7 +1121,7 @@ qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter,
ret = 0; ret = 0;
} }
mutex_unlock(&adapter->ahw.mem_lock); mutex_unlock(&adapter->ahw->mem_lock);
return ret; return ret;
} }
...@@ -1145,7 +1145,7 @@ int qlcnic_get_board_info(struct qlcnic_adapter *adapter) ...@@ -1145,7 +1145,7 @@ int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
if (qlcnic_rom_fast_read(adapter, offset, &board_type)) if (qlcnic_rom_fast_read(adapter, offset, &board_type))
return -EIO; return -EIO;
adapter->ahw.board_type = board_type; adapter->ahw->board_type = board_type;
if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) {
u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I); u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I);
...@@ -1164,20 +1164,20 @@ int qlcnic_get_board_info(struct qlcnic_adapter *adapter) ...@@ -1164,20 +1164,20 @@ int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
case QLCNIC_BRDTYPE_P3P_10G_SFP_QT: case QLCNIC_BRDTYPE_P3P_10G_SFP_QT:
case QLCNIC_BRDTYPE_P3P_10G_XFP: case QLCNIC_BRDTYPE_P3P_10G_XFP:
case QLCNIC_BRDTYPE_P3P_10000_BASE_T: case QLCNIC_BRDTYPE_P3P_10000_BASE_T:
adapter->ahw.port_type = QLCNIC_XGBE; adapter->ahw->port_type = QLCNIC_XGBE;
break; break;
case QLCNIC_BRDTYPE_P3P_REF_QG: case QLCNIC_BRDTYPE_P3P_REF_QG:
case QLCNIC_BRDTYPE_P3P_4_GB: case QLCNIC_BRDTYPE_P3P_4_GB:
case QLCNIC_BRDTYPE_P3P_4_GB_MM: case QLCNIC_BRDTYPE_P3P_4_GB_MM:
adapter->ahw.port_type = QLCNIC_GBE; adapter->ahw->port_type = QLCNIC_GBE;
break; break;
case QLCNIC_BRDTYPE_P3P_10G_TP: case QLCNIC_BRDTYPE_P3P_10G_TP:
adapter->ahw.port_type = (adapter->portnum < 2) ? adapter->ahw->port_type = (adapter->portnum < 2) ?
QLCNIC_XGBE : QLCNIC_GBE; QLCNIC_XGBE : QLCNIC_GBE;
break; break;
default: default:
dev_err(&pdev->dev, "unknown board type %x\n", board_type); dev_err(&pdev->dev, "unknown board type %x\n", board_type);
adapter->ahw.port_type = QLCNIC_XGBE; adapter->ahw->port_type = QLCNIC_XGBE;
break; break;
} }
......
...@@ -94,7 +94,7 @@ void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter) ...@@ -94,7 +94,7 @@ void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter)
struct qlcnic_rx_buffer *rx_buf; struct qlcnic_rx_buffer *rx_buf;
int i, ring; int i, ring;
recv_ctx = &adapter->recv_ctx; recv_ctx = adapter->recv_ctx;
for (ring = 0; ring < adapter->max_rds_rings; ring++) { for (ring = 0; ring < adapter->max_rds_rings; ring++) {
rds_ring = &recv_ctx->rds_rings[ring]; rds_ring = &recv_ctx->rds_rings[ring];
for (i = 0; i < rds_ring->num_desc; ++i) { for (i = 0; i < rds_ring->num_desc; ++i) {
...@@ -119,7 +119,7 @@ void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter) ...@@ -119,7 +119,7 @@ void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter)
struct qlcnic_rx_buffer *rx_buf; struct qlcnic_rx_buffer *rx_buf;
int i, ring; int i, ring;
recv_ctx = &adapter->recv_ctx; recv_ctx = adapter->recv_ctx;
for (ring = 0; ring < adapter->max_rds_rings; ring++) { for (ring = 0; ring < adapter->max_rds_rings; ring++) {
rds_ring = &recv_ctx->rds_rings[ring]; rds_ring = &recv_ctx->rds_rings[ring];
...@@ -173,7 +173,7 @@ void qlcnic_free_sw_resources(struct qlcnic_adapter *adapter) ...@@ -173,7 +173,7 @@ void qlcnic_free_sw_resources(struct qlcnic_adapter *adapter)
struct qlcnic_host_tx_ring *tx_ring; struct qlcnic_host_tx_ring *tx_ring;
int ring; int ring;
recv_ctx = &adapter->recv_ctx; recv_ctx = adapter->recv_ctx;
if (recv_ctx->rds_rings == NULL) if (recv_ctx->rds_rings == NULL)
goto skip_rds; goto skip_rds;
...@@ -226,7 +226,7 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter) ...@@ -226,7 +226,7 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter)
} }
tx_ring->cmd_buf_arr = cmd_buf_arr; tx_ring->cmd_buf_arr = cmd_buf_arr;
recv_ctx = &adapter->recv_ctx; recv_ctx = adapter->recv_ctx;
size = adapter->max_rds_rings * sizeof(struct qlcnic_host_rds_ring); size = adapter->max_rds_rings * sizeof(struct qlcnic_host_rds_ring);
rds_ring = kzalloc(size, GFP_KERNEL); rds_ring = kzalloc(size, GFP_KERNEL);
...@@ -864,7 +864,7 @@ qlcnic_validate_product_offs(struct qlcnic_adapter *adapter) ...@@ -864,7 +864,7 @@ qlcnic_validate_product_offs(struct qlcnic_adapter *adapter)
for (i = 0; i < entries; i++) { for (i = 0; i < entries; i++) {
__le32 flags, file_chiprev, offs; __le32 flags, file_chiprev, offs;
u8 chiprev = adapter->ahw.revision_id; u8 chiprev = adapter->ahw->revision_id;
u32 flagbit; u32 flagbit;
offs = cpu_to_le32(ptab_descr->findex) + offs = cpu_to_le32(ptab_descr->findex) +
...@@ -1394,7 +1394,7 @@ static struct sk_buff *qlcnic_process_rxbuf(struct qlcnic_adapter *adapter, ...@@ -1394,7 +1394,7 @@ static struct sk_buff *qlcnic_process_rxbuf(struct qlcnic_adapter *adapter,
return skb; return skb;
} }
static int static inline int
qlcnic_check_rx_tagging(struct qlcnic_adapter *adapter, struct sk_buff *skb, qlcnic_check_rx_tagging(struct qlcnic_adapter *adapter, struct sk_buff *skb,
u16 *vlan_tag) u16 *vlan_tag)
{ {
...@@ -1425,7 +1425,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter, ...@@ -1425,7 +1425,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
int ring, u64 sts_data0) int ring, u64 sts_data0)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
struct qlcnic_rx_buffer *buffer; struct qlcnic_rx_buffer *buffer;
struct sk_buff *skb; struct sk_buff *skb;
struct qlcnic_host_rds_ring *rds_ring; struct qlcnic_host_rds_ring *rds_ring;
...@@ -1488,7 +1488,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter, ...@@ -1488,7 +1488,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
int ring, u64 sts_data0, u64 sts_data1) int ring, u64 sts_data0, u64 sts_data1)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx;
struct qlcnic_rx_buffer *buffer; struct qlcnic_rx_buffer *buffer;
struct sk_buff *skb; struct sk_buff *skb;
struct qlcnic_host_rds_ring *rds_ring; struct qlcnic_host_rds_ring *rds_ring;
...@@ -1625,7 +1625,7 @@ qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max) ...@@ -1625,7 +1625,7 @@ qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max)
for (ring = 0; ring < adapter->max_rds_rings; ring++) { for (ring = 0; ring < adapter->max_rds_rings; ring++) {
struct qlcnic_host_rds_ring *rds_ring = struct qlcnic_host_rds_ring *rds_ring =
&adapter->recv_ctx.rds_rings[ring]; &adapter->recv_ctx->rds_rings[ring];
if (!list_empty(&sds_ring->free_list[ring])) { if (!list_empty(&sds_ring->free_list[ring])) {
list_for_each(cur, &sds_ring->free_list[ring]) { list_for_each(cur, &sds_ring->free_list[ring]) {
...@@ -1651,12 +1651,13 @@ qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max) ...@@ -1651,12 +1651,13 @@ qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max)
} }
void void
qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter,
struct qlcnic_host_rds_ring *rds_ring) struct qlcnic_host_rds_ring *rds_ring)
{ {
struct rcv_desc *pdesc; struct rcv_desc *pdesc;
struct qlcnic_rx_buffer *buffer; struct qlcnic_rx_buffer *buffer;
int producer, count = 0; int count = 0;
u32 producer;
struct list_head *head; struct list_head *head;
producer = rds_ring->producer; producer = rds_ring->producer;
...@@ -1696,7 +1697,8 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter, ...@@ -1696,7 +1697,8 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter,
{ {
struct rcv_desc *pdesc; struct rcv_desc *pdesc;
struct qlcnic_rx_buffer *buffer; struct qlcnic_rx_buffer *buffer;
int producer, count = 0; int count = 0;
uint32_t producer;
struct list_head *head; struct list_head *head;
if (!spin_trylock(&rds_ring->lock)) if (!spin_trylock(&rds_ring->lock))
......
This diff is collapsed.
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