diff options
Diffstat (limited to 'drivers/net/cxgb4')
-rw-r--r-- | drivers/net/cxgb4/cxgb4.h | 28 | ||||
-rw-r--r-- | drivers/net/cxgb4/cxgb4_main.c | 409 | ||||
-rw-r--r-- | drivers/net/cxgb4/cxgb4_uld.h | 6 | ||||
-rw-r--r-- | drivers/net/cxgb4/l2t.c | 34 | ||||
-rw-r--r-- | drivers/net/cxgb4/l2t.h | 3 | ||||
-rw-r--r-- | drivers/net/cxgb4/sge.c | 69 | ||||
-rw-r--r-- | drivers/net/cxgb4/t4_hw.c | 429 | ||||
-rw-r--r-- | drivers/net/cxgb4/t4_hw.h | 1 | ||||
-rw-r--r-- | drivers/net/cxgb4/t4_msg.h | 1 | ||||
-rw-r--r-- | drivers/net/cxgb4/t4fw_api.h | 6 |
10 files changed, 274 insertions, 712 deletions
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h index 6e562c0dad7d..bc9982a4c1f4 100644 --- a/drivers/net/cxgb4/cxgb4.h +++ b/drivers/net/cxgb4/cxgb4.h | |||
@@ -281,7 +281,6 @@ struct sge_rspq; | |||
281 | 281 | ||
282 | struct port_info { | 282 | struct port_info { |
283 | struct adapter *adapter; | 283 | struct adapter *adapter; |
284 | struct vlan_group *vlan_grp; | ||
285 | u16 viid; | 284 | u16 viid; |
286 | s16 xact_addr_filt; /* index of exact MAC address filter */ | 285 | s16 xact_addr_filt; /* index of exact MAC address filter */ |
287 | u16 rss_size; /* size of VI's RSS table slice */ | 286 | u16 rss_size; /* size of VI's RSS table slice */ |
@@ -291,7 +290,6 @@ struct port_info { | |||
291 | u8 port_id; | 290 | u8 port_id; |
292 | u8 tx_chan; | 291 | u8 tx_chan; |
293 | u8 lport; /* associated offload logical port */ | 292 | u8 lport; /* associated offload logical port */ |
294 | u8 rx_offload; /* CSO, etc */ | ||
295 | u8 nqsets; /* # of qsets */ | 293 | u8 nqsets; /* # of qsets */ |
296 | u8 first_qset; /* index of first qset */ | 294 | u8 first_qset; /* index of first qset */ |
297 | u8 rss_mode; | 295 | u8 rss_mode; |
@@ -299,11 +297,6 @@ struct port_info { | |||
299 | u16 *rss; | 297 | u16 *rss; |
300 | }; | 298 | }; |
301 | 299 | ||
302 | /* port_info.rx_offload flags */ | ||
303 | enum { | ||
304 | RX_CSO = 1 << 0, | ||
305 | }; | ||
306 | |||
307 | struct dentry; | 300 | struct dentry; |
308 | struct work_struct; | 301 | struct work_struct; |
309 | 302 | ||
@@ -463,6 +456,8 @@ struct sge { | |||
463 | u8 counter_val[SGE_NCOUNTERS]; | 456 | u8 counter_val[SGE_NCOUNTERS]; |
464 | unsigned int starve_thres; | 457 | unsigned int starve_thres; |
465 | u8 idma_state[2]; | 458 | u8 idma_state[2]; |
459 | unsigned int egr_start; | ||
460 | unsigned int ingr_start; | ||
466 | void *egr_map[MAX_EGRQ]; /* qid->queue egress queue map */ | 461 | void *egr_map[MAX_EGRQ]; /* qid->queue egress queue map */ |
467 | struct sge_rspq *ingr_map[MAX_INGQ]; /* qid->queue ingress queue map */ | 462 | struct sge_rspq *ingr_map[MAX_INGQ]; /* qid->queue ingress queue map */ |
468 | DECLARE_BITMAP(starving_fl, MAX_EGRQ); | 463 | DECLARE_BITMAP(starving_fl, MAX_EGRQ); |
@@ -481,11 +476,9 @@ struct adapter { | |||
481 | void __iomem *regs; | 476 | void __iomem *regs; |
482 | struct pci_dev *pdev; | 477 | struct pci_dev *pdev; |
483 | struct device *pdev_dev; | 478 | struct device *pdev_dev; |
484 | unsigned long registered_device_map; | ||
485 | unsigned int fn; | 479 | unsigned int fn; |
486 | unsigned int flags; | 480 | unsigned int flags; |
487 | 481 | ||
488 | const char *name; | ||
489 | int msg_enable; | 482 | int msg_enable; |
490 | 483 | ||
491 | struct adapter_params params; | 484 | struct adapter_params params; |
@@ -496,7 +489,7 @@ struct adapter { | |||
496 | 489 | ||
497 | struct { | 490 | struct { |
498 | unsigned short vec; | 491 | unsigned short vec; |
499 | char desc[14]; | 492 | char desc[IFNAMSIZ + 10]; |
500 | } msix_info[MAX_INGQ + 1]; | 493 | } msix_info[MAX_INGQ + 1]; |
501 | 494 | ||
502 | struct sge sge; | 495 | struct sge sge; |
@@ -590,7 +583,6 @@ void t4_os_portmod_changed(const struct adapter *adap, int port_id); | |||
590 | void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); | 583 | void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); |
591 | 584 | ||
592 | void *t4_alloc_mem(size_t size); | 585 | void *t4_alloc_mem(size_t size); |
593 | void t4_free_mem(void *addr); | ||
594 | 586 | ||
595 | void t4_free_sge_resources(struct adapter *adap); | 587 | void t4_free_sge_resources(struct adapter *adap); |
596 | irq_handler_t t4_intr_handler(struct adapter *adap); | 588 | irq_handler_t t4_intr_handler(struct adapter *adap); |
@@ -649,7 +641,6 @@ static inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd, | |||
649 | 641 | ||
650 | void t4_intr_enable(struct adapter *adapter); | 642 | void t4_intr_enable(struct adapter *adapter); |
651 | void t4_intr_disable(struct adapter *adapter); | 643 | void t4_intr_disable(struct adapter *adapter); |
652 | void t4_intr_clear(struct adapter *adapter); | ||
653 | int t4_slow_intr_handler(struct adapter *adapter); | 644 | int t4_slow_intr_handler(struct adapter *adapter); |
654 | 645 | ||
655 | int t4_wait_dev_ready(struct adapter *adap); | 646 | int t4_wait_dev_ready(struct adapter *adap); |
@@ -662,24 +653,16 @@ int t4_check_fw_version(struct adapter *adapter); | |||
662 | int t4_prep_adapter(struct adapter *adapter); | 653 | int t4_prep_adapter(struct adapter *adapter); |
663 | int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); | 654 | int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); |
664 | void t4_fatal_err(struct adapter *adapter); | 655 | void t4_fatal_err(struct adapter *adapter); |
665 | int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, | ||
666 | int filter_index, int enable); | ||
667 | void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, | ||
668 | int filter_index, int *enabled); | ||
669 | int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, | 656 | int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, |
670 | int start, int n, const u16 *rspq, unsigned int nrspq); | 657 | int start, int n, const u16 *rspq, unsigned int nrspq); |
671 | int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, | 658 | int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, |
672 | unsigned int flags); | 659 | unsigned int flags); |
673 | int t4_read_rss(struct adapter *adapter, u16 *entries); | ||
674 | int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); | 660 | int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); |
675 | int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, | 661 | int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, |
676 | u64 *parity); | 662 | u64 *parity); |
677 | 663 | ||
678 | void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); | 664 | void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); |
679 | void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); | ||
680 | |||
681 | void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); | 665 | void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); |
682 | void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); | ||
683 | void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, | 666 | void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, |
684 | struct tp_tcp_stats *v6); | 667 | struct tp_tcp_stats *v6); |
685 | void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, | 668 | void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, |
@@ -709,8 +692,6 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, | |||
709 | int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, | 692 | int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, |
710 | unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, | 693 | unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, |
711 | unsigned int *rss_size); | 694 | unsigned int *rss_size); |
712 | int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, | ||
713 | unsigned int vf, unsigned int viid); | ||
714 | int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, | 695 | int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, |
715 | int mtu, int promisc, int all_multi, int bcast, int vlanex, | 696 | int mtu, int promisc, int all_multi, int bcast, int vlanex, |
716 | bool sleep_ok); | 697 | bool sleep_ok); |
@@ -729,9 +710,6 @@ int t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, | |||
729 | unsigned int mmd, unsigned int reg, u16 *valp); | 710 | unsigned int mmd, unsigned int reg, u16 *valp); |
730 | int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, | 711 | int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, |
731 | unsigned int mmd, unsigned int reg, u16 val); | 712 | unsigned int mmd, unsigned int reg, u16 val); |
732 | int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, | ||
733 | unsigned int pf, unsigned int vf, unsigned int iqid, | ||
734 | unsigned int fl0id, unsigned int fl1id); | ||
735 | int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, | 713 | int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, |
736 | unsigned int vf, unsigned int iqtype, unsigned int iqid, | 714 | unsigned int vf, unsigned int iqtype, unsigned int iqid, |
737 | unsigned int fl0id, unsigned int fl1id); | 715 | unsigned int fl0id, unsigned int fl1id); |
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index c327527fbbc8..7e3cfbe89e3b 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -175,16 +175,26 @@ enum { | |||
175 | 175 | ||
176 | static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = { | 176 | static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = { |
177 | CH_DEVICE(0xa000, 0), /* PE10K */ | 177 | CH_DEVICE(0xa000, 0), /* PE10K */ |
178 | CH_DEVICE(0x4001, 0), | 178 | CH_DEVICE(0x4001, -1), |
179 | CH_DEVICE(0x4002, 0), | 179 | CH_DEVICE(0x4002, -1), |
180 | CH_DEVICE(0x4003, 0), | 180 | CH_DEVICE(0x4003, -1), |
181 | CH_DEVICE(0x4004, 0), | 181 | CH_DEVICE(0x4004, -1), |
182 | CH_DEVICE(0x4005, 0), | 182 | CH_DEVICE(0x4005, -1), |
183 | CH_DEVICE(0x4006, 0), | 183 | CH_DEVICE(0x4006, -1), |
184 | CH_DEVICE(0x4007, 0), | 184 | CH_DEVICE(0x4007, -1), |
185 | CH_DEVICE(0x4008, 0), | 185 | CH_DEVICE(0x4008, -1), |
186 | CH_DEVICE(0x4009, 0), | 186 | CH_DEVICE(0x4009, -1), |
187 | CH_DEVICE(0x400a, 0), | 187 | CH_DEVICE(0x400a, -1), |
188 | CH_DEVICE(0x4401, 4), | ||
189 | CH_DEVICE(0x4402, 4), | ||
190 | CH_DEVICE(0x4403, 4), | ||
191 | CH_DEVICE(0x4404, 4), | ||
192 | CH_DEVICE(0x4405, 4), | ||
193 | CH_DEVICE(0x4406, 4), | ||
194 | CH_DEVICE(0x4407, 4), | ||
195 | CH_DEVICE(0x4408, 4), | ||
196 | CH_DEVICE(0x4409, 4), | ||
197 | CH_DEVICE(0x440a, 4), | ||
188 | { 0, } | 198 | { 0, } |
189 | }; | 199 | }; |
190 | 200 | ||
@@ -393,7 +403,7 @@ static int link_start(struct net_device *dev) | |||
393 | * that step explicitly. | 403 | * that step explicitly. |
394 | */ | 404 | */ |
395 | ret = t4_set_rxmode(pi->adapter, mb, pi->viid, dev->mtu, -1, -1, -1, | 405 | ret = t4_set_rxmode(pi->adapter, mb, pi->viid, dev->mtu, -1, -1, -1, |
396 | pi->vlan_grp != NULL, true); | 406 | !!(dev->features & NETIF_F_HW_VLAN_RX), true); |
397 | if (ret == 0) { | 407 | if (ret == 0) { |
398 | ret = t4_change_mac(pi->adapter, mb, pi->viid, | 408 | ret = t4_change_mac(pi->adapter, mb, pi->viid, |
399 | pi->xact_addr_filt, dev->dev_addr, true, | 409 | pi->xact_addr_filt, dev->dev_addr, true, |
@@ -423,10 +433,11 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp, | |||
423 | if (likely(opcode == CPL_SGE_EGR_UPDATE)) { | 433 | if (likely(opcode == CPL_SGE_EGR_UPDATE)) { |
424 | const struct cpl_sge_egr_update *p = (void *)rsp; | 434 | const struct cpl_sge_egr_update *p = (void *)rsp; |
425 | unsigned int qid = EGR_QID(ntohl(p->opcode_qid)); | 435 | unsigned int qid = EGR_QID(ntohl(p->opcode_qid)); |
426 | struct sge_txq *txq = q->adap->sge.egr_map[qid]; | 436 | struct sge_txq *txq; |
427 | 437 | ||
438 | txq = q->adap->sge.egr_map[qid - q->adap->sge.egr_start]; | ||
428 | txq->restarts++; | 439 | txq->restarts++; |
429 | if ((u8 *)txq < (u8 *)q->adap->sge.ethrxq) { | 440 | if ((u8 *)txq < (u8 *)q->adap->sge.ofldtxq) { |
430 | struct sge_eth_txq *eq; | 441 | struct sge_eth_txq *eq; |
431 | 442 | ||
432 | eq = container_of(txq, struct sge_eth_txq, q); | 443 | eq = container_of(txq, struct sge_eth_txq, q); |
@@ -511,39 +522,33 @@ static irqreturn_t t4_nondata_intr(int irq, void *cookie) | |||
511 | */ | 522 | */ |
512 | static void name_msix_vecs(struct adapter *adap) | 523 | static void name_msix_vecs(struct adapter *adap) |
513 | { | 524 | { |
514 | int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc) - 1; | 525 | int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc); |
515 | 526 | ||
516 | /* non-data interrupts */ | 527 | /* non-data interrupts */ |
517 | snprintf(adap->msix_info[0].desc, n, "%s", adap->name); | 528 | snprintf(adap->msix_info[0].desc, n, "%s", adap->port[0]->name); |
518 | adap->msix_info[0].desc[n] = 0; | ||
519 | 529 | ||
520 | /* FW events */ | 530 | /* FW events */ |
521 | snprintf(adap->msix_info[1].desc, n, "%s-FWeventq", adap->name); | 531 | snprintf(adap->msix_info[1].desc, n, "%s-FWeventq", |
522 | adap->msix_info[1].desc[n] = 0; | 532 | adap->port[0]->name); |
523 | 533 | ||
524 | /* Ethernet queues */ | 534 | /* Ethernet queues */ |
525 | for_each_port(adap, j) { | 535 | for_each_port(adap, j) { |
526 | struct net_device *d = adap->port[j]; | 536 | struct net_device *d = adap->port[j]; |
527 | const struct port_info *pi = netdev_priv(d); | 537 | const struct port_info *pi = netdev_priv(d); |
528 | 538 | ||
529 | for (i = 0; i < pi->nqsets; i++, msi_idx++) { | 539 | for (i = 0; i < pi->nqsets; i++, msi_idx++) |
530 | snprintf(adap->msix_info[msi_idx].desc, n, "%s-Rx%d", | 540 | snprintf(adap->msix_info[msi_idx].desc, n, "%s-Rx%d", |
531 | d->name, i); | 541 | d->name, i); |
532 | adap->msix_info[msi_idx].desc[n] = 0; | ||
533 | } | ||
534 | } | 542 | } |
535 | 543 | ||
536 | /* offload queues */ | 544 | /* offload queues */ |
537 | for_each_ofldrxq(&adap->sge, i) { | 545 | for_each_ofldrxq(&adap->sge, i) |
538 | snprintf(adap->msix_info[msi_idx].desc, n, "%s-ofld%d", | 546 | snprintf(adap->msix_info[msi_idx++].desc, n, "%s-ofld%d", |
539 | adap->name, i); | 547 | adap->port[0]->name, i); |
540 | adap->msix_info[msi_idx++].desc[n] = 0; | 548 | |
541 | } | 549 | for_each_rdmarxq(&adap->sge, i) |
542 | for_each_rdmarxq(&adap->sge, i) { | 550 | snprintf(adap->msix_info[msi_idx++].desc, n, "%s-rdma%d", |
543 | snprintf(adap->msix_info[msi_idx].desc, n, "%s-rdma%d", | 551 | adap->port[0]->name, i); |
544 | adap->name, i); | ||
545 | adap->msix_info[msi_idx++].desc[n] = 0; | ||
546 | } | ||
547 | } | 552 | } |
548 | 553 | ||
549 | static int request_msix_queue_irqs(struct adapter *adap) | 554 | static int request_msix_queue_irqs(struct adapter *adap) |
@@ -658,6 +663,15 @@ static int setup_rss(struct adapter *adap) | |||
658 | } | 663 | } |
659 | 664 | ||
660 | /* | 665 | /* |
666 | * Return the channel of the ingress queue with the given qid. | ||
667 | */ | ||
668 | static unsigned int rxq_to_chan(const struct sge *p, unsigned int qid) | ||
669 | { | ||
670 | qid -= p->ingr_start; | ||
671 | return netdev2pinfo(p->ingr_map[qid]->netdev)->tx_chan; | ||
672 | } | ||
673 | |||
674 | /* | ||
661 | * Wait until all NAPI handlers are descheduled. | 675 | * Wait until all NAPI handlers are descheduled. |
662 | */ | 676 | */ |
663 | static void quiesce_rx(struct adapter *adap) | 677 | static void quiesce_rx(struct adapter *adap) |
@@ -848,19 +862,17 @@ out: release_firmware(fw); | |||
848 | */ | 862 | */ |
849 | void *t4_alloc_mem(size_t size) | 863 | void *t4_alloc_mem(size_t size) |
850 | { | 864 | { |
851 | void *p = kmalloc(size, GFP_KERNEL); | 865 | void *p = kzalloc(size, GFP_KERNEL); |
852 | 866 | ||
853 | if (!p) | 867 | if (!p) |
854 | p = vmalloc(size); | 868 | p = vzalloc(size); |
855 | if (p) | ||
856 | memset(p, 0, size); | ||
857 | return p; | 869 | return p; |
858 | } | 870 | } |
859 | 871 | ||
860 | /* | 872 | /* |
861 | * Free memory allocated through alloc_mem(). | 873 | * Free memory allocated through alloc_mem(). |
862 | */ | 874 | */ |
863 | void t4_free_mem(void *addr) | 875 | static void t4_free_mem(void *addr) |
864 | { | 876 | { |
865 | if (is_vmalloc_addr(addr)) | 877 | if (is_vmalloc_addr(addr)) |
866 | vfree(addr); | 878 | vfree(addr); |
@@ -1324,15 +1336,20 @@ static int restart_autoneg(struct net_device *dev) | |||
1324 | return 0; | 1336 | return 0; |
1325 | } | 1337 | } |
1326 | 1338 | ||
1327 | static int identify_port(struct net_device *dev, u32 data) | 1339 | static int identify_port(struct net_device *dev, |
1340 | enum ethtool_phys_id_state state) | ||
1328 | { | 1341 | { |
1342 | unsigned int val; | ||
1329 | struct adapter *adap = netdev2adap(dev); | 1343 | struct adapter *adap = netdev2adap(dev); |
1330 | 1344 | ||
1331 | if (data == 0) | 1345 | if (state == ETHTOOL_ID_ACTIVE) |
1332 | data = 2; /* default to 2 seconds */ | 1346 | val = 0xffff; |
1347 | else if (state == ETHTOOL_ID_INACTIVE) | ||
1348 | val = 0; | ||
1349 | else | ||
1350 | return -EINVAL; | ||
1333 | 1351 | ||
1334 | return t4_identify_port(adap, adap->fn, netdev2pinfo(dev)->viid, | 1352 | return t4_identify_port(adap, adap->fn, netdev2pinfo(dev)->viid, val); |
1335 | data * 5); | ||
1336 | } | 1353 | } |
1337 | 1354 | ||
1338 | static unsigned int from_fw_linkcaps(unsigned int type, unsigned int caps) | 1355 | static unsigned int from_fw_linkcaps(unsigned int type, unsigned int caps) |
@@ -1357,7 +1374,12 @@ static unsigned int from_fw_linkcaps(unsigned int type, unsigned int caps) | |||
1357 | } else if (type == FW_PORT_TYPE_KR) | 1374 | } else if (type == FW_PORT_TYPE_KR) |
1358 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseKR_Full; | 1375 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseKR_Full; |
1359 | else if (type == FW_PORT_TYPE_BP_AP) | 1376 | else if (type == FW_PORT_TYPE_BP_AP) |
1360 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC; | 1377 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC | |
1378 | SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full; | ||
1379 | else if (type == FW_PORT_TYPE_BP4_AP) | ||
1380 | v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC | | ||
1381 | SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full | | ||
1382 | SUPPORTED_10000baseKX4_Full; | ||
1361 | else if (type == FW_PORT_TYPE_FIBER_XFI || | 1383 | else if (type == FW_PORT_TYPE_FIBER_XFI || |
1362 | type == FW_PORT_TYPE_FIBER_XAUI || type == FW_PORT_TYPE_SFP) | 1384 | type == FW_PORT_TYPE_FIBER_XAUI || type == FW_PORT_TYPE_SFP) |
1363 | v |= SUPPORTED_FIBRE; | 1385 | v |= SUPPORTED_FIBRE; |
@@ -1414,7 +1436,8 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1414 | cmd->supported = from_fw_linkcaps(p->port_type, p->link_cfg.supported); | 1436 | cmd->supported = from_fw_linkcaps(p->port_type, p->link_cfg.supported); |
1415 | cmd->advertising = from_fw_linkcaps(p->port_type, | 1437 | cmd->advertising = from_fw_linkcaps(p->port_type, |
1416 | p->link_cfg.advertising); | 1438 | p->link_cfg.advertising); |
1417 | cmd->speed = netif_carrier_ok(dev) ? p->link_cfg.speed : 0; | 1439 | ethtool_cmd_speed_set(cmd, |
1440 | netif_carrier_ok(dev) ? p->link_cfg.speed : 0); | ||
1418 | cmd->duplex = DUPLEX_FULL; | 1441 | cmd->duplex = DUPLEX_FULL; |
1419 | cmd->autoneg = p->link_cfg.autoneg; | 1442 | cmd->autoneg = p->link_cfg.autoneg; |
1420 | cmd->maxtxpkt = 0; | 1443 | cmd->maxtxpkt = 0; |
@@ -1438,6 +1461,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1438 | unsigned int cap; | 1461 | unsigned int cap; |
1439 | struct port_info *p = netdev_priv(dev); | 1462 | struct port_info *p = netdev_priv(dev); |
1440 | struct link_config *lc = &p->link_cfg; | 1463 | struct link_config *lc = &p->link_cfg; |
1464 | u32 speed = ethtool_cmd_speed(cmd); | ||
1441 | 1465 | ||
1442 | if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */ | 1466 | if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */ |
1443 | return -EINVAL; | 1467 | return -EINVAL; |
@@ -1448,16 +1472,16 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1448 | * being requested. | 1472 | * being requested. |
1449 | */ | 1473 | */ |
1450 | if (cmd->autoneg == AUTONEG_DISABLE && | 1474 | if (cmd->autoneg == AUTONEG_DISABLE && |
1451 | (lc->supported & speed_to_caps(cmd->speed))) | 1475 | (lc->supported & speed_to_caps(speed))) |
1452 | return 0; | 1476 | return 0; |
1453 | return -EINVAL; | 1477 | return -EINVAL; |
1454 | } | 1478 | } |
1455 | 1479 | ||
1456 | if (cmd->autoneg == AUTONEG_DISABLE) { | 1480 | if (cmd->autoneg == AUTONEG_DISABLE) { |
1457 | cap = speed_to_caps(cmd->speed); | 1481 | cap = speed_to_caps(speed); |
1458 | 1482 | ||
1459 | if (!(lc->supported & cap) || cmd->speed == SPEED_1000 || | 1483 | if (!(lc->supported & cap) || (speed == SPEED_1000) || |
1460 | cmd->speed == SPEED_10000) | 1484 | (speed == SPEED_10000)) |
1461 | return -EINVAL; | 1485 | return -EINVAL; |
1462 | lc->requested_speed = cap; | 1486 | lc->requested_speed = cap; |
1463 | lc->advertising = 0; | 1487 | lc->advertising = 0; |
@@ -1509,24 +1533,6 @@ static int set_pauseparam(struct net_device *dev, | |||
1509 | return 0; | 1533 | return 0; |
1510 | } | 1534 | } |
1511 | 1535 | ||
1512 | static u32 get_rx_csum(struct net_device *dev) | ||
1513 | { | ||
1514 | struct port_info *p = netdev_priv(dev); | ||
1515 | |||
1516 | return p->rx_offload & RX_CSO; | ||
1517 | } | ||
1518 | |||
1519 | static int set_rx_csum(struct net_device *dev, u32 data) | ||
1520 | { | ||
1521 | struct port_info *p = netdev_priv(dev); | ||
1522 | |||
1523 | if (data) | ||
1524 | p->rx_offload |= RX_CSO; | ||
1525 | else | ||
1526 | p->rx_offload &= ~RX_CSO; | ||
1527 | return 0; | ||
1528 | } | ||
1529 | |||
1530 | static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) | 1536 | static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) |
1531 | { | 1537 | { |
1532 | const struct port_info *pi = netdev_priv(dev); | 1538 | const struct port_info *pi = netdev_priv(dev); |
@@ -1671,27 +1677,41 @@ static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) | |||
1671 | return 0; | 1677 | return 0; |
1672 | } | 1678 | } |
1673 | 1679 | ||
1674 | /* | 1680 | /** |
1675 | * Translate a physical EEPROM address to virtual. The first 1K is accessed | 1681 | * eeprom_ptov - translate a physical EEPROM address to virtual |
1676 | * through virtual addresses starting at 31K, the rest is accessed through | 1682 | * @phys_addr: the physical EEPROM address |
1677 | * virtual addresses starting at 0. This mapping is correct only for PF0. | 1683 | * @fn: the PCI function number |
1684 | * @sz: size of function-specific area | ||
1685 | * | ||
1686 | * Translate a physical EEPROM address to virtual. The first 1K is | ||
1687 | * accessed through virtual addresses starting at 31K, the rest is | ||
1688 | * accessed through virtual addresses starting at 0. | ||
1689 | * | ||
1690 | * The mapping is as follows: | ||
1691 | * [0..1K) -> [31K..32K) | ||
1692 | * [1K..1K+A) -> [31K-A..31K) | ||
1693 | * [1K+A..ES) -> [0..ES-A-1K) | ||
1694 | * | ||
1695 | * where A = @fn * @sz, and ES = EEPROM size. | ||
1678 | */ | 1696 | */ |
1679 | static int eeprom_ptov(unsigned int phys_addr) | 1697 | static int eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz) |
1680 | { | 1698 | { |
1699 | fn *= sz; | ||
1681 | if (phys_addr < 1024) | 1700 | if (phys_addr < 1024) |
1682 | return phys_addr + (31 << 10); | 1701 | return phys_addr + (31 << 10); |
1702 | if (phys_addr < 1024 + fn) | ||
1703 | return 31744 - fn + phys_addr - 1024; | ||
1683 | if (phys_addr < EEPROMSIZE) | 1704 | if (phys_addr < EEPROMSIZE) |
1684 | return phys_addr - 1024; | 1705 | return phys_addr - 1024 - fn; |
1685 | return -EINVAL; | 1706 | return -EINVAL; |
1686 | } | 1707 | } |
1687 | 1708 | ||
1688 | /* | 1709 | /* |
1689 | * The next two routines implement eeprom read/write from physical addresses. | 1710 | * The next two routines implement eeprom read/write from physical addresses. |
1690 | * The physical->virtual translation is correct only for PF0. | ||
1691 | */ | 1711 | */ |
1692 | static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v) | 1712 | static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v) |
1693 | { | 1713 | { |
1694 | int vaddr = eeprom_ptov(phys_addr); | 1714 | int vaddr = eeprom_ptov(phys_addr, adap->fn, EEPROMPFSIZE); |
1695 | 1715 | ||
1696 | if (vaddr >= 0) | 1716 | if (vaddr >= 0) |
1697 | vaddr = pci_read_vpd(adap->pdev, vaddr, sizeof(u32), v); | 1717 | vaddr = pci_read_vpd(adap->pdev, vaddr, sizeof(u32), v); |
@@ -1700,7 +1720,7 @@ static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v) | |||
1700 | 1720 | ||
1701 | static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v) | 1721 | static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v) |
1702 | { | 1722 | { |
1703 | int vaddr = eeprom_ptov(phys_addr); | 1723 | int vaddr = eeprom_ptov(phys_addr, adap->fn, EEPROMPFSIZE); |
1704 | 1724 | ||
1705 | if (vaddr >= 0) | 1725 | if (vaddr >= 0) |
1706 | vaddr = pci_write_vpd(adap->pdev, vaddr, sizeof(u32), &v); | 1726 | vaddr = pci_write_vpd(adap->pdev, vaddr, sizeof(u32), &v); |
@@ -1743,6 +1763,14 @@ static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
1743 | aligned_offset = eeprom->offset & ~3; | 1763 | aligned_offset = eeprom->offset & ~3; |
1744 | aligned_len = (eeprom->len + (eeprom->offset & 3) + 3) & ~3; | 1764 | aligned_len = (eeprom->len + (eeprom->offset & 3) + 3) & ~3; |
1745 | 1765 | ||
1766 | if (adapter->fn > 0) { | ||
1767 | u32 start = 1024 + adapter->fn * EEPROMPFSIZE; | ||
1768 | |||
1769 | if (aligned_offset < start || | ||
1770 | aligned_offset + aligned_len > start + EEPROMPFSIZE) | ||
1771 | return -EPERM; | ||
1772 | } | ||
1773 | |||
1746 | if (aligned_offset != eeprom->offset || aligned_len != eeprom->len) { | 1774 | if (aligned_offset != eeprom->offset || aligned_len != eeprom->len) { |
1747 | /* | 1775 | /* |
1748 | * RMW possibly needed for first or last words. | 1776 | * RMW possibly needed for first or last words. |
@@ -1826,20 +1854,21 @@ static int set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
1826 | return err; | 1854 | return err; |
1827 | } | 1855 | } |
1828 | 1856 | ||
1829 | #define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) | 1857 | static int cxgb_set_features(struct net_device *dev, u32 features) |
1830 | |||
1831 | static int set_tso(struct net_device *dev, u32 value) | ||
1832 | { | 1858 | { |
1833 | if (value) | 1859 | const struct port_info *pi = netdev_priv(dev); |
1834 | dev->features |= TSO_FLAGS; | 1860 | u32 changed = dev->features ^ features; |
1835 | else | 1861 | int err; |
1836 | dev->features &= ~TSO_FLAGS; | ||
1837 | return 0; | ||
1838 | } | ||
1839 | 1862 | ||
1840 | static int set_flags(struct net_device *dev, u32 flags) | 1863 | if (!(changed & NETIF_F_HW_VLAN_RX)) |
1841 | { | 1864 | return 0; |
1842 | return ethtool_op_set_flags(dev, flags, ETH_FLAG_RXHASH); | 1865 | |
1866 | err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, | ||
1867 | -1, -1, -1, | ||
1868 | !!(features & NETIF_F_HW_VLAN_RX), true); | ||
1869 | if (unlikely(err)) | ||
1870 | dev->features = features ^ NETIF_F_HW_VLAN_RX; | ||
1871 | return err; | ||
1843 | } | 1872 | } |
1844 | 1873 | ||
1845 | static int get_rss_table(struct net_device *dev, struct ethtool_rxfh_indir *p) | 1874 | static int get_rss_table(struct net_device *dev, struct ethtool_rxfh_indir *p) |
@@ -1949,13 +1978,9 @@ static struct ethtool_ops cxgb_ethtool_ops = { | |||
1949 | .set_eeprom = set_eeprom, | 1978 | .set_eeprom = set_eeprom, |
1950 | .get_pauseparam = get_pauseparam, | 1979 | .get_pauseparam = get_pauseparam, |
1951 | .set_pauseparam = set_pauseparam, | 1980 | .set_pauseparam = set_pauseparam, |
1952 | .get_rx_csum = get_rx_csum, | ||
1953 | .set_rx_csum = set_rx_csum, | ||
1954 | .set_tx_csum = ethtool_op_set_tx_ipv6_csum, | ||
1955 | .set_sg = ethtool_op_set_sg, | ||
1956 | .get_link = ethtool_op_get_link, | 1981 | .get_link = ethtool_op_get_link, |
1957 | .get_strings = get_strings, | 1982 | .get_strings = get_strings, |
1958 | .phys_id = identify_port, | 1983 | .set_phys_id = identify_port, |
1959 | .nway_reset = restart_autoneg, | 1984 | .nway_reset = restart_autoneg, |
1960 | .get_sset_count = get_sset_count, | 1985 | .get_sset_count = get_sset_count, |
1961 | .get_ethtool_stats = get_stats, | 1986 | .get_ethtool_stats = get_stats, |
@@ -1963,8 +1988,6 @@ static struct ethtool_ops cxgb_ethtool_ops = { | |||
1963 | .get_regs = get_regs, | 1988 | .get_regs = get_regs, |
1964 | .get_wol = get_wol, | 1989 | .get_wol = get_wol, |
1965 | .set_wol = set_wol, | 1990 | .set_wol = set_wol, |
1966 | .set_tso = set_tso, | ||
1967 | .set_flags = set_flags, | ||
1968 | .get_rxnfc = get_rxnfc, | 1991 | .get_rxnfc = get_rxnfc, |
1969 | .get_rxfh_indir = get_rss_table, | 1992 | .get_rxfh_indir = get_rss_table, |
1970 | .set_rxfh_indir = set_rss_table, | 1993 | .set_rxfh_indir = set_rss_table, |
@@ -2026,6 +2049,7 @@ static const struct file_operations mem_debugfs_fops = { | |||
2026 | .owner = THIS_MODULE, | 2049 | .owner = THIS_MODULE, |
2027 | .open = mem_open, | 2050 | .open = mem_open, |
2028 | .read = mem_read, | 2051 | .read = mem_read, |
2052 | .llseek = default_llseek, | ||
2029 | }; | 2053 | }; |
2030 | 2054 | ||
2031 | static void __devinit add_debugfs_mem(struct adapter *adap, const char *name, | 2055 | static void __devinit add_debugfs_mem(struct adapter *adap, const char *name, |
@@ -2164,8 +2188,8 @@ static void mk_tid_release(struct sk_buff *skb, unsigned int chan, | |||
2164 | * Queue a TID release request and if necessary schedule a work queue to | 2188 | * Queue a TID release request and if necessary schedule a work queue to |
2165 | * process it. | 2189 | * process it. |
2166 | */ | 2190 | */ |
2167 | void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, | 2191 | static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, |
2168 | unsigned int tid) | 2192 | unsigned int tid) |
2169 | { | 2193 | { |
2170 | void **p = &t->tid_tab[tid]; | 2194 | void **p = &t->tid_tab[tid]; |
2171 | struct adapter *adap = container_of(t, struct adapter, tids); | 2195 | struct adapter *adap = container_of(t, struct adapter, tids); |
@@ -2180,7 +2204,6 @@ void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, | |||
2180 | } | 2204 | } |
2181 | spin_unlock_bh(&adap->tid_release_lock); | 2205 | spin_unlock_bh(&adap->tid_release_lock); |
2182 | } | 2206 | } |
2183 | EXPORT_SYMBOL(cxgb4_queue_tid_release); | ||
2184 | 2207 | ||
2185 | /* | 2208 | /* |
2186 | * Process the list of pending TID release requests. | 2209 | * Process the list of pending TID release requests. |
@@ -2304,7 +2327,7 @@ int cxgb4_create_server(const struct net_device *dev, unsigned int stid, | |||
2304 | req->peer_port = htons(0); | 2327 | req->peer_port = htons(0); |
2305 | req->local_ip = sip; | 2328 | req->local_ip = sip; |
2306 | req->peer_ip = htonl(0); | 2329 | req->peer_ip = htonl(0); |
2307 | chan = netdev2pinfo(adap->sge.ingr_map[queue]->netdev)->tx_chan; | 2330 | chan = rxq_to_chan(&adap->sge, queue); |
2308 | req->opt0 = cpu_to_be64(TX_CHAN(chan)); | 2331 | req->opt0 = cpu_to_be64(TX_CHAN(chan)); |
2309 | req->opt1 = cpu_to_be64(CONN_POLICY_ASK | | 2332 | req->opt1 = cpu_to_be64(CONN_POLICY_ASK | |
2310 | SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); | 2333 | SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); |
@@ -2313,48 +2336,6 @@ int cxgb4_create_server(const struct net_device *dev, unsigned int stid, | |||
2313 | EXPORT_SYMBOL(cxgb4_create_server); | 2336 | EXPORT_SYMBOL(cxgb4_create_server); |
2314 | 2337 | ||
2315 | /** | 2338 | /** |
2316 | * cxgb4_create_server6 - create an IPv6 server | ||
2317 | * @dev: the device | ||
2318 | * @stid: the server TID | ||
2319 | * @sip: local IPv6 address to bind server to | ||
2320 | * @sport: the server's TCP port | ||
2321 | * @queue: queue to direct messages from this server to | ||
2322 | * | ||
2323 | * Create an IPv6 server for the given port and address. | ||
2324 | * Returns <0 on error and one of the %NET_XMIT_* values on success. | ||
2325 | */ | ||
2326 | int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, | ||
2327 | const struct in6_addr *sip, __be16 sport, | ||
2328 | unsigned int queue) | ||
2329 | { | ||
2330 | unsigned int chan; | ||
2331 | struct sk_buff *skb; | ||
2332 | struct adapter *adap; | ||
2333 | struct cpl_pass_open_req6 *req; | ||
2334 | |||
2335 | skb = alloc_skb(sizeof(*req), GFP_KERNEL); | ||
2336 | if (!skb) | ||
2337 | return -ENOMEM; | ||
2338 | |||
2339 | adap = netdev2adap(dev); | ||
2340 | req = (struct cpl_pass_open_req6 *)__skb_put(skb, sizeof(*req)); | ||
2341 | INIT_TP_WR(req, 0); | ||
2342 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, stid)); | ||
2343 | req->local_port = sport; | ||
2344 | req->peer_port = htons(0); | ||
2345 | req->local_ip_hi = *(__be64 *)(sip->s6_addr); | ||
2346 | req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8); | ||
2347 | req->peer_ip_hi = cpu_to_be64(0); | ||
2348 | req->peer_ip_lo = cpu_to_be64(0); | ||
2349 | chan = netdev2pinfo(adap->sge.ingr_map[queue]->netdev)->tx_chan; | ||
2350 | req->opt0 = cpu_to_be64(TX_CHAN(chan)); | ||
2351 | req->opt1 = cpu_to_be64(CONN_POLICY_ASK | | ||
2352 | SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); | ||
2353 | return t4_mgmt_tx(adap, skb); | ||
2354 | } | ||
2355 | EXPORT_SYMBOL(cxgb4_create_server6); | ||
2356 | |||
2357 | /** | ||
2358 | * cxgb4_best_mtu - find the entry in the MTU table closest to an MTU | 2339 | * cxgb4_best_mtu - find the entry in the MTU table closest to an MTU |
2359 | * @mtus: the HW MTU table | 2340 | * @mtus: the HW MTU table |
2360 | * @mtu: the target MTU | 2341 | * @mtu: the target MTU |
@@ -2413,25 +2394,6 @@ unsigned int cxgb4_port_idx(const struct net_device *dev) | |||
2413 | } | 2394 | } |
2414 | EXPORT_SYMBOL(cxgb4_port_idx); | 2395 | EXPORT_SYMBOL(cxgb4_port_idx); |
2415 | 2396 | ||
2416 | /** | ||
2417 | * cxgb4_netdev_by_hwid - return the net device of a HW port | ||
2418 | * @pdev: identifies the adapter | ||
2419 | * @id: the HW port id | ||
2420 | * | ||
2421 | * Return the net device associated with the interface with the given HW | ||
2422 | * id. | ||
2423 | */ | ||
2424 | struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id) | ||
2425 | { | ||
2426 | const struct adapter *adap = pci_get_drvdata(pdev); | ||
2427 | |||
2428 | if (!adap || id >= NCHAN) | ||
2429 | return NULL; | ||
2430 | id = adap->chan_map[id]; | ||
2431 | return id < MAX_NPORTS ? adap->port[id] : NULL; | ||
2432 | } | ||
2433 | EXPORT_SYMBOL(cxgb4_netdev_by_hwid); | ||
2434 | |||
2435 | void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, | 2397 | void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, |
2436 | struct tp_tcp_stats *v6) | 2398 | struct tp_tcp_stats *v6) |
2437 | { | 2399 | { |
@@ -2476,7 +2438,6 @@ static int netevent_cb(struct notifier_block *nb, unsigned long event, | |||
2476 | case NETEVENT_NEIGH_UPDATE: | 2438 | case NETEVENT_NEIGH_UPDATE: |
2477 | check_neigh_update(data); | 2439 | check_neigh_update(data); |
2478 | break; | 2440 | break; |
2479 | case NETEVENT_PMTU_UPDATE: | ||
2480 | case NETEVENT_REDIRECT: | 2441 | case NETEVENT_REDIRECT: |
2481 | default: | 2442 | default: |
2482 | break; | 2443 | break; |
@@ -2670,7 +2631,7 @@ static int cxgb_up(struct adapter *adap) | |||
2670 | } else { | 2631 | } else { |
2671 | err = request_irq(adap->pdev->irq, t4_intr_handler(adap), | 2632 | err = request_irq(adap->pdev->irq, t4_intr_handler(adap), |
2672 | (adap->flags & USING_MSI) ? 0 : IRQF_SHARED, | 2633 | (adap->flags & USING_MSI) ? 0 : IRQF_SHARED, |
2673 | adap->name, adap); | 2634 | adap->port[0]->name, adap); |
2674 | if (err) | 2635 | if (err) |
2675 | goto irq_err; | 2636 | goto irq_err; |
2676 | } | 2637 | } |
@@ -2715,13 +2676,14 @@ static int cxgb_open(struct net_device *dev) | |||
2715 | struct port_info *pi = netdev_priv(dev); | 2676 | struct port_info *pi = netdev_priv(dev); |
2716 | struct adapter *adapter = pi->adapter; | 2677 | struct adapter *adapter = pi->adapter; |
2717 | 2678 | ||
2679 | netif_carrier_off(dev); | ||
2680 | |||
2718 | if (!(adapter->flags & FULL_INIT_DONE)) { | 2681 | if (!(adapter->flags & FULL_INIT_DONE)) { |
2719 | err = cxgb_up(adapter); | 2682 | err = cxgb_up(adapter); |
2720 | if (err < 0) | 2683 | if (err < 0) |
2721 | return err; | 2684 | return err; |
2722 | } | 2685 | } |
2723 | 2686 | ||
2724 | dev->real_num_tx_queues = pi->nqsets; | ||
2725 | err = link_start(dev); | 2687 | err = link_start(dev); |
2726 | if (!err) | 2688 | if (!err) |
2727 | netif_tx_start_all_queues(dev); | 2689 | netif_tx_start_all_queues(dev); |
@@ -2858,15 +2820,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) | |||
2858 | return 0; | 2820 | return 0; |
2859 | } | 2821 | } |
2860 | 2822 | ||
2861 | static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | ||
2862 | { | ||
2863 | struct port_info *pi = netdev_priv(dev); | ||
2864 | |||
2865 | pi->vlan_grp = grp; | ||
2866 | t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, -1, -1, -1, | ||
2867 | grp != NULL, true); | ||
2868 | } | ||
2869 | |||
2870 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2823 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2871 | static void cxgb_netpoll(struct net_device *dev) | 2824 | static void cxgb_netpoll(struct net_device *dev) |
2872 | { | 2825 | { |
@@ -2891,10 +2844,10 @@ static const struct net_device_ops cxgb4_netdev_ops = { | |||
2891 | .ndo_get_stats64 = cxgb_get_stats, | 2844 | .ndo_get_stats64 = cxgb_get_stats, |
2892 | .ndo_set_rx_mode = cxgb_set_rxmode, | 2845 | .ndo_set_rx_mode = cxgb_set_rxmode, |
2893 | .ndo_set_mac_address = cxgb_set_mac_addr, | 2846 | .ndo_set_mac_address = cxgb_set_mac_addr, |
2847 | .ndo_set_features = cxgb_set_features, | ||
2894 | .ndo_validate_addr = eth_validate_addr, | 2848 | .ndo_validate_addr = eth_validate_addr, |
2895 | .ndo_do_ioctl = cxgb_ioctl, | 2849 | .ndo_do_ioctl = cxgb_ioctl, |
2896 | .ndo_change_mtu = cxgb_change_mtu, | 2850 | .ndo_change_mtu = cxgb_change_mtu, |
2897 | .ndo_vlan_rx_register = vlan_rx_register, | ||
2898 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2851 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2899 | .ndo_poll_controller = cxgb_netpoll, | 2852 | .ndo_poll_controller = cxgb_netpoll, |
2900 | #endif | 2853 | #endif |
@@ -3061,12 +3014,16 @@ static int adap_init0(struct adapter *adap) | |||
3061 | params[2] = FW_PARAM_PFVF(L2T_END); | 3014 | params[2] = FW_PARAM_PFVF(L2T_END); |
3062 | params[3] = FW_PARAM_PFVF(FILTER_START); | 3015 | params[3] = FW_PARAM_PFVF(FILTER_START); |
3063 | params[4] = FW_PARAM_PFVF(FILTER_END); | 3016 | params[4] = FW_PARAM_PFVF(FILTER_END); |
3064 | ret = t4_query_params(adap, adap->fn, adap->fn, 0, 5, params, val); | 3017 | params[5] = FW_PARAM_PFVF(IQFLINT_START); |
3018 | params[6] = FW_PARAM_PFVF(EQ_START); | ||
3019 | ret = t4_query_params(adap, adap->fn, adap->fn, 0, 7, params, val); | ||
3065 | if (ret < 0) | 3020 | if (ret < 0) |
3066 | goto bye; | 3021 | goto bye; |
3067 | port_vec = val[0]; | 3022 | port_vec = val[0]; |
3068 | adap->tids.ftid_base = val[3]; | 3023 | adap->tids.ftid_base = val[3]; |
3069 | adap->tids.nftids = val[4] - val[3] + 1; | 3024 | adap->tids.nftids = val[4] - val[3] + 1; |
3025 | adap->sge.ingr_start = val[5]; | ||
3026 | adap->sge.egr_start = val[6]; | ||
3070 | 3027 | ||
3071 | if (c.ofldcaps) { | 3028 | if (c.ofldcaps) { |
3072 | /* query offload-related parameters */ | 3029 | /* query offload-related parameters */ |
@@ -3496,49 +3453,53 @@ static int __devinit init_rss(struct adapter *adap) | |||
3496 | return 0; | 3453 | return 0; |
3497 | } | 3454 | } |
3498 | 3455 | ||
3499 | static void __devinit print_port_info(struct adapter *adap) | 3456 | static void __devinit print_port_info(const struct net_device *dev) |
3500 | { | 3457 | { |
3501 | static const char *base[] = { | 3458 | static const char *base[] = { |
3502 | "R XFI", "R XAUI", "T SGMII", "T XFI", "T XAUI", "KX4", "CX4", | 3459 | "R XFI", "R XAUI", "T SGMII", "T XFI", "T XAUI", "KX4", "CX4", |
3503 | "KX", "KR", "KR SFP+", "KR FEC" | 3460 | "KX", "KR", "R SFP+", "KR/KX", "KR/KX/KX4" |
3504 | }; | 3461 | }; |
3505 | 3462 | ||
3506 | int i; | ||
3507 | char buf[80]; | 3463 | char buf[80]; |
3464 | char *bufp = buf; | ||
3508 | const char *spd = ""; | 3465 | const char *spd = ""; |
3466 | const struct port_info *pi = netdev_priv(dev); | ||
3467 | const struct adapter *adap = pi->adapter; | ||
3509 | 3468 | ||
3510 | if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB) | 3469 | if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB) |
3511 | spd = " 2.5 GT/s"; | 3470 | spd = " 2.5 GT/s"; |
3512 | else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB) | 3471 | else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB) |
3513 | spd = " 5 GT/s"; | 3472 | spd = " 5 GT/s"; |
3514 | 3473 | ||
3515 | for_each_port(adap, i) { | 3474 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100M) |
3516 | struct net_device *dev = adap->port[i]; | 3475 | bufp += sprintf(bufp, "100/"); |
3517 | const struct port_info *pi = netdev_priv(dev); | 3476 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G) |
3518 | char *bufp = buf; | 3477 | bufp += sprintf(bufp, "1000/"); |
3478 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) | ||
3479 | bufp += sprintf(bufp, "10G/"); | ||
3480 | if (bufp != buf) | ||
3481 | --bufp; | ||
3482 | sprintf(bufp, "BASE-%s", base[pi->port_type]); | ||
3519 | 3483 | ||
3520 | if (!test_bit(i, &adap->registered_device_map)) | 3484 | netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n", |
3521 | continue; | 3485 | adap->params.vpd.id, adap->params.rev, buf, |
3486 | is_offload(adap) ? "R" : "", adap->params.pci.width, spd, | ||
3487 | (adap->flags & USING_MSIX) ? " MSI-X" : | ||
3488 | (adap->flags & USING_MSI) ? " MSI" : ""); | ||
3489 | netdev_info(dev, "S/N: %s, E/C: %s\n", | ||
3490 | adap->params.vpd.sn, adap->params.vpd.ec); | ||
3491 | } | ||
3522 | 3492 | ||
3523 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100M) | 3493 | static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev) |
3524 | bufp += sprintf(bufp, "100/"); | 3494 | { |
3525 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G) | 3495 | u16 v; |
3526 | bufp += sprintf(bufp, "1000/"); | 3496 | int pos; |
3527 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) | ||
3528 | bufp += sprintf(bufp, "10G/"); | ||
3529 | if (bufp != buf) | ||
3530 | --bufp; | ||
3531 | sprintf(bufp, "BASE-%s", base[pi->port_type]); | ||
3532 | 3497 | ||
3533 | netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n", | 3498 | pos = pci_pcie_cap(dev); |
3534 | adap->params.vpd.id, adap->params.rev, | 3499 | if (pos > 0) { |
3535 | buf, is_offload(adap) ? "R" : "", | 3500 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &v); |
3536 | adap->params.pci.width, spd, | 3501 | v |= PCI_EXP_DEVCTL_RELAX_EN; |
3537 | (adap->flags & USING_MSIX) ? " MSI-X" : | 3502 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, v); |
3538 | (adap->flags & USING_MSI) ? " MSI" : ""); | ||
3539 | if (adap->name == dev->name) | ||
3540 | netdev_info(dev, "S/N: %s, E/C: %s\n", | ||
3541 | adap->params.vpd.sn, adap->params.vpd.ec); | ||
3542 | } | 3503 | } |
3543 | } | 3504 | } |
3544 | 3505 | ||
@@ -3566,6 +3527,7 @@ static void free_some_resources(struct adapter *adapter) | |||
3566 | t4_fw_bye(adapter, adapter->fn); | 3527 | t4_fw_bye(adapter, adapter->fn); |
3567 | } | 3528 | } |
3568 | 3529 | ||
3530 | #define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) | ||
3569 | #define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \ | 3531 | #define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \ |
3570 | NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA) | 3532 | NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA) |
3571 | 3533 | ||
@@ -3616,6 +3578,7 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3616 | } | 3578 | } |
3617 | 3579 | ||
3618 | pci_enable_pcie_error_reporting(pdev); | 3580 | pci_enable_pcie_error_reporting(pdev); |
3581 | enable_pcie_relaxed_ordering(pdev); | ||
3619 | pci_set_master(pdev); | 3582 | pci_set_master(pdev); |
3620 | pci_save_state(pdev); | 3583 | pci_save_state(pdev); |
3621 | 3584 | ||
@@ -3635,7 +3598,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3635 | adapter->pdev = pdev; | 3598 | adapter->pdev = pdev; |
3636 | adapter->pdev_dev = &pdev->dev; | 3599 | adapter->pdev_dev = &pdev->dev; |
3637 | adapter->fn = func; | 3600 | adapter->fn = func; |
3638 | adapter->name = pci_name(pdev); | ||
3639 | adapter->msg_enable = dflt_msg_enable; | 3601 | adapter->msg_enable = dflt_msg_enable; |
3640 | memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); | 3602 | memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); |
3641 | 3603 | ||
@@ -3667,16 +3629,14 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3667 | pi = netdev_priv(netdev); | 3629 | pi = netdev_priv(netdev); |
3668 | pi->adapter = adapter; | 3630 | pi->adapter = adapter; |
3669 | pi->xact_addr_filt = -1; | 3631 | pi->xact_addr_filt = -1; |
3670 | pi->rx_offload = RX_CSO; | ||
3671 | pi->port_id = i; | 3632 | pi->port_id = i; |
3672 | netif_carrier_off(netdev); | ||
3673 | netif_tx_stop_all_queues(netdev); | ||
3674 | netdev->irq = pdev->irq; | 3633 | netdev->irq = pdev->irq; |
3675 | 3634 | ||
3676 | netdev->features |= NETIF_F_SG | TSO_FLAGS; | 3635 | netdev->hw_features = NETIF_F_SG | TSO_FLAGS | |
3677 | netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 3636 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
3678 | netdev->features |= NETIF_F_GRO | NETIF_F_RXHASH | highdma; | 3637 | NETIF_F_RXCSUM | NETIF_F_RXHASH | |
3679 | netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 3638 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
3639 | netdev->features |= netdev->hw_features | highdma; | ||
3680 | netdev->vlan_features = netdev->features & VLAN_FEAT; | 3640 | netdev->vlan_features = netdev->features & VLAN_FEAT; |
3681 | 3641 | ||
3682 | netdev->netdev_ops = &cxgb4_netdev_ops; | 3642 | netdev->netdev_ops = &cxgb4_netdev_ops; |
@@ -3727,27 +3687,24 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3727 | * register at least one net device. | 3687 | * register at least one net device. |
3728 | */ | 3688 | */ |
3729 | for_each_port(adapter, i) { | 3689 | for_each_port(adapter, i) { |
3690 | pi = adap2pinfo(adapter, i); | ||
3691 | netif_set_real_num_tx_queues(adapter->port[i], pi->nqsets); | ||
3692 | netif_set_real_num_rx_queues(adapter->port[i], pi->nqsets); | ||
3693 | |||
3730 | err = register_netdev(adapter->port[i]); | 3694 | err = register_netdev(adapter->port[i]); |
3731 | if (err) | 3695 | if (err) |
3732 | dev_warn(&pdev->dev, | 3696 | break; |
3733 | "cannot register net device %s, skipping\n", | 3697 | adapter->chan_map[pi->tx_chan] = i; |
3734 | adapter->port[i]->name); | 3698 | print_port_info(adapter->port[i]); |
3735 | else { | ||
3736 | /* | ||
3737 | * Change the name we use for messages to the name of | ||
3738 | * the first successfully registered interface. | ||
3739 | */ | ||
3740 | if (!adapter->registered_device_map) | ||
3741 | adapter->name = adapter->port[i]->name; | ||
3742 | |||
3743 | __set_bit(i, &adapter->registered_device_map); | ||
3744 | adapter->chan_map[adap2pinfo(adapter, i)->tx_chan] = i; | ||
3745 | } | ||
3746 | } | 3699 | } |
3747 | if (!adapter->registered_device_map) { | 3700 | if (i == 0) { |
3748 | dev_err(&pdev->dev, "could not register any net devices\n"); | 3701 | dev_err(&pdev->dev, "could not register any net devices\n"); |
3749 | goto out_free_dev; | 3702 | goto out_free_dev; |
3750 | } | 3703 | } |
3704 | if (err) { | ||
3705 | dev_warn(&pdev->dev, "only %d net devices registered\n", i); | ||
3706 | err = 0; | ||
3707 | }; | ||
3751 | 3708 | ||
3752 | if (cxgb4_debugfs_root) { | 3709 | if (cxgb4_debugfs_root) { |
3753 | adapter->debugfs_root = debugfs_create_dir(pci_name(pdev), | 3710 | adapter->debugfs_root = debugfs_create_dir(pci_name(pdev), |
@@ -3758,8 +3715,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3758 | if (is_offload(adapter)) | 3715 | if (is_offload(adapter)) |
3759 | attach_ulds(adapter); | 3716 | attach_ulds(adapter); |
3760 | 3717 | ||
3761 | print_port_info(adapter); | ||
3762 | |||
3763 | sriov: | 3718 | sriov: |
3764 | #ifdef CONFIG_PCI_IOV | 3719 | #ifdef CONFIG_PCI_IOV |
3765 | if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0) | 3720 | if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0) |
@@ -3798,7 +3753,7 @@ static void __devexit remove_one(struct pci_dev *pdev) | |||
3798 | detach_ulds(adapter); | 3753 | detach_ulds(adapter); |
3799 | 3754 | ||
3800 | for_each_port(adapter, i) | 3755 | for_each_port(adapter, i) |
3801 | if (test_bit(i, &adapter->registered_device_map)) | 3756 | if (adapter->port[i]->reg_state == NETREG_REGISTERED) |
3802 | unregister_netdev(adapter->port[i]); | 3757 | unregister_netdev(adapter->port[i]); |
3803 | 3758 | ||
3804 | if (adapter->debugfs_root) | 3759 | if (adapter->debugfs_root) |
@@ -3814,7 +3769,7 @@ static void __devexit remove_one(struct pci_dev *pdev) | |||
3814 | pci_disable_device(pdev); | 3769 | pci_disable_device(pdev); |
3815 | pci_release_regions(pdev); | 3770 | pci_release_regions(pdev); |
3816 | pci_set_drvdata(pdev, NULL); | 3771 | pci_set_drvdata(pdev, NULL); |
3817 | } else if (PCI_FUNC(pdev->devfn) > 0) | 3772 | } else |
3818 | pci_release_regions(pdev); | 3773 | pci_release_regions(pdev); |
3819 | } | 3774 | } |
3820 | 3775 | ||
diff --git a/drivers/net/cxgb4/cxgb4_uld.h b/drivers/net/cxgb4/cxgb4_uld.h index 85d74e751ce0..1b48c0170145 100644 --- a/drivers/net/cxgb4/cxgb4_uld.h +++ b/drivers/net/cxgb4/cxgb4_uld.h | |||
@@ -139,16 +139,11 @@ int cxgb4_alloc_stid(struct tid_info *t, int family, void *data); | |||
139 | void cxgb4_free_atid(struct tid_info *t, unsigned int atid); | 139 | void cxgb4_free_atid(struct tid_info *t, unsigned int atid); |
140 | void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family); | 140 | void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family); |
141 | void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid); | 141 | void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid); |
142 | void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, | ||
143 | unsigned int tid); | ||
144 | 142 | ||
145 | struct in6_addr; | 143 | struct in6_addr; |
146 | 144 | ||
147 | int cxgb4_create_server(const struct net_device *dev, unsigned int stid, | 145 | int cxgb4_create_server(const struct net_device *dev, unsigned int stid, |
148 | __be32 sip, __be16 sport, unsigned int queue); | 146 | __be32 sip, __be16 sport, unsigned int queue); |
149 | int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, | ||
150 | const struct in6_addr *sip, __be16 sport, | ||
151 | unsigned int queue); | ||
152 | 147 | ||
153 | static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) | 148 | static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) |
154 | { | 149 | { |
@@ -233,7 +228,6 @@ int cxgb4_ofld_send(struct net_device *dev, struct sk_buff *skb); | |||
233 | unsigned int cxgb4_port_chan(const struct net_device *dev); | 228 | unsigned int cxgb4_port_chan(const struct net_device *dev); |
234 | unsigned int cxgb4_port_viid(const struct net_device *dev); | 229 | unsigned int cxgb4_port_viid(const struct net_device *dev); |
235 | unsigned int cxgb4_port_idx(const struct net_device *dev); | 230 | unsigned int cxgb4_port_idx(const struct net_device *dev); |
236 | struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id); | ||
237 | unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu, | 231 | unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu, |
238 | unsigned int *idx); | 232 | unsigned int *idx); |
239 | void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, | 233 | void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, |
diff --git a/drivers/net/cxgb4/l2t.c b/drivers/net/cxgb4/l2t.c index e8f0f55e9d08..a2d323c473f8 100644 --- a/drivers/net/cxgb4/l2t.c +++ b/drivers/net/cxgb4/l2t.c | |||
@@ -481,40 +481,6 @@ void t4_l2t_update(struct adapter *adap, struct neighbour *neigh) | |||
481 | handle_failed_resolution(adap, arpq); | 481 | handle_failed_resolution(adap, arpq); |
482 | } | 482 | } |
483 | 483 | ||
484 | /* | ||
485 | * Allocate an L2T entry for use by a switching rule. Such entries need to be | ||
486 | * explicitly freed and while busy they are not on any hash chain, so normal | ||
487 | * address resolution updates do not see them. | ||
488 | */ | ||
489 | struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d) | ||
490 | { | ||
491 | struct l2t_entry *e; | ||
492 | |||
493 | write_lock_bh(&d->lock); | ||
494 | e = alloc_l2e(d); | ||
495 | if (e) { | ||
496 | spin_lock(&e->lock); /* avoid race with t4_l2t_free */ | ||
497 | e->state = L2T_STATE_SWITCHING; | ||
498 | atomic_set(&e->refcnt, 1); | ||
499 | spin_unlock(&e->lock); | ||
500 | } | ||
501 | write_unlock_bh(&d->lock); | ||
502 | return e; | ||
503 | } | ||
504 | |||
505 | /* | ||
506 | * Sets/updates the contents of a switching L2T entry that has been allocated | ||
507 | * with an earlier call to @t4_l2t_alloc_switching. | ||
508 | */ | ||
509 | int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, | ||
510 | u8 port, u8 *eth_addr) | ||
511 | { | ||
512 | e->vlan = vlan; | ||
513 | e->lport = port; | ||
514 | memcpy(e->dmac, eth_addr, ETH_ALEN); | ||
515 | return write_l2e(adap, e, 0); | ||
516 | } | ||
517 | |||
518 | struct l2t_data *t4_init_l2t(void) | 484 | struct l2t_data *t4_init_l2t(void) |
519 | { | 485 | { |
520 | int i; | 486 | int i; |
diff --git a/drivers/net/cxgb4/l2t.h b/drivers/net/cxgb4/l2t.h index 643f27ed3cf4..7bd8f42378ff 100644 --- a/drivers/net/cxgb4/l2t.h +++ b/drivers/net/cxgb4/l2t.h | |||
@@ -100,9 +100,6 @@ struct l2t_entry *cxgb4_l2t_get(struct l2t_data *d, struct neighbour *neigh, | |||
100 | unsigned int priority); | 100 | unsigned int priority); |
101 | 101 | ||
102 | void t4_l2t_update(struct adapter *adap, struct neighbour *neigh); | 102 | void t4_l2t_update(struct adapter *adap, struct neighbour *neigh); |
103 | struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d); | ||
104 | int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, | ||
105 | u8 port, u8 *eth_addr); | ||
106 | struct l2t_data *t4_init_l2t(void); | 103 | struct l2t_data *t4_init_l2t(void); |
107 | void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl); | 104 | void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl); |
108 | 105 | ||
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c index bf38cfc57565..56adf448b9fe 100644 --- a/drivers/net/cxgb4/sge.c +++ b/drivers/net/cxgb4/sge.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/ip.h> | 39 | #include <linux/ip.h> |
40 | #include <linux/dma-mapping.h> | 40 | #include <linux/dma-mapping.h> |
41 | #include <linux/jiffies.h> | 41 | #include <linux/jiffies.h> |
42 | #include <linux/prefetch.h> | ||
42 | #include <net/ipv6.h> | 43 | #include <net/ipv6.h> |
43 | #include <net/tcp.h> | 44 | #include <net/tcp.h> |
44 | #include "cxgb4.h" | 45 | #include "cxgb4.h" |
@@ -557,7 +558,8 @@ out: cred = q->avail - cred; | |||
557 | 558 | ||
558 | if (unlikely(fl_starving(q))) { | 559 | if (unlikely(fl_starving(q))) { |
559 | smp_wmb(); | 560 | smp_wmb(); |
560 | set_bit(q->cntxt_id, adap->sge.starving_fl); | 561 | set_bit(q->cntxt_id - adap->sge.egr_start, |
562 | adap->sge.starving_fl); | ||
561 | } | 563 | } |
562 | 564 | ||
563 | return cred; | 565 | return cred; |
@@ -578,6 +580,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl) | |||
578 | * @phys: the physical address of the allocated ring | 580 | * @phys: the physical address of the allocated ring |
579 | * @metadata: address of the array holding the SW state for the ring | 581 | * @metadata: address of the array holding the SW state for the ring |
580 | * @stat_size: extra space in HW ring for status information | 582 | * @stat_size: extra space in HW ring for status information |
583 | * @node: preferred node for memory allocations | ||
581 | * | 584 | * |
582 | * Allocates resources for an SGE descriptor ring, such as Tx queues, | 585 | * Allocates resources for an SGE descriptor ring, such as Tx queues, |
583 | * free buffer lists, or response queues. Each SGE ring requires | 586 | * free buffer lists, or response queues. Each SGE ring requires |
@@ -589,7 +592,7 @@ static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl) | |||
589 | */ | 592 | */ |
590 | static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size, | 593 | static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size, |
591 | size_t sw_size, dma_addr_t *phys, void *metadata, | 594 | size_t sw_size, dma_addr_t *phys, void *metadata, |
592 | size_t stat_size) | 595 | size_t stat_size, int node) |
593 | { | 596 | { |
594 | size_t len = nelem * elem_size + stat_size; | 597 | size_t len = nelem * elem_size + stat_size; |
595 | void *s = NULL; | 598 | void *s = NULL; |
@@ -598,7 +601,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size, | |||
598 | if (!p) | 601 | if (!p) |
599 | return NULL; | 602 | return NULL; |
600 | if (sw_size) { | 603 | if (sw_size) { |
601 | s = kcalloc(nelem, sw_size, GFP_KERNEL); | 604 | s = kzalloc_node(nelem * sw_size, GFP_KERNEL, node); |
602 | 605 | ||
603 | if (!s) { | 606 | if (!s) { |
604 | dma_free_coherent(dev, len, p, *phys); | 607 | dma_free_coherent(dev, len, p, *phys); |
@@ -974,7 +977,7 @@ out_free: dev_kfree_skb(skb); | |||
974 | } | 977 | } |
975 | 978 | ||
976 | cpl->ctrl0 = htonl(TXPKT_OPCODE(CPL_TX_PKT_XT) | | 979 | cpl->ctrl0 = htonl(TXPKT_OPCODE(CPL_TX_PKT_XT) | |
977 | TXPKT_INTF(pi->tx_chan) | TXPKT_PF(0)); | 980 | TXPKT_INTF(pi->tx_chan) | TXPKT_PF(adap->fn)); |
978 | cpl->pack = htons(0); | 981 | cpl->pack = htons(0); |
979 | cpl->len = htons(skb->len); | 982 | cpl->len = htons(skb->len); |
980 | cpl->ctrl1 = cpu_to_be64(cntrl); | 983 | cpl->ctrl1 = cpu_to_be64(cntrl); |
@@ -1213,7 +1216,8 @@ static void txq_stop_maperr(struct sge_ofld_txq *q) | |||
1213 | { | 1216 | { |
1214 | q->mapping_err++; | 1217 | q->mapping_err++; |
1215 | q->q.stops++; | 1218 | q->q.stops++; |
1216 | set_bit(q->q.cntxt_id, q->adap->sge.txq_maperr); | 1219 | set_bit(q->q.cntxt_id - q->adap->sge.egr_start, |
1220 | q->adap->sge.txq_maperr); | ||
1217 | } | 1221 | } |
1218 | 1222 | ||
1219 | /** | 1223 | /** |
@@ -1528,18 +1532,11 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, | |||
1528 | skb->rxhash = (__force u32)pkt->rsshdr.hash_val; | 1532 | skb->rxhash = (__force u32)pkt->rsshdr.hash_val; |
1529 | 1533 | ||
1530 | if (unlikely(pkt->vlan_ex)) { | 1534 | if (unlikely(pkt->vlan_ex)) { |
1531 | struct port_info *pi = netdev_priv(rxq->rspq.netdev); | 1535 | __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan)); |
1532 | struct vlan_group *grp = pi->vlan_grp; | ||
1533 | |||
1534 | rxq->stats.vlan_ex++; | 1536 | rxq->stats.vlan_ex++; |
1535 | if (likely(grp)) { | ||
1536 | ret = vlan_gro_frags(&rxq->rspq.napi, grp, | ||
1537 | ntohs(pkt->vlan)); | ||
1538 | goto stats; | ||
1539 | } | ||
1540 | } | 1537 | } |
1541 | ret = napi_gro_frags(&rxq->rspq.napi); | 1538 | ret = napi_gro_frags(&rxq->rspq.napi); |
1542 | stats: if (ret == GRO_HELD) | 1539 | if (ret == GRO_HELD) |
1543 | rxq->stats.lro_pkts++; | 1540 | rxq->stats.lro_pkts++; |
1544 | else if (ret == GRO_MERGED || ret == GRO_MERGED_FREE) | 1541 | else if (ret == GRO_MERGED || ret == GRO_MERGED_FREE) |
1545 | rxq->stats.lro_merged++; | 1542 | rxq->stats.lro_merged++; |
@@ -1560,7 +1557,6 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, | |||
1560 | { | 1557 | { |
1561 | bool csum_ok; | 1558 | bool csum_ok; |
1562 | struct sk_buff *skb; | 1559 | struct sk_buff *skb; |
1563 | struct port_info *pi; | ||
1564 | const struct cpl_rx_pkt *pkt; | 1560 | const struct cpl_rx_pkt *pkt; |
1565 | struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); | 1561 | struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); |
1566 | 1562 | ||
@@ -1588,10 +1584,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, | |||
1588 | if (skb->dev->features & NETIF_F_RXHASH) | 1584 | if (skb->dev->features & NETIF_F_RXHASH) |
1589 | skb->rxhash = (__force u32)pkt->rsshdr.hash_val; | 1585 | skb->rxhash = (__force u32)pkt->rsshdr.hash_val; |
1590 | 1586 | ||
1591 | pi = netdev_priv(skb->dev); | ||
1592 | rxq->stats.pkts++; | 1587 | rxq->stats.pkts++; |
1593 | 1588 | ||
1594 | if (csum_ok && (pi->rx_offload & RX_CSO) && | 1589 | if (csum_ok && (q->netdev->features & NETIF_F_RXCSUM) && |
1595 | (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) { | 1590 | (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) { |
1596 | if (!pkt->ip_frag) { | 1591 | if (!pkt->ip_frag) { |
1597 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1592 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1603,19 +1598,13 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, | |||
1603 | rxq->stats.rx_cso++; | 1598 | rxq->stats.rx_cso++; |
1604 | } | 1599 | } |
1605 | } else | 1600 | } else |
1606 | skb->ip_summed = CHECKSUM_NONE; | 1601 | skb_checksum_none_assert(skb); |
1607 | 1602 | ||
1608 | if (unlikely(pkt->vlan_ex)) { | 1603 | if (unlikely(pkt->vlan_ex)) { |
1609 | struct vlan_group *grp = pi->vlan_grp; | 1604 | __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan)); |
1610 | |||
1611 | rxq->stats.vlan_ex++; | 1605 | rxq->stats.vlan_ex++; |
1612 | if (likely(grp)) | 1606 | } |
1613 | vlan_hwaccel_receive_skb(skb, grp, ntohs(pkt->vlan)); | 1607 | netif_receive_skb(skb); |
1614 | else | ||
1615 | dev_kfree_skb_any(skb); | ||
1616 | } else | ||
1617 | netif_receive_skb(skb); | ||
1618 | |||
1619 | return 0; | 1608 | return 0; |
1620 | } | 1609 | } |
1621 | 1610 | ||
@@ -1835,6 +1824,7 @@ static unsigned int process_intrq(struct adapter *adap) | |||
1835 | if (RSPD_TYPE(rc->type_gen) == RSP_TYPE_INTR) { | 1824 | if (RSPD_TYPE(rc->type_gen) == RSP_TYPE_INTR) { |
1836 | unsigned int qid = ntohl(rc->pldbuflen_qid); | 1825 | unsigned int qid = ntohl(rc->pldbuflen_qid); |
1837 | 1826 | ||
1827 | qid -= adap->sge.ingr_start; | ||
1838 | napi_schedule(&adap->sge.ingr_map[qid]->napi); | 1828 | napi_schedule(&adap->sge.ingr_map[qid]->napi); |
1839 | } | 1829 | } |
1840 | 1830 | ||
@@ -1992,7 +1982,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, | |||
1992 | iq->size = roundup(iq->size, 16); | 1982 | iq->size = roundup(iq->size, 16); |
1993 | 1983 | ||
1994 | iq->desc = alloc_ring(adap->pdev_dev, iq->size, iq->iqe_len, 0, | 1984 | iq->desc = alloc_ring(adap->pdev_dev, iq->size, iq->iqe_len, 0, |
1995 | &iq->phys_addr, NULL, 0); | 1985 | &iq->phys_addr, NULL, 0, NUMA_NO_NODE); |
1996 | if (!iq->desc) | 1986 | if (!iq->desc) |
1997 | return -ENOMEM; | 1987 | return -ENOMEM; |
1998 | 1988 | ||
@@ -2018,12 +2008,14 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, | |||
2018 | fl->size = roundup(fl->size, 8); | 2008 | fl->size = roundup(fl->size, 8); |
2019 | fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64), | 2009 | fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64), |
2020 | sizeof(struct rx_sw_desc), &fl->addr, | 2010 | sizeof(struct rx_sw_desc), &fl->addr, |
2021 | &fl->sdesc, STAT_LEN); | 2011 | &fl->sdesc, STAT_LEN, NUMA_NO_NODE); |
2022 | if (!fl->desc) | 2012 | if (!fl->desc) |
2023 | goto fl_nomem; | 2013 | goto fl_nomem; |
2024 | 2014 | ||
2025 | flsz = fl->size / 8 + STAT_LEN / sizeof(struct tx_desc); | 2015 | flsz = fl->size / 8 + STAT_LEN / sizeof(struct tx_desc); |
2026 | c.iqns_to_fl0congen = htonl(FW_IQ_CMD_FL0PACKEN | | 2016 | c.iqns_to_fl0congen = htonl(FW_IQ_CMD_FL0PACKEN | |
2017 | FW_IQ_CMD_FL0FETCHRO(1) | | ||
2018 | FW_IQ_CMD_FL0DATARO(1) | | ||
2027 | FW_IQ_CMD_FL0PADEN); | 2019 | FW_IQ_CMD_FL0PADEN); |
2028 | c.fl0dcaen_to_fl0cidxfthresh = htons(FW_IQ_CMD_FL0FBMIN(2) | | 2020 | c.fl0dcaen_to_fl0cidxfthresh = htons(FW_IQ_CMD_FL0FBMIN(2) | |
2029 | FW_IQ_CMD_FL0FBMAX(3)); | 2021 | FW_IQ_CMD_FL0FBMAX(3)); |
@@ -2050,14 +2042,14 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, | |||
2050 | /* set offset to -1 to distinguish ingress queues without FL */ | 2042 | /* set offset to -1 to distinguish ingress queues without FL */ |
2051 | iq->offset = fl ? 0 : -1; | 2043 | iq->offset = fl ? 0 : -1; |
2052 | 2044 | ||
2053 | adap->sge.ingr_map[iq->cntxt_id] = iq; | 2045 | adap->sge.ingr_map[iq->cntxt_id - adap->sge.ingr_start] = iq; |
2054 | 2046 | ||
2055 | if (fl) { | 2047 | if (fl) { |
2056 | fl->cntxt_id = ntohs(c.fl0id); | 2048 | fl->cntxt_id = ntohs(c.fl0id); |
2057 | fl->avail = fl->pend_cred = 0; | 2049 | fl->avail = fl->pend_cred = 0; |
2058 | fl->pidx = fl->cidx = 0; | 2050 | fl->pidx = fl->cidx = 0; |
2059 | fl->alloc_failed = fl->large_alloc_failed = fl->starving = 0; | 2051 | fl->alloc_failed = fl->large_alloc_failed = fl->starving = 0; |
2060 | adap->sge.egr_map[fl->cntxt_id] = fl; | 2052 | adap->sge.egr_map[fl->cntxt_id - adap->sge.egr_start] = fl; |
2061 | refill_fl(adap, fl, fl_cap(fl), GFP_KERNEL); | 2053 | refill_fl(adap, fl, fl_cap(fl), GFP_KERNEL); |
2062 | } | 2054 | } |
2063 | return 0; | 2055 | return 0; |
@@ -2087,7 +2079,7 @@ static void init_txq(struct adapter *adap, struct sge_txq *q, unsigned int id) | |||
2087 | q->stops = q->restarts = 0; | 2079 | q->stops = q->restarts = 0; |
2088 | q->stat = (void *)&q->desc[q->size]; | 2080 | q->stat = (void *)&q->desc[q->size]; |
2089 | q->cntxt_id = id; | 2081 | q->cntxt_id = id; |
2090 | adap->sge.egr_map[id] = q; | 2082 | adap->sge.egr_map[id - adap->sge.egr_start] = q; |
2091 | } | 2083 | } |
2092 | 2084 | ||
2093 | int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, | 2085 | int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, |
@@ -2103,7 +2095,8 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, | |||
2103 | 2095 | ||
2104 | txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, | 2096 | txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, |
2105 | sizeof(struct tx_desc), sizeof(struct tx_sw_desc), | 2097 | sizeof(struct tx_desc), sizeof(struct tx_sw_desc), |
2106 | &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN); | 2098 | &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN, |
2099 | netdev_queue_numa_node_read(netdevq)); | ||
2107 | if (!txq->q.desc) | 2100 | if (!txq->q.desc) |
2108 | return -ENOMEM; | 2101 | return -ENOMEM; |
2109 | 2102 | ||
@@ -2116,6 +2109,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, | |||
2116 | c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid)); | 2109 | c.viid_pkd = htonl(FW_EQ_ETH_CMD_VIID(pi->viid)); |
2117 | c.fetchszm_to_iqid = htonl(FW_EQ_ETH_CMD_HOSTFCMODE(2) | | 2110 | c.fetchszm_to_iqid = htonl(FW_EQ_ETH_CMD_HOSTFCMODE(2) | |
2118 | FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | | 2111 | FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | |
2112 | FW_EQ_ETH_CMD_FETCHRO(1) | | ||
2119 | FW_EQ_ETH_CMD_IQID(iqid)); | 2113 | FW_EQ_ETH_CMD_IQID(iqid)); |
2120 | c.dcaen_to_eqsize = htonl(FW_EQ_ETH_CMD_FBMIN(2) | | 2114 | c.dcaen_to_eqsize = htonl(FW_EQ_ETH_CMD_FBMIN(2) | |
2121 | FW_EQ_ETH_CMD_FBMAX(3) | | 2115 | FW_EQ_ETH_CMD_FBMAX(3) | |
@@ -2154,7 +2148,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, | |||
2154 | 2148 | ||
2155 | txq->q.desc = alloc_ring(adap->pdev_dev, nentries, | 2149 | txq->q.desc = alloc_ring(adap->pdev_dev, nentries, |
2156 | sizeof(struct tx_desc), 0, &txq->q.phys_addr, | 2150 | sizeof(struct tx_desc), 0, &txq->q.phys_addr, |
2157 | NULL, 0); | 2151 | NULL, 0, NUMA_NO_NODE); |
2158 | if (!txq->q.desc) | 2152 | if (!txq->q.desc) |
2159 | return -ENOMEM; | 2153 | return -ENOMEM; |
2160 | 2154 | ||
@@ -2168,6 +2162,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, | |||
2168 | c.physeqid_pkd = htonl(0); | 2162 | c.physeqid_pkd = htonl(0); |
2169 | c.fetchszm_to_iqid = htonl(FW_EQ_CTRL_CMD_HOSTFCMODE(2) | | 2163 | c.fetchszm_to_iqid = htonl(FW_EQ_CTRL_CMD_HOSTFCMODE(2) | |
2170 | FW_EQ_CTRL_CMD_PCIECHN(pi->tx_chan) | | 2164 | FW_EQ_CTRL_CMD_PCIECHN(pi->tx_chan) | |
2165 | FW_EQ_CTRL_CMD_FETCHRO | | ||
2171 | FW_EQ_CTRL_CMD_IQID(iqid)); | 2166 | FW_EQ_CTRL_CMD_IQID(iqid)); |
2172 | c.dcaen_to_eqsize = htonl(FW_EQ_CTRL_CMD_FBMIN(2) | | 2167 | c.dcaen_to_eqsize = htonl(FW_EQ_CTRL_CMD_FBMIN(2) | |
2173 | FW_EQ_CTRL_CMD_FBMAX(3) | | 2168 | FW_EQ_CTRL_CMD_FBMAX(3) | |
@@ -2204,7 +2199,8 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, | |||
2204 | 2199 | ||
2205 | txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, | 2200 | txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, |
2206 | sizeof(struct tx_desc), sizeof(struct tx_sw_desc), | 2201 | sizeof(struct tx_desc), sizeof(struct tx_sw_desc), |
2207 | &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN); | 2202 | &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN, |
2203 | NUMA_NO_NODE); | ||
2208 | if (!txq->q.desc) | 2204 | if (!txq->q.desc) |
2209 | return -ENOMEM; | 2205 | return -ENOMEM; |
2210 | 2206 | ||
@@ -2217,6 +2213,7 @@ int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, | |||
2217 | FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c)); | 2213 | FW_EQ_OFLD_CMD_EQSTART | FW_LEN16(c)); |
2218 | c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) | | 2214 | c.fetchszm_to_iqid = htonl(FW_EQ_OFLD_CMD_HOSTFCMODE(2) | |
2219 | FW_EQ_OFLD_CMD_PCIECHN(pi->tx_chan) | | 2215 | FW_EQ_OFLD_CMD_PCIECHN(pi->tx_chan) | |
2216 | FW_EQ_OFLD_CMD_FETCHRO(1) | | ||
2220 | FW_EQ_OFLD_CMD_IQID(iqid)); | 2217 | FW_EQ_OFLD_CMD_IQID(iqid)); |
2221 | c.dcaen_to_eqsize = htonl(FW_EQ_OFLD_CMD_FBMIN(2) | | 2218 | c.dcaen_to_eqsize = htonl(FW_EQ_OFLD_CMD_FBMIN(2) | |
2222 | FW_EQ_OFLD_CMD_FBMAX(3) | | 2219 | FW_EQ_OFLD_CMD_FBMAX(3) | |
@@ -2259,7 +2256,7 @@ static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, | |||
2259 | { | 2256 | { |
2260 | unsigned int fl_id = fl ? fl->cntxt_id : 0xffff; | 2257 | unsigned int fl_id = fl ? fl->cntxt_id : 0xffff; |
2261 | 2258 | ||
2262 | adap->sge.ingr_map[rq->cntxt_id] = NULL; | 2259 | adap->sge.ingr_map[rq->cntxt_id - adap->sge.ingr_start] = NULL; |
2263 | t4_iq_free(adap, adap->fn, adap->fn, 0, FW_IQ_TYPE_FL_INT_CAP, | 2260 | t4_iq_free(adap, adap->fn, adap->fn, 0, FW_IQ_TYPE_FL_INT_CAP, |
2264 | rq->cntxt_id, fl_id, 0xffff); | 2261 | rq->cntxt_id, fl_id, 0xffff); |
2265 | dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len, | 2262 | dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len, |
diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c index 9e1a4b49b47a..d1ec111aebd8 100644 --- a/drivers/net/cxgb4/t4_hw.c +++ b/drivers/net/cxgb4/t4_hw.c | |||
@@ -120,30 +120,6 @@ static void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, | |||
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | #if 0 | ||
124 | /** | ||
125 | * t4_write_indirect - write indirectly addressed registers | ||
126 | * @adap: the adapter | ||
127 | * @addr_reg: register holding the indirect addresses | ||
128 | * @data_reg: register holding the value for the indirect registers | ||
129 | * @vals: values to write | ||
130 | * @nregs: how many indirect registers to write | ||
131 | * @start_idx: address of first indirect register to write | ||
132 | * | ||
133 | * Writes a sequential block of registers that are accessed indirectly | ||
134 | * through an address/data register pair. | ||
135 | */ | ||
136 | static void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, | ||
137 | unsigned int data_reg, const u32 *vals, | ||
138 | unsigned int nregs, unsigned int start_idx) | ||
139 | { | ||
140 | while (nregs--) { | ||
141 | t4_write_reg(adap, addr_reg, start_idx++); | ||
142 | t4_write_reg(adap, data_reg, *vals++); | ||
143 | } | ||
144 | } | ||
145 | #endif | ||
146 | |||
147 | /* | 123 | /* |
148 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. | 124 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. |
149 | */ | 125 | */ |
@@ -207,7 +183,7 @@ static void dump_mbox(struct adapter *adap, int mbox, u32 data_reg) | |||
207 | int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, | 183 | int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, |
208 | void *rpl, bool sleep_ok) | 184 | void *rpl, bool sleep_ok) |
209 | { | 185 | { |
210 | static int delay[] = { | 186 | static const int delay[] = { |
211 | 1, 1, 3, 5, 10, 10, 20, 50, 100, 200 | 187 | 1, 1, 3, 5, 10, 10, 20, 50, 100, 200 |
212 | }; | 188 | }; |
213 | 189 | ||
@@ -354,18 +330,6 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
354 | return 0; | 330 | return 0; |
355 | } | 331 | } |
356 | 332 | ||
357 | /* | ||
358 | * Partial EEPROM Vital Product Data structure. Includes only the ID and | ||
359 | * VPD-R header. | ||
360 | */ | ||
361 | struct t4_vpd_hdr { | ||
362 | u8 id_tag; | ||
363 | u8 id_len[2]; | ||
364 | u8 id_data[ID_LEN]; | ||
365 | u8 vpdr_tag; | ||
366 | u8 vpdr_len[2]; | ||
367 | }; | ||
368 | |||
369 | #define EEPROM_STAT_ADDR 0x7bfc | 333 | #define EEPROM_STAT_ADDR 0x7bfc |
370 | #define VPD_BASE 0 | 334 | #define VPD_BASE 0 |
371 | #define VPD_LEN 512 | 335 | #define VPD_LEN 512 |
@@ -394,25 +358,38 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable) | |||
394 | static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | 358 | static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) |
395 | { | 359 | { |
396 | int i, ret; | 360 | int i, ret; |
397 | int ec, sn, v2; | 361 | int ec, sn; |
398 | u8 vpd[VPD_LEN], csum; | 362 | u8 vpd[VPD_LEN], csum; |
399 | unsigned int vpdr_len; | 363 | unsigned int vpdr_len, kw_offset, id_len; |
400 | const struct t4_vpd_hdr *v; | ||
401 | 364 | ||
402 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(vpd), vpd); | 365 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(vpd), vpd); |
403 | if (ret < 0) | 366 | if (ret < 0) |
404 | return ret; | 367 | return ret; |
405 | 368 | ||
406 | v = (const struct t4_vpd_hdr *)vpd; | 369 | if (vpd[0] != PCI_VPD_LRDT_ID_STRING) { |
407 | vpdr_len = pci_vpd_lrdt_size(&v->vpdr_tag); | 370 | dev_err(adapter->pdev_dev, "missing VPD ID string\n"); |
408 | if (vpdr_len + sizeof(struct t4_vpd_hdr) > VPD_LEN) { | 371 | return -EINVAL; |
372 | } | ||
373 | |||
374 | id_len = pci_vpd_lrdt_size(vpd); | ||
375 | if (id_len > ID_LEN) | ||
376 | id_len = ID_LEN; | ||
377 | |||
378 | i = pci_vpd_find_tag(vpd, 0, VPD_LEN, PCI_VPD_LRDT_RO_DATA); | ||
379 | if (i < 0) { | ||
380 | dev_err(adapter->pdev_dev, "missing VPD-R section\n"); | ||
381 | return -EINVAL; | ||
382 | } | ||
383 | |||
384 | vpdr_len = pci_vpd_lrdt_size(&vpd[i]); | ||
385 | kw_offset = i + PCI_VPD_LRDT_TAG_SIZE; | ||
386 | if (vpdr_len + kw_offset > VPD_LEN) { | ||
409 | dev_err(adapter->pdev_dev, "bad VPD-R length %u\n", vpdr_len); | 387 | dev_err(adapter->pdev_dev, "bad VPD-R length %u\n", vpdr_len); |
410 | return -EINVAL; | 388 | return -EINVAL; |
411 | } | 389 | } |
412 | 390 | ||
413 | #define FIND_VPD_KW(var, name) do { \ | 391 | #define FIND_VPD_KW(var, name) do { \ |
414 | var = pci_vpd_find_info_keyword(&v->id_tag, sizeof(struct t4_vpd_hdr), \ | 392 | var = pci_vpd_find_info_keyword(vpd, kw_offset, vpdr_len, name); \ |
415 | vpdr_len, name); \ | ||
416 | if (var < 0) { \ | 393 | if (var < 0) { \ |
417 | dev_err(adapter->pdev_dev, "missing VPD keyword " name "\n"); \ | 394 | dev_err(adapter->pdev_dev, "missing VPD keyword " name "\n"); \ |
418 | return -EINVAL; \ | 395 | return -EINVAL; \ |
@@ -432,11 +409,9 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
432 | 409 | ||
433 | FIND_VPD_KW(ec, "EC"); | 410 | FIND_VPD_KW(ec, "EC"); |
434 | FIND_VPD_KW(sn, "SN"); | 411 | FIND_VPD_KW(sn, "SN"); |
435 | FIND_VPD_KW(v2, "V2"); | ||
436 | #undef FIND_VPD_KW | 412 | #undef FIND_VPD_KW |
437 | 413 | ||
438 | p->cclk = simple_strtoul(vpd + v2, NULL, 10); | 414 | memcpy(p->id, vpd + PCI_VPD_LRDT_TAG_SIZE, id_len); |
439 | memcpy(p->id, v->id_data, ID_LEN); | ||
440 | strim(p->id); | 415 | strim(p->id); |
441 | memcpy(p->ec, vpd + ec, EC_LEN); | 416 | memcpy(p->ec, vpd + ec, EC_LEN); |
442 | strim(p->ec); | 417 | strim(p->ec); |
@@ -908,7 +883,7 @@ struct intr_info { | |||
908 | * | 883 | * |
909 | * A table driven interrupt handler that applies a set of masks to an | 884 | * A table driven interrupt handler that applies a set of masks to an |
910 | * interrupt status word and performs the corresponding actions if the | 885 | * interrupt status word and performs the corresponding actions if the |
911 | * interrupts described by the mask have occured. The actions include | 886 | * interrupts described by the mask have occurred. The actions include |
912 | * optionally emitting a warning or alert message. The table is terminated | 887 | * optionally emitting a warning or alert message. The table is terminated |
913 | * by an entry specifying mask 0. Returns the number of fatal interrupt | 888 | * by an entry specifying mask 0. Returns the number of fatal interrupt |
914 | * conditions. | 889 | * conditions. |
@@ -943,7 +918,7 @@ static int t4_handle_intr_status(struct adapter *adapter, unsigned int reg, | |||
943 | */ | 918 | */ |
944 | static void pcie_intr_handler(struct adapter *adapter) | 919 | static void pcie_intr_handler(struct adapter *adapter) |
945 | { | 920 | { |
946 | static struct intr_info sysbus_intr_info[] = { | 921 | static const struct intr_info sysbus_intr_info[] = { |
947 | { RNPP, "RXNP array parity error", -1, 1 }, | 922 | { RNPP, "RXNP array parity error", -1, 1 }, |
948 | { RPCP, "RXPC array parity error", -1, 1 }, | 923 | { RPCP, "RXPC array parity error", -1, 1 }, |
949 | { RCIP, "RXCIF array parity error", -1, 1 }, | 924 | { RCIP, "RXCIF array parity error", -1, 1 }, |
@@ -951,7 +926,7 @@ static void pcie_intr_handler(struct adapter *adapter) | |||
951 | { RFTP, "RXFT array parity error", -1, 1 }, | 926 | { RFTP, "RXFT array parity error", -1, 1 }, |
952 | { 0 } | 927 | { 0 } |
953 | }; | 928 | }; |
954 | static struct intr_info pcie_port_intr_info[] = { | 929 | static const struct intr_info pcie_port_intr_info[] = { |
955 | { TPCP, "TXPC array parity error", -1, 1 }, | 930 | { TPCP, "TXPC array parity error", -1, 1 }, |
956 | { TNPP, "TXNP array parity error", -1, 1 }, | 931 | { TNPP, "TXNP array parity error", -1, 1 }, |
957 | { TFTP, "TXFT array parity error", -1, 1 }, | 932 | { TFTP, "TXFT array parity error", -1, 1 }, |
@@ -963,7 +938,7 @@ static void pcie_intr_handler(struct adapter *adapter) | |||
963 | { TDUE, "Tx uncorrectable data error", -1, 1 }, | 938 | { TDUE, "Tx uncorrectable data error", -1, 1 }, |
964 | { 0 } | 939 | { 0 } |
965 | }; | 940 | }; |
966 | static struct intr_info pcie_intr_info[] = { | 941 | static const struct intr_info pcie_intr_info[] = { |
967 | { MSIADDRLPERR, "MSI AddrL parity error", -1, 1 }, | 942 | { MSIADDRLPERR, "MSI AddrL parity error", -1, 1 }, |
968 | { MSIADDRHPERR, "MSI AddrH parity error", -1, 1 }, | 943 | { MSIADDRHPERR, "MSI AddrH parity error", -1, 1 }, |
969 | { MSIDATAPERR, "MSI data parity error", -1, 1 }, | 944 | { MSIDATAPERR, "MSI data parity error", -1, 1 }, |
@@ -1015,7 +990,7 @@ static void pcie_intr_handler(struct adapter *adapter) | |||
1015 | */ | 990 | */ |
1016 | static void tp_intr_handler(struct adapter *adapter) | 991 | static void tp_intr_handler(struct adapter *adapter) |
1017 | { | 992 | { |
1018 | static struct intr_info tp_intr_info[] = { | 993 | static const struct intr_info tp_intr_info[] = { |
1019 | { 0x3fffffff, "TP parity error", -1, 1 }, | 994 | { 0x3fffffff, "TP parity error", -1, 1 }, |
1020 | { FLMTXFLSTEMPTY, "TP out of Tx pages", -1, 1 }, | 995 | { FLMTXFLSTEMPTY, "TP out of Tx pages", -1, 1 }, |
1021 | { 0 } | 996 | { 0 } |
@@ -1032,7 +1007,7 @@ static void sge_intr_handler(struct adapter *adapter) | |||
1032 | { | 1007 | { |
1033 | u64 v; | 1008 | u64 v; |
1034 | 1009 | ||
1035 | static struct intr_info sge_intr_info[] = { | 1010 | static const struct intr_info sge_intr_info[] = { |
1036 | { ERR_CPL_EXCEED_IQE_SIZE, | 1011 | { ERR_CPL_EXCEED_IQE_SIZE, |
1037 | "SGE received CPL exceeding IQE size", -1, 1 }, | 1012 | "SGE received CPL exceeding IQE size", -1, 1 }, |
1038 | { ERR_INVALID_CIDX_INC, | 1013 | { ERR_INVALID_CIDX_INC, |
@@ -1077,7 +1052,7 @@ static void sge_intr_handler(struct adapter *adapter) | |||
1077 | */ | 1052 | */ |
1078 | static void cim_intr_handler(struct adapter *adapter) | 1053 | static void cim_intr_handler(struct adapter *adapter) |
1079 | { | 1054 | { |
1080 | static struct intr_info cim_intr_info[] = { | 1055 | static const struct intr_info cim_intr_info[] = { |
1081 | { PREFDROPINT, "CIM control register prefetch drop", -1, 1 }, | 1056 | { PREFDROPINT, "CIM control register prefetch drop", -1, 1 }, |
1082 | { OBQPARERR, "CIM OBQ parity error", -1, 1 }, | 1057 | { OBQPARERR, "CIM OBQ parity error", -1, 1 }, |
1083 | { IBQPARERR, "CIM IBQ parity error", -1, 1 }, | 1058 | { IBQPARERR, "CIM IBQ parity error", -1, 1 }, |
@@ -1087,7 +1062,7 @@ static void cim_intr_handler(struct adapter *adapter) | |||
1087 | { TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 }, | 1062 | { TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 }, |
1088 | { 0 } | 1063 | { 0 } |
1089 | }; | 1064 | }; |
1090 | static struct intr_info cim_upintr_info[] = { | 1065 | static const struct intr_info cim_upintr_info[] = { |
1091 | { RSVDSPACEINT, "CIM reserved space access", -1, 1 }, | 1066 | { RSVDSPACEINT, "CIM reserved space access", -1, 1 }, |
1092 | { ILLTRANSINT, "CIM illegal transaction", -1, 1 }, | 1067 | { ILLTRANSINT, "CIM illegal transaction", -1, 1 }, |
1093 | { ILLWRINT, "CIM illegal write", -1, 1 }, | 1068 | { ILLWRINT, "CIM illegal write", -1, 1 }, |
@@ -1134,7 +1109,7 @@ static void cim_intr_handler(struct adapter *adapter) | |||
1134 | */ | 1109 | */ |
1135 | static void ulprx_intr_handler(struct adapter *adapter) | 1110 | static void ulprx_intr_handler(struct adapter *adapter) |
1136 | { | 1111 | { |
1137 | static struct intr_info ulprx_intr_info[] = { | 1112 | static const struct intr_info ulprx_intr_info[] = { |
1138 | { 0x1800000, "ULPRX context error", -1, 1 }, | 1113 | { 0x1800000, "ULPRX context error", -1, 1 }, |
1139 | { 0x7fffff, "ULPRX parity error", -1, 1 }, | 1114 | { 0x7fffff, "ULPRX parity error", -1, 1 }, |
1140 | { 0 } | 1115 | { 0 } |
@@ -1149,7 +1124,7 @@ static void ulprx_intr_handler(struct adapter *adapter) | |||
1149 | */ | 1124 | */ |
1150 | static void ulptx_intr_handler(struct adapter *adapter) | 1125 | static void ulptx_intr_handler(struct adapter *adapter) |
1151 | { | 1126 | { |
1152 | static struct intr_info ulptx_intr_info[] = { | 1127 | static const struct intr_info ulptx_intr_info[] = { |
1153 | { PBL_BOUND_ERR_CH3, "ULPTX channel 3 PBL out of bounds", -1, | 1128 | { PBL_BOUND_ERR_CH3, "ULPTX channel 3 PBL out of bounds", -1, |
1154 | 0 }, | 1129 | 0 }, |
1155 | { PBL_BOUND_ERR_CH2, "ULPTX channel 2 PBL out of bounds", -1, | 1130 | { PBL_BOUND_ERR_CH2, "ULPTX channel 2 PBL out of bounds", -1, |
@@ -1171,7 +1146,7 @@ static void ulptx_intr_handler(struct adapter *adapter) | |||
1171 | */ | 1146 | */ |
1172 | static void pmtx_intr_handler(struct adapter *adapter) | 1147 | static void pmtx_intr_handler(struct adapter *adapter) |
1173 | { | 1148 | { |
1174 | static struct intr_info pmtx_intr_info[] = { | 1149 | static const struct intr_info pmtx_intr_info[] = { |
1175 | { PCMD_LEN_OVFL0, "PMTX channel 0 pcmd too large", -1, 1 }, | 1150 | { PCMD_LEN_OVFL0, "PMTX channel 0 pcmd too large", -1, 1 }, |
1176 | { PCMD_LEN_OVFL1, "PMTX channel 1 pcmd too large", -1, 1 }, | 1151 | { PCMD_LEN_OVFL1, "PMTX channel 1 pcmd too large", -1, 1 }, |
1177 | { PCMD_LEN_OVFL2, "PMTX channel 2 pcmd too large", -1, 1 }, | 1152 | { PCMD_LEN_OVFL2, "PMTX channel 2 pcmd too large", -1, 1 }, |
@@ -1193,7 +1168,7 @@ static void pmtx_intr_handler(struct adapter *adapter) | |||
1193 | */ | 1168 | */ |
1194 | static void pmrx_intr_handler(struct adapter *adapter) | 1169 | static void pmrx_intr_handler(struct adapter *adapter) |
1195 | { | 1170 | { |
1196 | static struct intr_info pmrx_intr_info[] = { | 1171 | static const struct intr_info pmrx_intr_info[] = { |
1197 | { ZERO_E_CMD_ERROR, "PMRX 0-length pcmd", -1, 1 }, | 1172 | { ZERO_E_CMD_ERROR, "PMRX 0-length pcmd", -1, 1 }, |
1198 | { PMRX_FRAMING_ERROR, "PMRX framing error", -1, 1 }, | 1173 | { PMRX_FRAMING_ERROR, "PMRX framing error", -1, 1 }, |
1199 | { OCSPI_PAR_ERROR, "PMRX ocspi parity error", -1, 1 }, | 1174 | { OCSPI_PAR_ERROR, "PMRX ocspi parity error", -1, 1 }, |
@@ -1212,7 +1187,7 @@ static void pmrx_intr_handler(struct adapter *adapter) | |||
1212 | */ | 1187 | */ |
1213 | static void cplsw_intr_handler(struct adapter *adapter) | 1188 | static void cplsw_intr_handler(struct adapter *adapter) |
1214 | { | 1189 | { |
1215 | static struct intr_info cplsw_intr_info[] = { | 1190 | static const struct intr_info cplsw_intr_info[] = { |
1216 | { CIM_OP_MAP_PERR, "CPLSW CIM op_map parity error", -1, 1 }, | 1191 | { CIM_OP_MAP_PERR, "CPLSW CIM op_map parity error", -1, 1 }, |
1217 | { CIM_OVFL_ERROR, "CPLSW CIM overflow", -1, 1 }, | 1192 | { CIM_OVFL_ERROR, "CPLSW CIM overflow", -1, 1 }, |
1218 | { TP_FRAMING_ERROR, "CPLSW TP framing error", -1, 1 }, | 1193 | { TP_FRAMING_ERROR, "CPLSW TP framing error", -1, 1 }, |
@@ -1231,7 +1206,7 @@ static void cplsw_intr_handler(struct adapter *adapter) | |||
1231 | */ | 1206 | */ |
1232 | static void le_intr_handler(struct adapter *adap) | 1207 | static void le_intr_handler(struct adapter *adap) |
1233 | { | 1208 | { |
1234 | static struct intr_info le_intr_info[] = { | 1209 | static const struct intr_info le_intr_info[] = { |
1235 | { LIPMISS, "LE LIP miss", -1, 0 }, | 1210 | { LIPMISS, "LE LIP miss", -1, 0 }, |
1236 | { LIP0, "LE 0 LIP error", -1, 0 }, | 1211 | { LIP0, "LE 0 LIP error", -1, 0 }, |
1237 | { PARITYERR, "LE parity error", -1, 1 }, | 1212 | { PARITYERR, "LE parity error", -1, 1 }, |
@@ -1249,11 +1224,11 @@ static void le_intr_handler(struct adapter *adap) | |||
1249 | */ | 1224 | */ |
1250 | static void mps_intr_handler(struct adapter *adapter) | 1225 | static void mps_intr_handler(struct adapter *adapter) |
1251 | { | 1226 | { |
1252 | static struct intr_info mps_rx_intr_info[] = { | 1227 | static const struct intr_info mps_rx_intr_info[] = { |
1253 | { 0xffffff, "MPS Rx parity error", -1, 1 }, | 1228 | { 0xffffff, "MPS Rx parity error", -1, 1 }, |
1254 | { 0 } | 1229 | { 0 } |
1255 | }; | 1230 | }; |
1256 | static struct intr_info mps_tx_intr_info[] = { | 1231 | static const struct intr_info mps_tx_intr_info[] = { |
1257 | { TPFIFO, "MPS Tx TP FIFO parity error", -1, 1 }, | 1232 | { TPFIFO, "MPS Tx TP FIFO parity error", -1, 1 }, |
1258 | { NCSIFIFO, "MPS Tx NC-SI FIFO parity error", -1, 1 }, | 1233 | { NCSIFIFO, "MPS Tx NC-SI FIFO parity error", -1, 1 }, |
1259 | { TXDATAFIFO, "MPS Tx data FIFO parity error", -1, 1 }, | 1234 | { TXDATAFIFO, "MPS Tx data FIFO parity error", -1, 1 }, |
@@ -1263,25 +1238,25 @@ static void mps_intr_handler(struct adapter *adapter) | |||
1263 | { FRMERR, "MPS Tx framing error", -1, 1 }, | 1238 | { FRMERR, "MPS Tx framing error", -1, 1 }, |
1264 | { 0 } | 1239 | { 0 } |
1265 | }; | 1240 | }; |
1266 | static struct intr_info mps_trc_intr_info[] = { | 1241 | static const struct intr_info mps_trc_intr_info[] = { |
1267 | { FILTMEM, "MPS TRC filter parity error", -1, 1 }, | 1242 | { FILTMEM, "MPS TRC filter parity error", -1, 1 }, |
1268 | { PKTFIFO, "MPS TRC packet FIFO parity error", -1, 1 }, | 1243 | { PKTFIFO, "MPS TRC packet FIFO parity error", -1, 1 }, |
1269 | { MISCPERR, "MPS TRC misc parity error", -1, 1 }, | 1244 | { MISCPERR, "MPS TRC misc parity error", -1, 1 }, |
1270 | { 0 } | 1245 | { 0 } |
1271 | }; | 1246 | }; |
1272 | static struct intr_info mps_stat_sram_intr_info[] = { | 1247 | static const struct intr_info mps_stat_sram_intr_info[] = { |
1273 | { 0x1fffff, "MPS statistics SRAM parity error", -1, 1 }, | 1248 | { 0x1fffff, "MPS statistics SRAM parity error", -1, 1 }, |
1274 | { 0 } | 1249 | { 0 } |
1275 | }; | 1250 | }; |
1276 | static struct intr_info mps_stat_tx_intr_info[] = { | 1251 | static const struct intr_info mps_stat_tx_intr_info[] = { |
1277 | { 0xfffff, "MPS statistics Tx FIFO parity error", -1, 1 }, | 1252 | { 0xfffff, "MPS statistics Tx FIFO parity error", -1, 1 }, |
1278 | { 0 } | 1253 | { 0 } |
1279 | }; | 1254 | }; |
1280 | static struct intr_info mps_stat_rx_intr_info[] = { | 1255 | static const struct intr_info mps_stat_rx_intr_info[] = { |
1281 | { 0xffffff, "MPS statistics Rx FIFO parity error", -1, 1 }, | 1256 | { 0xffffff, "MPS statistics Rx FIFO parity error", -1, 1 }, |
1282 | { 0 } | 1257 | { 0 } |
1283 | }; | 1258 | }; |
1284 | static struct intr_info mps_cls_intr_info[] = { | 1259 | static const struct intr_info mps_cls_intr_info[] = { |
1285 | { MATCHSRAM, "MPS match SRAM parity error", -1, 1 }, | 1260 | { MATCHSRAM, "MPS match SRAM parity error", -1, 1 }, |
1286 | { MATCHTCAM, "MPS match TCAM parity error", -1, 1 }, | 1261 | { MATCHTCAM, "MPS match TCAM parity error", -1, 1 }, |
1287 | { HASHSRAM, "MPS hash SRAM parity error", -1, 1 }, | 1262 | { HASHSRAM, "MPS hash SRAM parity error", -1, 1 }, |
@@ -1380,7 +1355,7 @@ static void ma_intr_handler(struct adapter *adap) | |||
1380 | */ | 1355 | */ |
1381 | static void smb_intr_handler(struct adapter *adap) | 1356 | static void smb_intr_handler(struct adapter *adap) |
1382 | { | 1357 | { |
1383 | static struct intr_info smb_intr_info[] = { | 1358 | static const struct intr_info smb_intr_info[] = { |
1384 | { MSTTXFIFOPARINT, "SMB master Tx FIFO parity error", -1, 1 }, | 1359 | { MSTTXFIFOPARINT, "SMB master Tx FIFO parity error", -1, 1 }, |
1385 | { MSTRXFIFOPARINT, "SMB master Rx FIFO parity error", -1, 1 }, | 1360 | { MSTRXFIFOPARINT, "SMB master Rx FIFO parity error", -1, 1 }, |
1386 | { SLVFIFOPARINT, "SMB slave FIFO parity error", -1, 1 }, | 1361 | { SLVFIFOPARINT, "SMB slave FIFO parity error", -1, 1 }, |
@@ -1396,7 +1371,7 @@ static void smb_intr_handler(struct adapter *adap) | |||
1396 | */ | 1371 | */ |
1397 | static void ncsi_intr_handler(struct adapter *adap) | 1372 | static void ncsi_intr_handler(struct adapter *adap) |
1398 | { | 1373 | { |
1399 | static struct intr_info ncsi_intr_info[] = { | 1374 | static const struct intr_info ncsi_intr_info[] = { |
1400 | { CIM_DM_PRTY_ERR, "NC-SI CIM parity error", -1, 1 }, | 1375 | { CIM_DM_PRTY_ERR, "NC-SI CIM parity error", -1, 1 }, |
1401 | { MPS_DM_PRTY_ERR, "NC-SI MPS parity error", -1, 1 }, | 1376 | { MPS_DM_PRTY_ERR, "NC-SI MPS parity error", -1, 1 }, |
1402 | { TXFIFO_PRTY_ERR, "NC-SI Tx FIFO parity error", -1, 1 }, | 1377 | { TXFIFO_PRTY_ERR, "NC-SI Tx FIFO parity error", -1, 1 }, |
@@ -1434,7 +1409,7 @@ static void xgmac_intr_handler(struct adapter *adap, int port) | |||
1434 | */ | 1409 | */ |
1435 | static void pl_intr_handler(struct adapter *adap) | 1410 | static void pl_intr_handler(struct adapter *adap) |
1436 | { | 1411 | { |
1437 | static struct intr_info pl_intr_info[] = { | 1412 | static const struct intr_info pl_intr_info[] = { |
1438 | { FATALPERR, "T4 fatal parity error", -1, 1 }, | 1413 | { FATALPERR, "T4 fatal parity error", -1, 1 }, |
1439 | { PERRVFID, "PL VFID_MAP parity error", -1, 1 }, | 1414 | { PERRVFID, "PL VFID_MAP parity error", -1, 1 }, |
1440 | { 0 } | 1415 | { 0 } |
@@ -1560,44 +1535,6 @@ void t4_intr_disable(struct adapter *adapter) | |||
1560 | } | 1535 | } |
1561 | 1536 | ||
1562 | /** | 1537 | /** |
1563 | * t4_intr_clear - clear all interrupts | ||
1564 | * @adapter: the adapter whose interrupts should be cleared | ||
1565 | * | ||
1566 | * Clears all interrupts. The caller must be a PCI function managing | ||
1567 | * global interrupts. | ||
1568 | */ | ||
1569 | void t4_intr_clear(struct adapter *adapter) | ||
1570 | { | ||
1571 | static const unsigned int cause_reg[] = { | ||
1572 | SGE_INT_CAUSE1, SGE_INT_CAUSE2, SGE_INT_CAUSE3, | ||
1573 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, | ||
1574 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | ||
1575 | PCIE_NONFAT_ERR, PCIE_INT_CAUSE, | ||
1576 | MC_INT_CAUSE, | ||
1577 | MA_INT_WRAP_STATUS, MA_PARITY_ERROR_STATUS, MA_INT_CAUSE, | ||
1578 | EDC_INT_CAUSE, EDC_REG(EDC_INT_CAUSE, 1), | ||
1579 | CIM_HOST_INT_CAUSE, CIM_HOST_UPACC_INT_CAUSE, | ||
1580 | MYPF_REG(CIM_PF_HOST_INT_CAUSE), | ||
1581 | TP_INT_CAUSE, | ||
1582 | ULP_RX_INT_CAUSE, ULP_TX_INT_CAUSE, | ||
1583 | PM_RX_INT_CAUSE, PM_TX_INT_CAUSE, | ||
1584 | MPS_RX_PERR_INT_CAUSE, | ||
1585 | CPL_INTR_CAUSE, | ||
1586 | MYPF_REG(PL_PF_INT_CAUSE), | ||
1587 | PL_PL_INT_CAUSE, | ||
1588 | LE_DB_INT_CAUSE, | ||
1589 | }; | ||
1590 | |||
1591 | unsigned int i; | ||
1592 | |||
1593 | for (i = 0; i < ARRAY_SIZE(cause_reg); ++i) | ||
1594 | t4_write_reg(adapter, cause_reg[i], 0xffffffff); | ||
1595 | |||
1596 | t4_write_reg(adapter, PL_INT_CAUSE, GLBL_INTR_MASK); | ||
1597 | (void) t4_read_reg(adapter, PL_INT_CAUSE); /* flush */ | ||
1598 | } | ||
1599 | |||
1600 | /** | ||
1601 | * hash_mac_addr - return the hash value of a MAC address | 1538 | * hash_mac_addr - return the hash value of a MAC address |
1602 | * @addr: the 48-bit Ethernet MAC address | 1539 | * @addr: the 48-bit Ethernet MAC address |
1603 | * | 1540 | * |
@@ -1709,36 +1646,6 @@ int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, | |||
1709 | return t4_wr_mbox(adapter, mbox, &c, sizeof(c), NULL); | 1646 | return t4_wr_mbox(adapter, mbox, &c, sizeof(c), NULL); |
1710 | } | 1647 | } |
1711 | 1648 | ||
1712 | /* Read an RSS table row */ | ||
1713 | static int rd_rss_row(struct adapter *adap, int row, u32 *val) | ||
1714 | { | ||
1715 | t4_write_reg(adap, TP_RSS_LKP_TABLE, 0xfff00000 | row); | ||
1716 | return t4_wait_op_done_val(adap, TP_RSS_LKP_TABLE, LKPTBLROWVLD, 1, | ||
1717 | 5, 0, val); | ||
1718 | } | ||
1719 | |||
1720 | /** | ||
1721 | * t4_read_rss - read the contents of the RSS mapping table | ||
1722 | * @adapter: the adapter | ||
1723 | * @map: holds the contents of the RSS mapping table | ||
1724 | * | ||
1725 | * Reads the contents of the RSS hash->queue mapping table. | ||
1726 | */ | ||
1727 | int t4_read_rss(struct adapter *adapter, u16 *map) | ||
1728 | { | ||
1729 | u32 val; | ||
1730 | int i, ret; | ||
1731 | |||
1732 | for (i = 0; i < RSS_NENTRIES / 2; ++i) { | ||
1733 | ret = rd_rss_row(adapter, i, &val); | ||
1734 | if (ret) | ||
1735 | return ret; | ||
1736 | *map++ = LKPTBLQUEUE0_GET(val); | ||
1737 | *map++ = LKPTBLQUEUE1_GET(val); | ||
1738 | } | ||
1739 | return 0; | ||
1740 | } | ||
1741 | |||
1742 | /** | 1649 | /** |
1743 | * t4_tp_get_tcp_stats - read TP's TCP MIB counters | 1650 | * t4_tp_get_tcp_stats - read TP's TCP MIB counters |
1744 | * @adap: the adapter | 1651 | * @adap: the adapter |
@@ -1779,29 +1686,6 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, | |||
1779 | } | 1686 | } |
1780 | 1687 | ||
1781 | /** | 1688 | /** |
1782 | * t4_tp_get_err_stats - read TP's error MIB counters | ||
1783 | * @adap: the adapter | ||
1784 | * @st: holds the counter values | ||
1785 | * | ||
1786 | * Returns the values of TP's error counters. | ||
1787 | */ | ||
1788 | void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) | ||
1789 | { | ||
1790 | t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->macInErrs, | ||
1791 | 12, TP_MIB_MAC_IN_ERR_0); | ||
1792 | t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlCongDrops, | ||
1793 | 8, TP_MIB_TNL_CNG_DROP_0); | ||
1794 | t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlTxDrops, | ||
1795 | 4, TP_MIB_TNL_DROP_0); | ||
1796 | t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->ofldVlanDrops, | ||
1797 | 4, TP_MIB_OFD_VLN_DROP_0); | ||
1798 | t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tcp6InErrs, | ||
1799 | 4, TP_MIB_TCP_V6IN_ERR_0); | ||
1800 | t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, &st->ofldNoNeigh, | ||
1801 | 2, TP_MIB_OFD_ARP_DROP); | ||
1802 | } | ||
1803 | |||
1804 | /** | ||
1805 | * t4_read_mtu_tbl - returns the values in the HW path MTU table | 1689 | * t4_read_mtu_tbl - returns the values in the HW path MTU table |
1806 | * @adap: the adapter | 1690 | * @adap: the adapter |
1807 | * @mtus: where to store the MTU values | 1691 | * @mtus: where to store the MTU values |
@@ -1916,122 +1800,6 @@ void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, | |||
1916 | } | 1800 | } |
1917 | 1801 | ||
1918 | /** | 1802 | /** |
1919 | * t4_set_trace_filter - configure one of the tracing filters | ||
1920 | * @adap: the adapter | ||
1921 | * @tp: the desired trace filter parameters | ||
1922 | * @idx: which filter to configure | ||
1923 | * @enable: whether to enable or disable the filter | ||
1924 | * | ||
1925 | * Configures one of the tracing filters available in HW. If @enable is | ||
1926 | * %0 @tp is not examined and may be %NULL. | ||
1927 | */ | ||
1928 | int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, | ||
1929 | int idx, int enable) | ||
1930 | { | ||
1931 | int i, ofst = idx * 4; | ||
1932 | u32 data_reg, mask_reg, cfg; | ||
1933 | u32 multitrc = TRCMULTIFILTER; | ||
1934 | |||
1935 | if (!enable) { | ||
1936 | t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); | ||
1937 | goto out; | ||
1938 | } | ||
1939 | |||
1940 | if (tp->port > 11 || tp->invert > 1 || tp->skip_len > 0x1f || | ||
1941 | tp->skip_ofst > 0x1f || tp->min_len > 0x1ff || | ||
1942 | tp->snap_len > 9600 || (idx && tp->snap_len > 256)) | ||
1943 | return -EINVAL; | ||
1944 | |||
1945 | if (tp->snap_len > 256) { /* must be tracer 0 */ | ||
1946 | if ((t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 4) | | ||
1947 | t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 8) | | ||
1948 | t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 12)) & TFEN) | ||
1949 | return -EINVAL; /* other tracers are enabled */ | ||
1950 | multitrc = 0; | ||
1951 | } else if (idx) { | ||
1952 | i = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B); | ||
1953 | if (TFCAPTUREMAX_GET(i) > 256 && | ||
1954 | (t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A) & TFEN)) | ||
1955 | return -EINVAL; | ||
1956 | } | ||
1957 | |||
1958 | /* stop the tracer we'll be changing */ | ||
1959 | t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); | ||
1960 | |||
1961 | /* disable tracing globally if running in the wrong single/multi mode */ | ||
1962 | cfg = t4_read_reg(adap, MPS_TRC_CFG); | ||
1963 | if ((cfg & TRCEN) && multitrc != (cfg & TRCMULTIFILTER)) { | ||
1964 | t4_write_reg(adap, MPS_TRC_CFG, cfg ^ TRCEN); | ||
1965 | t4_read_reg(adap, MPS_TRC_CFG); /* flush */ | ||
1966 | msleep(1); | ||
1967 | if (!(t4_read_reg(adap, MPS_TRC_CFG) & TRCFIFOEMPTY)) | ||
1968 | return -ETIMEDOUT; | ||
1969 | } | ||
1970 | /* | ||
1971 | * At this point either the tracing is enabled and in the right mode or | ||
1972 | * disabled. | ||
1973 | */ | ||
1974 | |||
1975 | idx *= (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH); | ||
1976 | data_reg = MPS_TRC_FILTER0_MATCH + idx; | ||
1977 | mask_reg = MPS_TRC_FILTER0_DONT_CARE + idx; | ||
1978 | |||
1979 | for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { | ||
1980 | t4_write_reg(adap, data_reg, tp->data[i]); | ||
1981 | t4_write_reg(adap, mask_reg, ~tp->mask[i]); | ||
1982 | } | ||
1983 | t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst, | ||
1984 | TFCAPTUREMAX(tp->snap_len) | | ||
1985 | TFMINPKTSIZE(tp->min_len)); | ||
1986 | t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, | ||
1987 | TFOFFSET(tp->skip_ofst) | TFLENGTH(tp->skip_len) | | ||
1988 | TFPORT(tp->port) | TFEN | | ||
1989 | (tp->invert ? TFINVERTMATCH : 0)); | ||
1990 | |||
1991 | cfg &= ~TRCMULTIFILTER; | ||
1992 | t4_write_reg(adap, MPS_TRC_CFG, cfg | TRCEN | multitrc); | ||
1993 | out: t4_read_reg(adap, MPS_TRC_CFG); /* flush */ | ||
1994 | return 0; | ||
1995 | } | ||
1996 | |||
1997 | /** | ||
1998 | * t4_get_trace_filter - query one of the tracing filters | ||
1999 | * @adap: the adapter | ||
2000 | * @tp: the current trace filter parameters | ||
2001 | * @idx: which trace filter to query | ||
2002 | * @enabled: non-zero if the filter is enabled | ||
2003 | * | ||
2004 | * Returns the current settings of one of the HW tracing filters. | ||
2005 | */ | ||
2006 | void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx, | ||
2007 | int *enabled) | ||
2008 | { | ||
2009 | u32 ctla, ctlb; | ||
2010 | int i, ofst = idx * 4; | ||
2011 | u32 data_reg, mask_reg; | ||
2012 | |||
2013 | ctla = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst); | ||
2014 | ctlb = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst); | ||
2015 | |||
2016 | *enabled = !!(ctla & TFEN); | ||
2017 | tp->snap_len = TFCAPTUREMAX_GET(ctlb); | ||
2018 | tp->min_len = TFMINPKTSIZE_GET(ctlb); | ||
2019 | tp->skip_ofst = TFOFFSET_GET(ctla); | ||
2020 | tp->skip_len = TFLENGTH_GET(ctla); | ||
2021 | tp->invert = !!(ctla & TFINVERTMATCH); | ||
2022 | tp->port = TFPORT_GET(ctla); | ||
2023 | |||
2024 | ofst = (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH) * idx; | ||
2025 | data_reg = MPS_TRC_FILTER0_MATCH + ofst; | ||
2026 | mask_reg = MPS_TRC_FILTER0_DONT_CARE + ofst; | ||
2027 | |||
2028 | for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { | ||
2029 | tp->mask[i] = ~t4_read_reg(adap, mask_reg); | ||
2030 | tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i]; | ||
2031 | } | ||
2032 | } | ||
2033 | |||
2034 | /** | ||
2035 | * get_mps_bg_map - return the buffer groups associated with a port | 1803 | * get_mps_bg_map - return the buffer groups associated with a port |
2036 | * @adap: the adapter | 1804 | * @adap: the adapter |
2037 | * @idx: the port index | 1805 | * @idx: the port index |
@@ -2133,52 +1901,6 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) | |||
2133 | } | 1901 | } |
2134 | 1902 | ||
2135 | /** | 1903 | /** |
2136 | * t4_get_lb_stats - collect loopback port statistics | ||
2137 | * @adap: the adapter | ||
2138 | * @idx: the loopback port index | ||
2139 | * @p: the stats structure to fill | ||
2140 | * | ||
2141 | * Return HW statistics for the given loopback port. | ||
2142 | */ | ||
2143 | void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) | ||
2144 | { | ||
2145 | u32 bgmap = get_mps_bg_map(adap, idx); | ||
2146 | |||
2147 | #define GET_STAT(name) \ | ||
2148 | t4_read_reg64(adap, PORT_REG(idx, MPS_PORT_STAT_LB_PORT_##name##_L)) | ||
2149 | #define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) | ||
2150 | |||
2151 | p->octets = GET_STAT(BYTES); | ||
2152 | p->frames = GET_STAT(FRAMES); | ||
2153 | p->bcast_frames = GET_STAT(BCAST); | ||
2154 | p->mcast_frames = GET_STAT(MCAST); | ||
2155 | p->ucast_frames = GET_STAT(UCAST); | ||
2156 | p->error_frames = GET_STAT(ERROR); | ||
2157 | |||
2158 | p->frames_64 = GET_STAT(64B); | ||
2159 | p->frames_65_127 = GET_STAT(65B_127B); | ||
2160 | p->frames_128_255 = GET_STAT(128B_255B); | ||
2161 | p->frames_256_511 = GET_STAT(256B_511B); | ||
2162 | p->frames_512_1023 = GET_STAT(512B_1023B); | ||
2163 | p->frames_1024_1518 = GET_STAT(1024B_1518B); | ||
2164 | p->frames_1519_max = GET_STAT(1519B_MAX); | ||
2165 | p->drop = t4_read_reg(adap, PORT_REG(idx, | ||
2166 | MPS_PORT_STAT_LB_PORT_DROP_FRAMES)); | ||
2167 | |||
2168 | p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; | ||
2169 | p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; | ||
2170 | p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; | ||
2171 | p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; | ||
2172 | p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; | ||
2173 | p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; | ||
2174 | p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; | ||
2175 | p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; | ||
2176 | |||
2177 | #undef GET_STAT | ||
2178 | #undef GET_STAT_COM | ||
2179 | } | ||
2180 | |||
2181 | /** | ||
2182 | * t4_wol_magic_enable - enable/disable magic packet WoL | 1904 | * t4_wol_magic_enable - enable/disable magic packet WoL |
2183 | * @adap: the adapter | 1905 | * @adap: the adapter |
2184 | * @port: the physical port index | 1906 | * @port: the physical port index |
@@ -2584,30 +2306,6 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, | |||
2584 | } | 2306 | } |
2585 | 2307 | ||
2586 | /** | 2308 | /** |
2587 | * t4_free_vi - free a virtual interface | ||
2588 | * @adap: the adapter | ||
2589 | * @mbox: mailbox to use for the FW command | ||
2590 | * @pf: the PF owning the VI | ||
2591 | * @vf: the VF owning the VI | ||
2592 | * @viid: virtual interface identifiler | ||
2593 | * | ||
2594 | * Free a previously allocated virtual interface. | ||
2595 | */ | ||
2596 | int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, | ||
2597 | unsigned int vf, unsigned int viid) | ||
2598 | { | ||
2599 | struct fw_vi_cmd c; | ||
2600 | |||
2601 | memset(&c, 0, sizeof(c)); | ||
2602 | c.op_to_vfn = htonl(FW_CMD_OP(FW_VI_CMD) | FW_CMD_REQUEST | | ||
2603 | FW_CMD_EXEC | FW_VI_CMD_PFN(pf) | | ||
2604 | FW_VI_CMD_VFN(vf)); | ||
2605 | c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c)); | ||
2606 | c.type_viid = htons(FW_VI_CMD_VIID(viid)); | ||
2607 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); | ||
2608 | } | ||
2609 | |||
2610 | /** | ||
2611 | * t4_set_rxmode - set Rx properties of a virtual interface | 2309 | * t4_set_rxmode - set Rx properties of a virtual interface |
2612 | * @adap: the adapter | 2310 | * @adap: the adapter |
2613 | * @mbox: mailbox to use for the FW command | 2311 | * @mbox: mailbox to use for the FW command |
@@ -2709,7 +2407,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, | |||
2709 | if (index < NEXACT_MAC) | 2407 | if (index < NEXACT_MAC) |
2710 | ret++; | 2408 | ret++; |
2711 | else if (hash) | 2409 | else if (hash) |
2712 | *hash |= (1 << hash_mac_addr(addr[i])); | 2410 | *hash |= (1ULL << hash_mac_addr(addr[i])); |
2713 | } | 2411 | } |
2714 | return ret; | 2412 | return ret; |
2715 | } | 2413 | } |
@@ -2833,37 +2531,6 @@ int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, | |||
2833 | } | 2531 | } |
2834 | 2532 | ||
2835 | /** | 2533 | /** |
2836 | * t4_iq_start_stop - enable/disable an ingress queue and its FLs | ||
2837 | * @adap: the adapter | ||
2838 | * @mbox: mailbox to use for the FW command | ||
2839 | * @start: %true to enable the queues, %false to disable them | ||
2840 | * @pf: the PF owning the queues | ||
2841 | * @vf: the VF owning the queues | ||
2842 | * @iqid: ingress queue id | ||
2843 | * @fl0id: FL0 queue id or 0xffff if no attached FL0 | ||
2844 | * @fl1id: FL1 queue id or 0xffff if no attached FL1 | ||
2845 | * | ||
2846 | * Starts or stops an ingress queue and its associated FLs, if any. | ||
2847 | */ | ||
2848 | int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, | ||
2849 | unsigned int pf, unsigned int vf, unsigned int iqid, | ||
2850 | unsigned int fl0id, unsigned int fl1id) | ||
2851 | { | ||
2852 | struct fw_iq_cmd c; | ||
2853 | |||
2854 | memset(&c, 0, sizeof(c)); | ||
2855 | c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST | | ||
2856 | FW_CMD_EXEC | FW_IQ_CMD_PFN(pf) | | ||
2857 | FW_IQ_CMD_VFN(vf)); | ||
2858 | c.alloc_to_len16 = htonl(FW_IQ_CMD_IQSTART(start) | | ||
2859 | FW_IQ_CMD_IQSTOP(!start) | FW_LEN16(c)); | ||
2860 | c.iqid = htons(iqid); | ||
2861 | c.fl0id = htons(fl0id); | ||
2862 | c.fl1id = htons(fl1id); | ||
2863 | return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); | ||
2864 | } | ||
2865 | |||
2866 | /** | ||
2867 | * t4_iq_free - free an ingress queue and its FLs | 2534 | * t4_iq_free - free an ingress queue and its FLs |
2868 | * @adap: the adapter | 2535 | * @adap: the adapter |
2869 | * @mbox: mailbox to use for the FW command | 2536 | * @mbox: mailbox to use for the FW command |
diff --git a/drivers/net/cxgb4/t4_hw.h b/drivers/net/cxgb4/t4_hw.h index 10a055565776..c26b455f37de 100644 --- a/drivers/net/cxgb4/t4_hw.h +++ b/drivers/net/cxgb4/t4_hw.h | |||
@@ -42,6 +42,7 @@ enum { | |||
42 | MAX_MTU = 9600, /* max MAC MTU, excluding header + FCS */ | 42 | MAX_MTU = 9600, /* max MAC MTU, excluding header + FCS */ |
43 | EEPROMSIZE = 17408, /* Serial EEPROM physical size */ | 43 | EEPROMSIZE = 17408, /* Serial EEPROM physical size */ |
44 | EEPROMVSIZE = 32768, /* Serial EEPROM virtual address space size */ | 44 | EEPROMVSIZE = 32768, /* Serial EEPROM virtual address space size */ |
45 | EEPROMPFSIZE = 1024, /* EEPROM writable area size for PFn, n>0 */ | ||
45 | RSS_NENTRIES = 2048, /* # of entries in RSS mapping table */ | 46 | RSS_NENTRIES = 2048, /* # of entries in RSS mapping table */ |
46 | TCB_SIZE = 128, /* TCB size */ | 47 | TCB_SIZE = 128, /* TCB size */ |
47 | NMTUS = 16, /* size of MTU table */ | 48 | NMTUS = 16, /* size of MTU table */ |
diff --git a/drivers/net/cxgb4/t4_msg.h b/drivers/net/cxgb4/t4_msg.h index a550d0c706f3..eb71b8250b91 100644 --- a/drivers/net/cxgb4/t4_msg.h +++ b/drivers/net/cxgb4/t4_msg.h | |||
@@ -123,6 +123,7 @@ enum { | |||
123 | ULP_MODE_NONE = 0, | 123 | ULP_MODE_NONE = 0, |
124 | ULP_MODE_ISCSI = 2, | 124 | ULP_MODE_ISCSI = 2, |
125 | ULP_MODE_RDMA = 4, | 125 | ULP_MODE_RDMA = 4, |
126 | ULP_MODE_TCPDDP = 5, | ||
126 | ULP_MODE_FCOE = 6, | 127 | ULP_MODE_FCOE = 6, |
127 | }; | 128 | }; |
128 | 129 | ||
diff --git a/drivers/net/cxgb4/t4fw_api.h b/drivers/net/cxgb4/t4fw_api.h index 0969f2fbc1b0..edcfd7ec7802 100644 --- a/drivers/net/cxgb4/t4fw_api.h +++ b/drivers/net/cxgb4/t4fw_api.h | |||
@@ -487,6 +487,11 @@ enum fw_params_param_pfvf { | |||
487 | FW_PARAMS_PARAM_PFVF_CPMASK = 0x25, | 487 | FW_PARAMS_PARAM_PFVF_CPMASK = 0x25, |
488 | FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26, | 488 | FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26, |
489 | FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27, | 489 | FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27, |
490 | FW_PARAMS_PARAM_PFVF_CONM_MAP = 0x28, | ||
491 | FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29, | ||
492 | FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A, | ||
493 | FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B, | ||
494 | FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C, | ||
490 | }; | 495 | }; |
491 | 496 | ||
492 | /* | 497 | /* |
@@ -1234,6 +1239,7 @@ enum fw_port_type { | |||
1234 | FW_PORT_TYPE_KR, | 1239 | FW_PORT_TYPE_KR, |
1235 | FW_PORT_TYPE_SFP, | 1240 | FW_PORT_TYPE_SFP, |
1236 | FW_PORT_TYPE_BP_AP, | 1241 | FW_PORT_TYPE_BP_AP, |
1242 | FW_PORT_TYPE_BP4_AP, | ||
1237 | 1243 | ||
1238 | FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK | 1244 | FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK |
1239 | }; | 1245 | }; |