aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-08-02 09:19:21 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-02 19:26:43 -0400
commit060e0c752b5047ee691120b75df4c16743981e50 (patch)
tree6d24a0ec7d6324ff2ca80c6f9ea6f1f1d6d1a2df /drivers/net/cxgb4
parent35d35682041686572d5158993dede90bc73dc1d9 (diff)
cxgb4: support running the driver on PCI functions besides 0
Add support for running the driver on any PCI function. Mostly this entails replacing a constant 0 in a number of calls with the variable function number. Signed-off-by: Dimitris Michailidis <dm@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4')
-rw-r--r--drivers/net/cxgb4/cxgb4.h3
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c128
-rw-r--r--drivers/net/cxgb4/sge.c38
3 files changed, 97 insertions, 72 deletions
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index 4769c1c58e85..6e562c0dad7d 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -482,7 +482,8 @@ struct adapter {
482 struct pci_dev *pdev; 482 struct pci_dev *pdev;
483 struct device *pdev_dev; 483 struct device *pdev_dev;
484 unsigned long registered_device_map; 484 unsigned long registered_device_map;
485 unsigned long flags; 485 unsigned int fn;
486 unsigned int flags;
486 487
487 const char *name; 488 const char *name;
488 int msg_enable; 489 int msg_enable;
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index e80d4a5e9faa..5d5ea822731f 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -171,10 +171,10 @@ enum {
171 NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP |\ 171 NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP |\
172 NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) 172 NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
173 173
174#define CH_DEVICE(devid) { PCI_VDEVICE(CHELSIO, devid), 0 } 174#define CH_DEVICE(devid, data) { PCI_VDEVICE(CHELSIO, devid), (data) }
175 175
176static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = { 176static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = {
177 CH_DEVICE(0xa000), /* PE10K */ 177 CH_DEVICE(0xa000, 0), /* PE10K */
178 { 0, } 178 { 0, }
179}; 179};
180 180
@@ -314,12 +314,13 @@ static int set_addr_filters(const struct net_device *dev, bool sleep)
314 int uc_cnt = netdev_uc_count(dev); 314 int uc_cnt = netdev_uc_count(dev);
315 int mc_cnt = netdev_mc_count(dev); 315 int mc_cnt = netdev_mc_count(dev);
316 const struct port_info *pi = netdev_priv(dev); 316 const struct port_info *pi = netdev_priv(dev);
317 unsigned int mb = pi->adapter->fn;
317 318
318 /* first do the secondary unicast addresses */ 319 /* first do the secondary unicast addresses */
319 netdev_for_each_uc_addr(ha, dev) { 320 netdev_for_each_uc_addr(ha, dev) {
320 addr[naddr++] = ha->addr; 321 addr[naddr++] = ha->addr;
321 if (--uc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) { 322 if (--uc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) {
322 ret = t4_alloc_mac_filt(pi->adapter, 0, pi->viid, free, 323 ret = t4_alloc_mac_filt(pi->adapter, mb, pi->viid, free,
323 naddr, addr, filt_idx, &uhash, sleep); 324 naddr, addr, filt_idx, &uhash, sleep);
324 if (ret < 0) 325 if (ret < 0)
325 return ret; 326 return ret;
@@ -333,7 +334,7 @@ static int set_addr_filters(const struct net_device *dev, bool sleep)
333 netdev_for_each_mc_addr(ha, dev) { 334 netdev_for_each_mc_addr(ha, dev) {
334 addr[naddr++] = ha->addr; 335 addr[naddr++] = ha->addr;
335 if (--mc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) { 336 if (--mc_cnt == 0 || naddr >= ARRAY_SIZE(addr)) {
336 ret = t4_alloc_mac_filt(pi->adapter, 0, pi->viid, free, 337 ret = t4_alloc_mac_filt(pi->adapter, mb, pi->viid, free,
337 naddr, addr, filt_idx, &mhash, sleep); 338 naddr, addr, filt_idx, &mhash, sleep);
338 if (ret < 0) 339 if (ret < 0)
339 return ret; 340 return ret;
@@ -343,7 +344,7 @@ static int set_addr_filters(const struct net_device *dev, bool sleep)
343 } 344 }
344 } 345 }
345 346
346 return t4_set_addr_hash(pi->adapter, 0, pi->viid, uhash != 0, 347 return t4_set_addr_hash(pi->adapter, mb, pi->viid, uhash != 0,
347 uhash | mhash, sleep); 348 uhash | mhash, sleep);
348} 349}
349 350
@@ -358,7 +359,7 @@ static int set_rxmode(struct net_device *dev, int mtu, bool sleep_ok)
358 359
359 ret = set_addr_filters(dev, sleep_ok); 360 ret = set_addr_filters(dev, sleep_ok);
360 if (ret == 0) 361 if (ret == 0)
361 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, mtu, 362 ret = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, mtu,
362 (dev->flags & IFF_PROMISC) ? 1 : 0, 363 (dev->flags & IFF_PROMISC) ? 1 : 0,
363 (dev->flags & IFF_ALLMULTI) ? 1 : 0, 1, -1, 364 (dev->flags & IFF_ALLMULTI) ? 1 : 0, 1, -1,
364 sleep_ok); 365 sleep_ok);
@@ -375,15 +376,16 @@ static int link_start(struct net_device *dev)
375{ 376{
376 int ret; 377 int ret;
377 struct port_info *pi = netdev_priv(dev); 378 struct port_info *pi = netdev_priv(dev);
379 unsigned int mb = pi->adapter->fn;
378 380
379 /* 381 /*
380 * We do not set address filters and promiscuity here, the stack does 382 * We do not set address filters and promiscuity here, the stack does
381 * that step explicitly. 383 * that step explicitly.
382 */ 384 */
383 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, dev->mtu, -1, -1, -1, 385 ret = t4_set_rxmode(pi->adapter, mb, pi->viid, dev->mtu, -1, -1, -1,
384 pi->vlan_grp != NULL, true); 386 pi->vlan_grp != NULL, true);
385 if (ret == 0) { 387 if (ret == 0) {
386 ret = t4_change_mac(pi->adapter, 0, pi->viid, 388 ret = t4_change_mac(pi->adapter, mb, pi->viid,
387 pi->xact_addr_filt, dev->dev_addr, true, 389 pi->xact_addr_filt, dev->dev_addr, true,
388 true); 390 true);
389 if (ret >= 0) { 391 if (ret >= 0) {
@@ -392,9 +394,10 @@ static int link_start(struct net_device *dev)
392 } 394 }
393 } 395 }
394 if (ret == 0) 396 if (ret == 0)
395 ret = t4_link_start(pi->adapter, 0, pi->tx_chan, &pi->link_cfg); 397 ret = t4_link_start(pi->adapter, mb, pi->tx_chan,
398 &pi->link_cfg);
396 if (ret == 0) 399 if (ret == 0)
397 ret = t4_enable_vi(pi->adapter, 0, pi->viid, true, true); 400 ret = t4_enable_vi(pi->adapter, mb, pi->viid, true, true);
398 return ret; 401 return ret;
399} 402}
400 403
@@ -618,8 +621,8 @@ static int write_rss(const struct port_info *pi, const u16 *queues)
618 for (i = 0; i < pi->rss_size; i++, queues++) 621 for (i = 0; i < pi->rss_size; i++, queues++)
619 rss[i] = q[*queues].rspq.abs_id; 622 rss[i] = q[*queues].rspq.abs_id;
620 623
621 err = t4_config_rss_range(pi->adapter, 0, pi->viid, 0, pi->rss_size, 624 err = t4_config_rss_range(pi->adapter, pi->adapter->fn, pi->viid, 0,
622 rss, pi->rss_size); 625 pi->rss_size, rss, pi->rss_size);
623 kfree(rss); 626 kfree(rss);
624 return err; 627 return err;
625} 628}
@@ -1307,16 +1310,18 @@ static int restart_autoneg(struct net_device *dev)
1307 return -EAGAIN; 1310 return -EAGAIN;
1308 if (p->link_cfg.autoneg != AUTONEG_ENABLE) 1311 if (p->link_cfg.autoneg != AUTONEG_ENABLE)
1309 return -EINVAL; 1312 return -EINVAL;
1310 t4_restart_aneg(p->adapter, 0, p->tx_chan); 1313 t4_restart_aneg(p->adapter, p->adapter->fn, p->tx_chan);
1311 return 0; 1314 return 0;
1312} 1315}
1313 1316
1314static int identify_port(struct net_device *dev, u32 data) 1317static int identify_port(struct net_device *dev, u32 data)
1315{ 1318{
1319 struct adapter *adap = netdev2adap(dev);
1320
1316 if (data == 0) 1321 if (data == 0)
1317 data = 2; /* default to 2 seconds */ 1322 data = 2; /* default to 2 seconds */
1318 1323
1319 return t4_identify_port(netdev2adap(dev), 0, netdev2pinfo(dev)->viid, 1324 return t4_identify_port(adap, adap->fn, netdev2pinfo(dev)->viid,
1320 data * 5); 1325 data * 5);
1321} 1326}
1322 1327
@@ -1456,7 +1461,8 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1456 lc->autoneg = cmd->autoneg; 1461 lc->autoneg = cmd->autoneg;
1457 1462
1458 if (netif_running(dev)) 1463 if (netif_running(dev))
1459 return t4_link_start(p->adapter, 0, p->tx_chan, lc); 1464 return t4_link_start(p->adapter, p->adapter->fn, p->tx_chan,
1465 lc);
1460 return 0; 1466 return 0;
1461} 1467}
1462 1468
@@ -1488,7 +1494,8 @@ static int set_pauseparam(struct net_device *dev,
1488 if (epause->tx_pause) 1494 if (epause->tx_pause)
1489 lc->requested_fc |= PAUSE_TX; 1495 lc->requested_fc |= PAUSE_TX;
1490 if (netif_running(dev)) 1496 if (netif_running(dev))
1491 return t4_link_start(p->adapter, 0, p->tx_chan, lc); 1497 return t4_link_start(p->adapter, p->adapter->fn, p->tx_chan,
1498 lc);
1492 return 0; 1499 return 0;
1493} 1500}
1494 1501
@@ -1620,7 +1627,8 @@ static int set_rxq_intr_params(struct adapter *adap, struct sge_rspq *q,
1620 v = FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | 1627 v = FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) |
1621 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH) | 1628 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH) |
1622 FW_PARAMS_PARAM_YZ(q->cntxt_id); 1629 FW_PARAMS_PARAM_YZ(q->cntxt_id);
1623 err = t4_set_params(adap, 0, 0, 0, 1, &v, &new_idx); 1630 err = t4_set_params(adap, adap->fn, adap->fn, 0, 1, &v,
1631 &new_idx);
1624 if (err) 1632 if (err)
1625 return err; 1633 return err;
1626 } 1634 }
@@ -2496,9 +2504,11 @@ static void uld_attach(struct adapter *adap, unsigned int uld)
2496 lli.adapter_type = adap->params.rev; 2504 lli.adapter_type = adap->params.rev;
2497 lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2)); 2505 lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2));
2498 lli.udb_density = 1 << QUEUESPERPAGEPF0_GET( 2506 lli.udb_density = 1 << QUEUESPERPAGEPF0_GET(
2499 t4_read_reg(adap, SGE_EGRESS_QUEUES_PER_PAGE_PF)); 2507 t4_read_reg(adap, SGE_EGRESS_QUEUES_PER_PAGE_PF) >>
2508 (adap->fn * 4));
2500 lli.ucq_density = 1 << QUEUESPERPAGEPF0_GET( 2509 lli.ucq_density = 1 << QUEUESPERPAGEPF0_GET(
2501 t4_read_reg(adap, SGE_INGRESS_QUEUES_PER_PAGE_PF)); 2510 t4_read_reg(adap, SGE_INGRESS_QUEUES_PER_PAGE_PF) >>
2511 (adap->fn * 4));
2502 lli.gts_reg = adap->regs + MYPF_REG(SGE_PF_GTS); 2512 lli.gts_reg = adap->regs + MYPF_REG(SGE_PF_GTS);
2503 lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL); 2513 lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL);
2504 lli.fw_vers = adap->params.fw_vers; 2514 lli.fw_vers = adap->params.fw_vers;
@@ -2715,7 +2725,7 @@ static int cxgb_close(struct net_device *dev)
2715 2725
2716 netif_tx_stop_all_queues(dev); 2726 netif_tx_stop_all_queues(dev);
2717 netif_carrier_off(dev); 2727 netif_carrier_off(dev);
2718 return t4_enable_vi(adapter, 0, pi->viid, false, false); 2728 return t4_enable_vi(adapter, adapter->fn, pi->viid, false, false);
2719} 2729}
2720 2730
2721static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev, 2731static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev,
@@ -2762,6 +2772,7 @@ static struct rtnl_link_stats64 *cxgb_get_stats(struct net_device *dev,
2762 2772
2763static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd) 2773static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2764{ 2774{
2775 unsigned int mbox;
2765 int ret = 0, prtad, devad; 2776 int ret = 0, prtad, devad;
2766 struct port_info *pi = netdev_priv(dev); 2777 struct port_info *pi = netdev_priv(dev);
2767 struct mii_ioctl_data *data = (struct mii_ioctl_data *)&req->ifr_data; 2778 struct mii_ioctl_data *data = (struct mii_ioctl_data *)&req->ifr_data;
@@ -2784,11 +2795,12 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2784 } else 2795 } else
2785 return -EINVAL; 2796 return -EINVAL;
2786 2797
2798 mbox = pi->adapter->fn;
2787 if (cmd == SIOCGMIIREG) 2799 if (cmd == SIOCGMIIREG)
2788 ret = t4_mdio_rd(pi->adapter, 0, prtad, devad, 2800 ret = t4_mdio_rd(pi->adapter, mbox, prtad, devad,
2789 data->reg_num, &data->val_out); 2801 data->reg_num, &data->val_out);
2790 else 2802 else
2791 ret = t4_mdio_wr(pi->adapter, 0, prtad, devad, 2803 ret = t4_mdio_wr(pi->adapter, mbox, prtad, devad,
2792 data->reg_num, data->val_in); 2804 data->reg_num, data->val_in);
2793 break; 2805 break;
2794 default: 2806 default:
@@ -2810,8 +2822,8 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
2810 2822
2811 if (new_mtu < 81 || new_mtu > MAX_MTU) /* accommodate SACK */ 2823 if (new_mtu < 81 || new_mtu > MAX_MTU) /* accommodate SACK */
2812 return -EINVAL; 2824 return -EINVAL;
2813 ret = t4_set_rxmode(pi->adapter, 0, pi->viid, new_mtu, -1, -1, -1, -1, 2825 ret = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, new_mtu, -1,
2814 true); 2826 -1, -1, -1, true);
2815 if (!ret) 2827 if (!ret)
2816 dev->mtu = new_mtu; 2828 dev->mtu = new_mtu;
2817 return ret; 2829 return ret;
@@ -2826,8 +2838,8 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
2826 if (!is_valid_ether_addr(addr->sa_data)) 2838 if (!is_valid_ether_addr(addr->sa_data))
2827 return -EINVAL; 2839 return -EINVAL;
2828 2840
2829 ret = t4_change_mac(pi->adapter, 0, pi->viid, pi->xact_addr_filt, 2841 ret = t4_change_mac(pi->adapter, pi->adapter->fn, pi->viid,
2830 addr->sa_data, true, true); 2842 pi->xact_addr_filt, addr->sa_data, true, true);
2831 if (ret < 0) 2843 if (ret < 0)
2832 return ret; 2844 return ret;
2833 2845
@@ -2841,8 +2853,8 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2841 struct port_info *pi = netdev_priv(dev); 2853 struct port_info *pi = netdev_priv(dev);
2842 2854
2843 pi->vlan_grp = grp; 2855 pi->vlan_grp = grp;
2844 t4_set_rxmode(pi->adapter, 0, pi->viid, -1, -1, -1, -1, grp != NULL, 2856 t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, -1, -1, -1,
2845 true); 2857 grp != NULL, true);
2846} 2858}
2847 2859
2848#ifdef CONFIG_NET_POLL_CONTROLLER 2860#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -2926,7 +2938,7 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c)
2926 c->op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | 2938 c->op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
2927 FW_CMD_REQUEST | FW_CMD_READ); 2939 FW_CMD_REQUEST | FW_CMD_READ);
2928 c->retval_len16 = htonl(FW_LEN16(*c)); 2940 c->retval_len16 = htonl(FW_LEN16(*c));
2929 ret = t4_wr_mbox(adap, 0, c, sizeof(*c), c); 2941 ret = t4_wr_mbox(adap, adap->fn, c, sizeof(*c), c);
2930 if (ret < 0) 2942 if (ret < 0)
2931 return ret; 2943 return ret;
2932 2944
@@ -2942,36 +2954,33 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c)
2942 } 2954 }
2943 c->op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | 2955 c->op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
2944 FW_CMD_REQUEST | FW_CMD_WRITE); 2956 FW_CMD_REQUEST | FW_CMD_WRITE);
2945 ret = t4_wr_mbox(adap, 0, c, sizeof(*c), NULL); 2957 ret = t4_wr_mbox(adap, adap->fn, c, sizeof(*c), NULL);
2946 if (ret < 0) 2958 if (ret < 0)
2947 return ret; 2959 return ret;
2948 2960
2949 ret = t4_config_glbl_rss(adap, 0, 2961 ret = t4_config_glbl_rss(adap, adap->fn,
2950 FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL, 2962 FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL,
2951 FW_RSS_GLB_CONFIG_CMD_TNLMAPEN | 2963 FW_RSS_GLB_CONFIG_CMD_TNLMAPEN |
2952 FW_RSS_GLB_CONFIG_CMD_TNLALLLKP); 2964 FW_RSS_GLB_CONFIG_CMD_TNLALLLKP);
2953 if (ret < 0) 2965 if (ret < 0)
2954 return ret; 2966 return ret;
2955 2967
2956 ret = t4_cfg_pfvf(adap, 0, 0, 0, MAX_EGRQ, 64, MAX_INGQ, 0, 0, 4, 2968 ret = t4_cfg_pfvf(adap, adap->fn, adap->fn, 0, MAX_EGRQ, 64, MAX_INGQ,
2957 0xf, 0xf, 16, FW_CMD_CAP_PF, FW_CMD_CAP_PF); 2969 0, 0, 4, 0xf, 0xf, 16, FW_CMD_CAP_PF, FW_CMD_CAP_PF);
2958 if (ret < 0) 2970 if (ret < 0)
2959 return ret; 2971 return ret;
2960 2972
2961 t4_sge_init(adap); 2973 t4_sge_init(adap);
2962 2974
2963 /* get basic stuff going */
2964 ret = t4_early_init(adap, 0);
2965 if (ret < 0)
2966 return ret;
2967
2968 /* tweak some settings */ 2975 /* tweak some settings */
2969 t4_write_reg(adap, TP_SHIFT_CNT, 0x64f8849); 2976 t4_write_reg(adap, TP_SHIFT_CNT, 0x64f8849);
2970 t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12)); 2977 t4_write_reg(adap, ULP_RX_TDDP_PSZ, HPZ0(PAGE_SHIFT - 12));
2971 t4_write_reg(adap, TP_PIO_ADDR, TP_INGRESS_CONFIG); 2978 t4_write_reg(adap, TP_PIO_ADDR, TP_INGRESS_CONFIG);
2972 v = t4_read_reg(adap, TP_PIO_DATA); 2979 v = t4_read_reg(adap, TP_PIO_DATA);
2973 t4_write_reg(adap, TP_PIO_DATA, v & ~CSUM_HAS_PSEUDO_HDR); 2980 t4_write_reg(adap, TP_PIO_DATA, v & ~CSUM_HAS_PSEUDO_HDR);
2974 return 0; 2981
2982 /* get basic stuff going */
2983 return t4_early_init(adap, adap->fn);
2975} 2984}
2976 2985
2977/* 2986/*
@@ -2999,7 +3008,7 @@ static int adap_init0(struct adapter *adap)
2999 return ret; 3008 return ret;
3000 3009
3001 /* contact FW, request master */ 3010 /* contact FW, request master */
3002 ret = t4_fw_hello(adap, 0, 0, MASTER_MUST, &state); 3011 ret = t4_fw_hello(adap, adap->fn, adap->fn, MASTER_MUST, &state);
3003 if (ret < 0) { 3012 if (ret < 0) {
3004 dev_err(adap->pdev_dev, "could not connect to FW, error %d\n", 3013 dev_err(adap->pdev_dev, "could not connect to FW, error %d\n",
3005 ret); 3014 ret);
@@ -3007,7 +3016,7 @@ static int adap_init0(struct adapter *adap)
3007 } 3016 }
3008 3017
3009 /* reset device */ 3018 /* reset device */
3010 ret = t4_fw_reset(adap, 0, PIORSTMODE | PIORST); 3019 ret = t4_fw_reset(adap, adap->fn, PIORSTMODE | PIORST);
3011 if (ret < 0) 3020 if (ret < 0)
3012 goto bye; 3021 goto bye;
3013 3022
@@ -3023,7 +3032,7 @@ static int adap_init0(struct adapter *adap)
3023 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param)) 3032 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
3024 3033
3025 params[0] = FW_PARAM_DEV(CCLK); 3034 params[0] = FW_PARAM_DEV(CCLK);
3026 ret = t4_query_params(adap, 0, 0, 0, 1, params, val); 3035 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 1, params, val);
3027 if (ret < 0) 3036 if (ret < 0)
3028 goto bye; 3037 goto bye;
3029 adap->params.vpd.cclk = val[0]; 3038 adap->params.vpd.cclk = val[0];
@@ -3034,14 +3043,15 @@ static int adap_init0(struct adapter *adap)
3034 3043
3035#define FW_PARAM_PFVF(param) \ 3044#define FW_PARAM_PFVF(param) \
3036 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \ 3045 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \
3037 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param)) 3046 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param) | \
3047 FW_PARAMS_PARAM_Y(adap->fn))
3038 3048
3039 params[0] = FW_PARAM_DEV(PORTVEC); 3049 params[0] = FW_PARAM_DEV(PORTVEC);
3040 params[1] = FW_PARAM_PFVF(L2T_START); 3050 params[1] = FW_PARAM_PFVF(L2T_START);
3041 params[2] = FW_PARAM_PFVF(L2T_END); 3051 params[2] = FW_PARAM_PFVF(L2T_END);
3042 params[3] = FW_PARAM_PFVF(FILTER_START); 3052 params[3] = FW_PARAM_PFVF(FILTER_START);
3043 params[4] = FW_PARAM_PFVF(FILTER_END); 3053 params[4] = FW_PARAM_PFVF(FILTER_END);
3044 ret = t4_query_params(adap, 0, 0, 0, 5, params, val); 3054 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 5, params, val);
3045 if (ret < 0) 3055 if (ret < 0)
3046 goto bye; 3056 goto bye;
3047 port_vec = val[0]; 3057 port_vec = val[0];
@@ -3056,7 +3066,8 @@ static int adap_init0(struct adapter *adap)
3056 params[3] = FW_PARAM_PFVF(TDDP_START); 3066 params[3] = FW_PARAM_PFVF(TDDP_START);
3057 params[4] = FW_PARAM_PFVF(TDDP_END); 3067 params[4] = FW_PARAM_PFVF(TDDP_END);
3058 params[5] = FW_PARAM_DEV(FLOWC_BUFFIFO_SZ); 3068 params[5] = FW_PARAM_DEV(FLOWC_BUFFIFO_SZ);
3059 ret = t4_query_params(adap, 0, 0, 0, 6, params, val); 3069 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,
3070 val);
3060 if (ret < 0) 3071 if (ret < 0)
3061 goto bye; 3072 goto bye;
3062 adap->tids.ntids = val[0]; 3073 adap->tids.ntids = val[0];
@@ -3075,7 +3086,8 @@ static int adap_init0(struct adapter *adap)
3075 params[3] = FW_PARAM_PFVF(RQ_END); 3086 params[3] = FW_PARAM_PFVF(RQ_END);
3076 params[4] = FW_PARAM_PFVF(PBL_START); 3087 params[4] = FW_PARAM_PFVF(PBL_START);
3077 params[5] = FW_PARAM_PFVF(PBL_END); 3088 params[5] = FW_PARAM_PFVF(PBL_END);
3078 ret = t4_query_params(adap, 0, 0, 0, 6, params, val); 3089 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,
3090 val);
3079 if (ret < 0) 3091 if (ret < 0)
3080 goto bye; 3092 goto bye;
3081 adap->vres.stag.start = val[0]; 3093 adap->vres.stag.start = val[0];
@@ -3091,7 +3103,8 @@ static int adap_init0(struct adapter *adap)
3091 params[3] = FW_PARAM_PFVF(CQ_END); 3103 params[3] = FW_PARAM_PFVF(CQ_END);
3092 params[4] = FW_PARAM_PFVF(OCQ_START); 3104 params[4] = FW_PARAM_PFVF(OCQ_START);
3093 params[5] = FW_PARAM_PFVF(OCQ_END); 3105 params[5] = FW_PARAM_PFVF(OCQ_END);
3094 ret = t4_query_params(adap, 0, 0, 0, 6, params, val); 3106 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 6, params,
3107 val);
3095 if (ret < 0) 3108 if (ret < 0)
3096 goto bye; 3109 goto bye;
3097 adap->vres.qp.start = val[0]; 3110 adap->vres.qp.start = val[0];
@@ -3104,7 +3117,8 @@ static int adap_init0(struct adapter *adap)
3104 if (c.iscsicaps) { 3117 if (c.iscsicaps) {
3105 params[0] = FW_PARAM_PFVF(ISCSI_START); 3118 params[0] = FW_PARAM_PFVF(ISCSI_START);
3106 params[1] = FW_PARAM_PFVF(ISCSI_END); 3119 params[1] = FW_PARAM_PFVF(ISCSI_END);
3107 ret = t4_query_params(adap, 0, 0, 0, 2, params, val); 3120 ret = t4_query_params(adap, adap->fn, adap->fn, 0, 2, params,
3121 val);
3108 if (ret < 0) 3122 if (ret < 0)
3109 goto bye; 3123 goto bye;
3110 adap->vres.iscsi.start = val[0]; 3124 adap->vres.iscsi.start = val[0];
@@ -3142,7 +3156,7 @@ static int adap_init0(struct adapter *adap)
3142 3156
3143 /* VF numbering starts at 1! */ 3157 /* VF numbering starts at 1! */
3144 for (vf = 1; vf <= num_vf[pf]; vf++) { 3158 for (vf = 1; vf <= num_vf[pf]; vf++) {
3145 ret = t4_cfg_pfvf(adap, 0, pf, vf, 3159 ret = t4_cfg_pfvf(adap, adap->fn, pf, vf,
3146 VFRES_NEQ, VFRES_NETHCTRL, 3160 VFRES_NEQ, VFRES_NETHCTRL,
3147 VFRES_NIQFLINT, VFRES_NIQ, 3161 VFRES_NIQFLINT, VFRES_NIQ,
3148 VFRES_TC, VFRES_NVI, 3162 VFRES_TC, VFRES_NVI,
@@ -3168,7 +3182,7 @@ static int adap_init0(struct adapter *adap)
3168 * commands. 3182 * commands.
3169 */ 3183 */
3170bye: if (ret != -ETIMEDOUT && ret != -EIO) 3184bye: if (ret != -ETIMEDOUT && ret != -EIO)
3171 t4_fw_bye(adap, 0); 3185 t4_fw_bye(adap, adap->fn);
3172 return ret; 3186 return ret;
3173} 3187}
3174 3188
@@ -3224,7 +3238,7 @@ static pci_ers_result_t eeh_slot_reset(struct pci_dev *pdev)
3224 3238
3225 if (t4_wait_dev_ready(adap) < 0) 3239 if (t4_wait_dev_ready(adap) < 0)
3226 return PCI_ERS_RESULT_DISCONNECT; 3240 return PCI_ERS_RESULT_DISCONNECT;
3227 if (t4_fw_hello(adap, 0, 0, MASTER_MUST, NULL)) 3241 if (t4_fw_hello(adap, adap->fn, adap->fn, MASTER_MUST, NULL))
3228 return PCI_ERS_RESULT_DISCONNECT; 3242 return PCI_ERS_RESULT_DISCONNECT;
3229 adap->flags |= FW_OK; 3243 adap->flags |= FW_OK;
3230 if (adap_init1(adap, &c)) 3244 if (adap_init1(adap, &c))
@@ -3233,7 +3247,8 @@ static pci_ers_result_t eeh_slot_reset(struct pci_dev *pdev)
3233 for_each_port(adap, i) { 3247 for_each_port(adap, i) {
3234 struct port_info *p = adap2pinfo(adap, i); 3248 struct port_info *p = adap2pinfo(adap, i);
3235 3249
3236 ret = t4_alloc_vi(adap, 0, p->tx_chan, 0, 0, 1, NULL, NULL); 3250 ret = t4_alloc_vi(adap, adap->fn, p->tx_chan, adap->fn, 0, 1,
3251 NULL, NULL);
3237 if (ret < 0) 3252 if (ret < 0)
3238 return PCI_ERS_RESULT_DISCONNECT; 3253 return PCI_ERS_RESULT_DISCONNECT;
3239 p->viid = ret; 3254 p->viid = ret;
@@ -3538,7 +3553,7 @@ static void free_some_resources(struct adapter *adapter)
3538 free_netdev(adapter->port[i]); 3553 free_netdev(adapter->port[i]);
3539 } 3554 }
3540 if (adapter->flags & FW_OK) 3555 if (adapter->flags & FW_OK)
3541 t4_fw_bye(adapter, 0); 3556 t4_fw_bye(adapter, adapter->fn);
3542} 3557}
3543 3558
3544#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \ 3559#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \
@@ -3561,9 +3576,9 @@ static int __devinit init_one(struct pci_dev *pdev,
3561 return err; 3576 return err;
3562 } 3577 }
3563 3578
3564 /* We control everything through PF 0 */ 3579 /* We control everything through one PF */
3565 func = PCI_FUNC(pdev->devfn); 3580 func = PCI_FUNC(pdev->devfn);
3566 if (func > 0) { 3581 if (func != ent->driver_data) {
3567 pci_save_state(pdev); /* to restore SR-IOV later */ 3582 pci_save_state(pdev); /* to restore SR-IOV later */
3568 goto sriov; 3583 goto sriov;
3569 } 3584 }
@@ -3609,6 +3624,7 @@ static int __devinit init_one(struct pci_dev *pdev,
3609 3624
3610 adapter->pdev = pdev; 3625 adapter->pdev = pdev;
3611 adapter->pdev_dev = &pdev->dev; 3626 adapter->pdev_dev = &pdev->dev;
3627 adapter->fn = func;
3612 adapter->name = pci_name(pdev); 3628 adapter->name = pci_name(pdev);
3613 adapter->msg_enable = dflt_msg_enable; 3629 adapter->msg_enable = dflt_msg_enable;
3614 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); 3630 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
@@ -3660,7 +3676,7 @@ static int __devinit init_one(struct pci_dev *pdev,
3660 pci_set_drvdata(pdev, adapter); 3676 pci_set_drvdata(pdev, adapter);
3661 3677
3662 if (adapter->flags & FW_OK) { 3678 if (adapter->flags & FW_OK) {
3663 err = t4_port_init(adapter, 0, 0, 0); 3679 err = t4_port_init(adapter, func, func, 0);
3664 if (err) 3680 if (err)
3665 goto out_free_dev; 3681 goto out_free_dev;
3666 } 3682 }
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c
index 5cacfc7c53a6..bf38cfc57565 100644
--- a/drivers/net/cxgb4/sge.c
+++ b/drivers/net/cxgb4/sge.c
@@ -1999,7 +1999,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
1999 memset(&c, 0, sizeof(c)); 1999 memset(&c, 0, sizeof(c));
2000 c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST | 2000 c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST |
2001 FW_CMD_WRITE | FW_CMD_EXEC | 2001 FW_CMD_WRITE | FW_CMD_EXEC |
2002 FW_IQ_CMD_PFN(0) | FW_IQ_CMD_VFN(0)); 2002 FW_IQ_CMD_PFN(adap->fn) | FW_IQ_CMD_VFN(0));
2003 c.alloc_to_len16 = htonl(FW_IQ_CMD_ALLOC | FW_IQ_CMD_IQSTART(1) | 2003 c.alloc_to_len16 = htonl(FW_IQ_CMD_ALLOC | FW_IQ_CMD_IQSTART(1) |
2004 FW_LEN16(c)); 2004 FW_LEN16(c));
2005 c.type_to_iqandstindex = htonl(FW_IQ_CMD_TYPE(FW_IQ_TYPE_FL_INT_CAP) | 2005 c.type_to_iqandstindex = htonl(FW_IQ_CMD_TYPE(FW_IQ_TYPE_FL_INT_CAP) |
@@ -2031,7 +2031,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
2031 c.fl0addr = cpu_to_be64(fl->addr); 2031 c.fl0addr = cpu_to_be64(fl->addr);
2032 } 2032 }
2033 2033
2034 ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); 2034 ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c);
2035 if (ret) 2035 if (ret)
2036 goto err; 2036 goto err;
2037 2037
@@ -2110,7 +2110,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
2110 memset(&c, 0, sizeof(c)); 2110 memset(&c, 0, sizeof(c));
2111 c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_ETH_CMD) | FW_CMD_REQUEST | 2111 c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_ETH_CMD) | FW_CMD_REQUEST |
2112 FW_CMD_WRITE | FW_CMD_EXEC | 2112 FW_CMD_WRITE | FW_CMD_EXEC |
2113 FW_EQ_ETH_CMD_PFN(0) | FW_EQ_ETH_CMD_VFN(0)); 2113 FW_EQ_ETH_CMD_PFN(adap->fn) | FW_EQ_ETH_CMD_VFN(0));
2114 c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC | 2114 c.alloc_to_len16 = htonl(FW_EQ_ETH_CMD_ALLOC |
2115 FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); 2115 FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c));
2116 c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid)); 2116 c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid));
@@ -2123,7 +2123,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
2123 FW_EQ_ETH_CMD_EQSIZE(nentries)); 2123 FW_EQ_ETH_CMD_EQSIZE(nentries));
2124 c.eqaddr = cpu_to_be64(txq->q.phys_addr); 2124 c.eqaddr = cpu_to_be64(txq->q.phys_addr);
2125 2125
2126 ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); 2126 ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c);
2127 if (ret) { 2127 if (ret) {
2128 kfree(txq->q.sdesc); 2128 kfree(txq->q.sdesc);
2129 txq->q.sdesc = NULL; 2129 txq->q.sdesc = NULL;
@@ -2160,7 +2160,8 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
2160 2160
2161 c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_CTRL_CMD) | FW_CMD_REQUEST | 2161 c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_CTRL_CMD) | FW_CMD_REQUEST |
2162 FW_CMD_WRITE | FW_CMD_EXEC | 2162 FW_CMD_WRITE | FW_CMD_EXEC |
2163 FW_EQ_CTRL_CMD_PFN(0) | FW_EQ_CTRL_CMD_VFN(0)); 2163 FW_EQ_CTRL_CMD_PFN(adap->fn) |
2164 FW_EQ_CTRL_CMD_VFN(0));
2164 c.alloc_to_len16 = htonl(FW_EQ_CTRL_CMD_ALLOC | 2165 c.alloc_to_len16 = htonl(FW_EQ_CTRL_CMD_ALLOC |
2165 FW_EQ_CTRL_CMD_EQSTART | FW_LEN16(c)); 2166 FW_EQ_CTRL_CMD_EQSTART | FW_LEN16(c));
2166 c.cmpliqid_eqid = htonl(FW_EQ_CTRL_CMD_CMPLIQID(cmplqid)); 2167 c.cmpliqid_eqid = htonl(FW_EQ_CTRL_CMD_CMPLIQID(cmplqid));
@@ -2174,7 +2175,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
2174 FW_EQ_CTRL_CMD_EQSIZE(nentries)); 2175 FW_EQ_CTRL_CMD_EQSIZE(nentries));
2175 c.eqaddr = cpu_to_be64(txq->q.phys_addr); 2176 c.eqaddr = cpu_to_be64(txq->q.phys_addr);
2176 2177
2177 ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); 2178 ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c);
2178 if (ret) { 2179 if (ret) {
2179 dma_free_coherent(adap->pdev_dev, 2180 dma_free_coherent(adap->pdev_dev,
2180 nentries * sizeof(struct tx_desc), 2181 nentries * sizeof(struct tx_desc),
@@ -2210,7 +2211,8 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
2210 memset(&c, 0, sizeof(c)); 2211 memset(&c, 0, sizeof(c));
2211 c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_OFLD_CMD) | FW_CMD_REQUEST | 2212 c.op_to_vfn = htonl(FW_CMD_OP(FW_EQ_OFLD_CMD) | FW_CMD_REQUEST |
2212 FW_CMD_WRITE | FW_CMD_EXEC | 2213 FW_CMD_WRITE | FW_CMD_EXEC |
2213 FW_EQ_OFLD_CMD_PFN(0) | FW_EQ_OFLD_CMD_VFN(0)); 2214 FW_EQ_OFLD_CMD_PFN(adap->fn) |
2215 FW_EQ_OFLD_CMD_VFN(0));
2214 c.alloc_to_len16 = htonl(FW_EQ_OFLD_CMD_ALLOC | 2216 c.alloc_to_len16 = htonl(FW_EQ_OFLD_CMD_ALLOC |
2215 FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c)); 2217 FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c));
2216 c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) | 2218 c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) |
@@ -2222,7 +2224,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
2222 FW_EQ_OFLD_CMD_EQSIZE(nentries)); 2224 FW_EQ_OFLD_CMD_EQSIZE(nentries));
2223 c.eqaddr = cpu_to_be64(txq->q.phys_addr); 2225 c.eqaddr = cpu_to_be64(txq->q.phys_addr);
2224 2226
2225 ret = t4_wr_mbox(adap, 0, &c, sizeof(c), &c); 2227 ret = t4_wr_mbox(adap, adap->fn, &c, sizeof(c), &c);
2226 if (ret) { 2228 if (ret) {
2227 kfree(txq->q.sdesc); 2229 kfree(txq->q.sdesc);
2228 txq->q.sdesc = NULL; 2230 txq->q.sdesc = NULL;
@@ -2258,8 +2260,8 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq,
2258 unsigned int fl_id = fl ? fl->cntxt_id : 0xffff; 2260 unsigned int fl_id = fl ? fl->cntxt_id : 0xffff;
2259 2261
2260 adap->sge.ingr_map[rq->cntxt_id] = NULL; 2262 adap->sge.ingr_map[rq->cntxt_id] = NULL;
2261 t4_iq_free(adap, 0, 0, 0, FW_IQ_TYPE_FL_INT_CAP, rq->cntxt_id, fl_id, 2263 t4_iq_free(adap, adap->fn, adap->fn, 0, FW_IQ_TYPE_FL_INT_CAP,
2262 0xffff); 2264 rq->cntxt_id, fl_id, 0xffff);
2263 dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len, 2265 dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len,
2264 rq->desc, rq->phys_addr); 2266 rq->desc, rq->phys_addr);
2265 netif_napi_del(&rq->napi); 2267 netif_napi_del(&rq->napi);
@@ -2296,7 +2298,8 @@ void t4_free_sge_resources(struct adapter *adap)
2296 if (eq->rspq.desc) 2298 if (eq->rspq.desc)
2297 free_rspq_fl(adap, &eq->rspq, &eq->fl); 2299 free_rspq_fl(adap, &eq->rspq, &eq->fl);
2298 if (etq->q.desc) { 2300 if (etq->q.desc) {
2299 t4_eth_eq_free(adap, 0, 0, 0, etq->q.cntxt_id); 2301 t4_eth_eq_free(adap, adap->fn, adap->fn, 0,
2302 etq->q.cntxt_id);
2300 free_tx_desc(adap, &etq->q, etq->q.in_use, true); 2303 free_tx_desc(adap, &etq->q, etq->q.in_use, true);
2301 kfree(etq->q.sdesc); 2304 kfree(etq->q.sdesc);
2302 free_txq(adap, &etq->q); 2305 free_txq(adap, &etq->q);
@@ -2319,7 +2322,8 @@ void t4_free_sge_resources(struct adapter *adap)
2319 2322
2320 if (q->q.desc) { 2323 if (q->q.desc) {
2321 tasklet_kill(&q->qresume_tsk); 2324 tasklet_kill(&q->qresume_tsk);
2322 t4_ofld_eq_free(adap, 0, 0, 0, q->q.cntxt_id); 2325 t4_ofld_eq_free(adap, adap->fn, adap->fn, 0,
2326 q->q.cntxt_id);
2323 free_tx_desc(adap, &q->q, q->q.in_use, false); 2327 free_tx_desc(adap, &q->q, q->q.in_use, false);
2324 kfree(q->q.sdesc); 2328 kfree(q->q.sdesc);
2325 __skb_queue_purge(&q->sendq); 2329 __skb_queue_purge(&q->sendq);
@@ -2333,7 +2337,8 @@ void t4_free_sge_resources(struct adapter *adap)
2333 2337
2334 if (cq->q.desc) { 2338 if (cq->q.desc) {
2335 tasklet_kill(&cq->qresume_tsk); 2339 tasklet_kill(&cq->qresume_tsk);
2336 t4_ctrl_eq_free(adap, 0, 0, 0, cq->q.cntxt_id); 2340 t4_ctrl_eq_free(adap, adap->fn, adap->fn, 0,
2341 cq->q.cntxt_id);
2337 __skb_queue_purge(&cq->sendq); 2342 __skb_queue_purge(&cq->sendq);
2338 free_txq(adap, &cq->q); 2343 free_txq(adap, &cq->q);
2339 } 2344 }
@@ -2401,6 +2406,7 @@ void t4_sge_stop(struct adapter *adap)
2401 */ 2406 */
2402void t4_sge_init(struct adapter *adap) 2407void t4_sge_init(struct adapter *adap)
2403{ 2408{
2409 unsigned int i, v;
2404 struct sge *s = &adap->sge; 2410 struct sge *s = &adap->sge;
2405 unsigned int fl_align_log = ilog2(FL_ALIGN); 2411 unsigned int fl_align_log = ilog2(FL_ALIGN);
2406 2412
@@ -2409,8 +2415,10 @@ void t4_sge_init(struct adapter *adap)
2409 INGPADBOUNDARY(fl_align_log - 5) | PKTSHIFT(2) | 2415 INGPADBOUNDARY(fl_align_log - 5) | PKTSHIFT(2) |
2410 RXPKTCPLMODE | 2416 RXPKTCPLMODE |
2411 (STAT_LEN == 128 ? EGRSTATUSPAGESIZE : 0)); 2417 (STAT_LEN == 128 ? EGRSTATUSPAGESIZE : 0));
2412 t4_set_reg_field(adap, SGE_HOST_PAGE_SIZE, HOSTPAGESIZEPF0_MASK, 2418
2413 HOSTPAGESIZEPF0(PAGE_SHIFT - 10)); 2419 for (i = v = 0; i < 32; i += 4)
2420 v |= (PAGE_SHIFT - 10) << i;
2421 t4_write_reg(adap, SGE_HOST_PAGE_SIZE, v);
2414 t4_write_reg(adap, SGE_FL_BUFFER_SIZE0, PAGE_SIZE); 2422 t4_write_reg(adap, SGE_FL_BUFFER_SIZE0, PAGE_SIZE);
2415#if FL_PG_ORDER > 0 2423#if FL_PG_ORDER > 0
2416 t4_write_reg(adap, SGE_FL_BUFFER_SIZE1, PAGE_SIZE << FL_PG_ORDER); 2424 t4_write_reg(adap, SGE_FL_BUFFER_SIZE1, PAGE_SIZE << FL_PG_ORDER);