Pull up the following (all via patch) requested by msaitoh in ticket #1231: sys/dev/pci/ixgbe/ixgbe.c 1.259, 1.278-1.279 sys/dev/pci/ixgbe/ixgbe.h 1.75 sys/dev/pci/ixgbe/ixgbe_netbsd.h 1.12 sys/dev/pci/ixgbe/ixgbe_vf.c 1.24-1.26 sys/dev/pci/ixgbe/ixgbe_x550.c 1.17 sys/dev/pci/ixgbe/ixv.c 1.155-1.156 sys/dev/pci/ixgbe/ix_txrx.c 1.64-67 sys/dev/pci/files.pci 1.436 share/man/man4/ixg.4 1.13-1.14 share/man/man4/ixv.4 1.6-1.7 - Fix a problem that the RX path stalled when the mbuf cluster is exhausted. - Modify some parameters to reduce packet dropping. See also the manual's OPTIONS section for the detail. - ixv(4): The max number of queue(pair) is not 7 but 8. Correctly reset the hardware. - Add "TX " to "Queue No Descriptor Available" evcnt(9) name to make it more understandable. - Fix a bug that some advertise speeds can't be set with hw.ixgN.advertise_speed if both 2.5G and 5G are set. Fix the error message, too. - Fix typo in comment or debug message.diff -r1.12 -r1.12.4.1 src/share/man/man4/ixg.4
(martin)
--- src/share/man/man4/ixg.4 2018/05/09 08:01:16 1.12
+++ src/share/man/man4/ixg.4 2021/03/11 16:00:24 1.12.4.1
--- src/share/man/man4/ixv.4 2019/09/26 19:07:23 1.4.2.1
+++ src/share/man/man4/ixv.4 2021/03/11 16:00:24 1.4.2.2
--- src/sys/dev/pci/files.pci 2020/07/07 10:29:05 1.413.2.2
+++ src/sys/dev/pci/files.pci 2021/03/11 16:00:24 1.413.2.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: files.pci,v 1.413.2.2 2020/07/07 10:29:05 martin Exp $ | 1 | # $NetBSD: files.pci,v 1.413.2.3 2021/03/11 16:00:24 martin Exp $ | |
2 | # | 2 | # | |
3 | # Config file and device description for machine-independent PCI code. | 3 | # Config file and device description for machine-independent PCI code. | |
4 | # Included by ports that need it. Requires that the SCSI files be | 4 | # Included by ports that need it. Requires that the SCSI files be | |
5 | # defined first. | 5 | # defined first. | |
6 | 6 | |||
7 | defflag opt_pci.h PCIVERBOSE PCI_CONFIG_DUMP PCI_NETBSD_CONFIGURE | 7 | defflag opt_pci.h PCIVERBOSE PCI_CONFIG_DUMP PCI_NETBSD_CONFIGURE | |
8 | defparam opt_pci.h PCI_NETBSD_ENABLE_IDE | 8 | defparam opt_pci.h PCI_NETBSD_ENABLE_IDE | |
9 | 9 | |||
10 | defflag opt_bktr.h BKTR_430_FX_MODE BKTR_GPIO_ACCESS BKTR_NO_MSP_RESET | 10 | defflag opt_bktr.h BKTR_430_FX_MODE BKTR_GPIO_ACCESS BKTR_NO_MSP_RESET | |
11 | BKTR_REVERSE_MUTE BKTR_SIS_VIA_MODE BKTR_USE_PLL | 11 | BKTR_REVERSE_MUTE BKTR_SIS_VIA_MODE BKTR_USE_PLL | |
12 | defparam opt_bktr.h BKTR_OVERRIDE_CARD BKTR_OVERRIDE_TUNER BKTR_OVERRIDE_DBX | 12 | defparam opt_bktr.h BKTR_OVERRIDE_CARD BKTR_OVERRIDE_TUNER BKTR_OVERRIDE_DBX | |
13 | BKTR_OVERRIDE_MSP BKTR_SYSTEM_DEFAULT | 13 | BKTR_OVERRIDE_MSP BKTR_SYSTEM_DEFAULT | |
14 | 14 | |||
@@ -681,26 +681,27 @@ file dev/pci/ixgbe/ix_txrx.c ixg | ixv | @@ -681,26 +681,27 @@ file dev/pci/ixgbe/ix_txrx.c ixg | ixv | |||
681 | file dev/pci/ixgbe/ixgbe_netbsd.c ixg | ixv | 681 | file dev/pci/ixgbe/ixgbe_netbsd.c ixg | ixv | |
682 | file dev/pci/ixgbe/ixgbe_82598.c ixg | ixv | 682 | file dev/pci/ixgbe/ixgbe_82598.c ixg | ixv | |
683 | file dev/pci/ixgbe/ixgbe_82599.c ixg | ixv | 683 | file dev/pci/ixgbe/ixgbe_82599.c ixg | ixv | |
684 | file dev/pci/ixgbe/ixgbe_x540.c ixg | ixv | 684 | file dev/pci/ixgbe/ixgbe_x540.c ixg | ixv | |
685 | file dev/pci/ixgbe/ixgbe_x550.c ixg | ixv | 685 | file dev/pci/ixgbe/ixgbe_x550.c ixg | ixv | |
686 | file dev/pci/ixgbe/ixgbe_api.c ixg | ixv | 686 | file dev/pci/ixgbe/ixgbe_api.c ixg | ixv | |
687 | file dev/pci/ixgbe/ixgbe_common.c ixg | ixv | 687 | file dev/pci/ixgbe/ixgbe_common.c ixg | ixv | |
688 | file dev/pci/ixgbe/ixgbe_mbx.c ixg | ixv | 688 | file dev/pci/ixgbe/ixgbe_mbx.c ixg | ixv | |
689 | file dev/pci/ixgbe/ixgbe_osdep.c ixg | ixv | 689 | file dev/pci/ixgbe/ixgbe_osdep.c ixg | ixv | |
690 | file dev/pci/ixgbe/ixgbe_phy.c ixg | ixv | 690 | file dev/pci/ixgbe/ixgbe_phy.c ixg | ixv | |
691 | file dev/pci/ixgbe/ixgbe_vf.c ixg | ixv | 691 | file dev/pci/ixgbe/ixgbe_vf.c ixg | ixv | |
692 | file dev/pci/ixgbe/if_bypass.c ixg | ixv | 692 | file dev/pci/ixgbe/if_bypass.c ixg | ixv | |
693 | file dev/pci/ixgbe/if_fdir.c ixg | ixv | 693 | file dev/pci/ixgbe/if_fdir.c ixg | ixv | |
694 | defparam opt_ixgbe.h IXGBE_JCLNUM_MULTI | |||
694 | 695 | |||
695 | # This appears to be the driver for virtual instances of i82599. | 696 | # This appears to be the driver for virtual instances of i82599. | |
696 | device ixv: ether, ifnet, arp, mii, mii_phy | 697 | device ixv: ether, ifnet, arp, mii, mii_phy | |
697 | attach ixv at pci | 698 | attach ixv at pci | |
698 | file dev/pci/ixgbe/ixv.c ixv | 699 | file dev/pci/ixgbe/ixv.c ixv | |
699 | 700 | |||
700 | # Intel i8254x Gigabit Ethernet | 701 | # Intel i8254x Gigabit Ethernet | |
701 | device wm: ether, ifnet, arp, mii, mii_bitbang | 702 | device wm: ether, ifnet, arp, mii, mii_bitbang | |
702 | attach wm at pci | 703 | attach wm at pci | |
703 | file dev/pci/if_wm.c wm | 704 | file dev/pci/if_wm.c wm | |
704 | defflag opt_if_wm.h WM_EVENT_COUNTERS | 705 | defflag opt_if_wm.h WM_EVENT_COUNTERS | |
705 | defparam opt_if_wm.h WM_RX_PROCESS_LIMIT_DEFAULT | 706 | defparam opt_if_wm.h WM_RX_PROCESS_LIMIT_DEFAULT | |
706 | WM_RX_INTR_PROCESS_LIMIT_DEFAULT | 707 | WM_RX_INTR_PROCESS_LIMIT_DEFAULT |
--- src/sys/dev/pci/ixgbe/ix_txrx.c 2020/07/10 11:35:51 1.54.2.4
+++ src/sys/dev/pci/ixgbe/ix_txrx.c 2021/03/11 16:00:24 1.54.2.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ix_txrx.c,v 1.54.2.4 2020/07/10 11:35:51 martin Exp $ */ | 1 | /* $NetBSD: ix_txrx.c,v 1.54.2.5 2021/03/11 16:00:24 martin Exp $ */ | |
2 | 2 | |||
3 | /****************************************************************************** | 3 | /****************************************************************************** | |
4 | 4 | |||
5 | Copyright (c) 2001-2017, Intel Corporation | 5 | Copyright (c) 2001-2017, Intel Corporation | |
6 | All rights reserved. | 6 | All rights reserved. | |
7 | 7 | |||
8 | Redistribution and use in source and binary forms, with or without | 8 | Redistribution and use in source and binary forms, with or without | |
9 | modification, are permitted provided that the following conditions are met: | 9 | modification, are permitted provided that the following conditions are met: | |
10 | 10 | |||
11 | 1. Redistributions of source code must retain the above copyright notice, | 11 | 1. Redistributions of source code must retain the above copyright notice, | |
12 | this list of conditions and the following disclaimer. | 12 | this list of conditions and the following disclaimer. | |
13 | 13 | |||
14 | 2. Redistributions in binary form must reproduce the above copyright | 14 | 2. Redistributions in binary form must reproduce the above copyright | |
@@ -1316,26 +1316,31 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) | @@ -1316,26 +1316,31 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) | |||
1316 | (IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU))); | 1316 | (IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU))); | |
1317 | 1317 | |||
1318 | rxr->hw_rsc = TRUE; | 1318 | rxr->hw_rsc = TRUE; | |
1319 | } /* ixgbe_setup_hw_rsc */ | 1319 | } /* ixgbe_setup_hw_rsc */ | |
1320 | 1320 | |||
1321 | /************************************************************************ | 1321 | /************************************************************************ | |
1322 | * ixgbe_refresh_mbufs | 1322 | * ixgbe_refresh_mbufs | |
1323 | * | 1323 | * | |
1324 | * Refresh mbuf buffers for RX descriptor rings | 1324 | * Refresh mbuf buffers for RX descriptor rings | |
1325 | * - now keeps its own state so discards due to resource | 1325 | * - now keeps its own state so discards due to resource | |
1326 | * exhaustion are unnecessary, if an mbuf cannot be obtained | 1326 | * exhaustion are unnecessary, if an mbuf cannot be obtained | |
1327 | * it just returns, keeping its placeholder, thus it can simply | 1327 | * it just returns, keeping its placeholder, thus it can simply | |
1328 | * be recalled to try again. | 1328 | * be recalled to try again. | |
1329 | * | |||
1330 | * XXX NetBSD TODO: | |||
1331 | * - The ixgbe_rxeof() function always preallocates mbuf cluster (jcl), | |||
1332 | * so the ixgbe_refresh_mbufs() function can be simplified. | |||
1333 | * | |||
1329 | ************************************************************************/ | 1334 | ************************************************************************/ | |
1330 | static void | 1335 | static void | |
1331 | ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) | 1336 | ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) | |
1332 | { | 1337 | { | |
1333 | struct adapter *adapter = rxr->adapter; | 1338 | struct adapter *adapter = rxr->adapter; | |
1334 | struct ixgbe_rx_buf *rxbuf; | 1339 | struct ixgbe_rx_buf *rxbuf; | |
1335 | struct mbuf *mp; | 1340 | struct mbuf *mp; | |
1336 | int i, j, error; | 1341 | int i, j, error; | |
1337 | bool refreshed = false; | 1342 | bool refreshed = false; | |
1338 | 1343 | |||
1339 | i = j = rxr->next_to_refresh; | 1344 | i = j = rxr->next_to_refresh; | |
1340 | /* Control the loop with one beyond */ | 1345 | /* Control the loop with one beyond */ | |
1341 | if (++j == rxr->num_desc) | 1346 | if (++j == rxr->num_desc) | |
@@ -1505,27 +1510,27 @@ ixgbe_setup_receive_ring(struct rx_ring | @@ -1505,27 +1510,27 @@ ixgbe_setup_receive_ring(struct rx_ring | |||
1505 | /* Cache the size */ | 1510 | /* Cache the size */ | |
1506 | rxr->mbuf_sz = adapter->rx_mbuf_sz; | 1511 | rxr->mbuf_sz = adapter->rx_mbuf_sz; | |
1507 | 1512 | |||
1508 | /* Free current RX buffer structs and their mbufs */ | 1513 | /* Free current RX buffer structs and their mbufs */ | |
1509 | ixgbe_free_receive_ring(rxr); | 1514 | ixgbe_free_receive_ring(rxr); | |
1510 | 1515 | |||
1511 | IXGBE_RX_UNLOCK(rxr); | 1516 | IXGBE_RX_UNLOCK(rxr); | |
1512 | /* | 1517 | /* | |
1513 | * Now reinitialize our supply of jumbo mbufs. The number | 1518 | * Now reinitialize our supply of jumbo mbufs. The number | |
1514 | * or size of jumbo mbufs may have changed. | 1519 | * or size of jumbo mbufs may have changed. | |
1515 | * Assume all of rxr->ptag are the same. | 1520 | * Assume all of rxr->ptag are the same. | |
1516 | */ | 1521 | */ | |
1517 | ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr, | 1522 | ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr, | |
1518 | (2 * adapter->num_rx_desc), adapter->rx_mbuf_sz); | 1523 | adapter->num_jcl, adapter->rx_mbuf_sz); | |
1519 | 1524 | |||
1520 | IXGBE_RX_LOCK(rxr); | 1525 | IXGBE_RX_LOCK(rxr); | |
1521 | 1526 | |||
1522 | /* Now replenish the mbufs */ | 1527 | /* Now replenish the mbufs */ | |
1523 | for (int j = 0; j != rxr->num_desc; ++j) { | 1528 | for (int j = 0; j != rxr->num_desc; ++j) { | |
1524 | struct mbuf *mp; | 1529 | struct mbuf *mp; | |
1525 | 1530 | |||
1526 | rxbuf = &rxr->rx_buffers[j]; | 1531 | rxbuf = &rxr->rx_buffers[j]; | |
1527 | 1532 | |||
1528 | #ifdef DEV_NETMAP | 1533 | #ifdef DEV_NETMAP | |
1529 | /* | 1534 | /* | |
1530 | * In netmap mode, fill the map and set the buffer | 1535 | * In netmap mode, fill the map and set the buffer | |
1531 | * address in the NIC ring, considering the offset | 1536 | * address in the NIC ring, considering the offset | |
@@ -1802,87 +1807,126 @@ ixgbe_rx_discard(struct rx_ring *rxr, in | @@ -1802,87 +1807,126 @@ ixgbe_rx_discard(struct rx_ring *rxr, in | |||
1802 | bool | 1807 | bool | |
1803 | ixgbe_rxeof(struct ix_queue *que) | 1808 | ixgbe_rxeof(struct ix_queue *que) | |
1804 | { | 1809 | { | |
1805 | struct adapter *adapter = que->adapter; | 1810 | struct adapter *adapter = que->adapter; | |
1806 | struct rx_ring *rxr = que->rxr; | 1811 | struct rx_ring *rxr = que->rxr; | |
1807 | struct ifnet *ifp = adapter->ifp; | 1812 | struct ifnet *ifp = adapter->ifp; | |
1808 | #ifdef LRO | 1813 | #ifdef LRO | |
1809 | struct lro_ctrl *lro = &rxr->lro; | 1814 | struct lro_ctrl *lro = &rxr->lro; | |
1810 | #endif /* LRO */ | 1815 | #endif /* LRO */ | |
1811 | union ixgbe_adv_rx_desc *cur; | 1816 | union ixgbe_adv_rx_desc *cur; | |
1812 | struct ixgbe_rx_buf *rbuf, *nbuf; | 1817 | struct ixgbe_rx_buf *rbuf, *nbuf; | |
1813 | int i, nextp, processed = 0; | 1818 | int i, nextp, processed = 0; | |
1814 | u32 staterr = 0; | 1819 | u32 staterr = 0; | |
1815 | u32 count = adapter->rx_process_limit; | 1820 | u32 count = 0; | |
1821 | u32 limit = adapter->rx_process_limit; | |||
1822 | bool discard_multidesc = false; | |||
1816 | #ifdef RSS | 1823 | #ifdef RSS | |
1817 | u16 pkt_info; | 1824 | u16 pkt_info; | |
1818 | #endif | 1825 | #endif | |
1819 | 1826 | |||
1820 | IXGBE_RX_LOCK(rxr); | 1827 | IXGBE_RX_LOCK(rxr); | |
1821 | 1828 | |||
1822 | #ifdef DEV_NETMAP | 1829 | #ifdef DEV_NETMAP | |
1823 | if (adapter->feat_en & IXGBE_FEATURE_NETMAP) { | 1830 | if (adapter->feat_en & IXGBE_FEATURE_NETMAP) { | |
1824 | /* Same as the txeof routine: wakeup clients on intr. */ | 1831 | /* Same as the txeof routine: wakeup clients on intr. */ | |
1825 | if (netmap_rx_irq(ifp, rxr->me, &processed)) { | 1832 | if (netmap_rx_irq(ifp, rxr->me, &processed)) { | |
1826 | IXGBE_RX_UNLOCK(rxr); | 1833 | IXGBE_RX_UNLOCK(rxr); | |
1827 | return (FALSE); | 1834 | return (FALSE); | |
1828 | } | 1835 | } | |
1829 | } | 1836 | } | |
1830 | #endif /* DEV_NETMAP */ | 1837 | #endif /* DEV_NETMAP */ | |
1831 | 1838 | |||
1832 | for (i = rxr->next_to_check; count != 0;) { | 1839 | /* | |
1840 | * The max number of loop is rx_process_limit. If discard_multidesc is | |||
1841 | * true, continue processing to not to send broken packet to the upper | |||
1842 | * layer. | |||
1843 | */ | |||
1844 | for (i = rxr->next_to_check; | |||
1845 | (count < limit) || (discard_multidesc == true);) { | |||
1846 | ||||
1833 | struct mbuf *sendmp, *mp; | 1847 | struct mbuf *sendmp, *mp; | |
1848 | struct mbuf *newmp; | |||
1834 | u32 rsc, ptype; | 1849 | u32 rsc, ptype; | |
1835 | u16 len; | 1850 | u16 len; | |
1836 | u16 vtag = 0; | 1851 | u16 vtag = 0; | |
1837 | bool eop; | 1852 | bool eop; | |
1838 | 1853 | |||
1839 | /* Sync the ring. */ | 1854 | /* Sync the ring. */ | |
1840 | ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, | 1855 | ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, | |
1841 | BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | 1856 | BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | |
1842 | 1857 | |||
1843 | cur = &rxr->rx_base[i]; | 1858 | cur = &rxr->rx_base[i]; | |
1844 | staterr = le32toh(cur->wb.upper.status_error); | 1859 | staterr = le32toh(cur->wb.upper.status_error); | |
1845 | #ifdef RSS | 1860 | #ifdef RSS | |
1846 | pkt_info = le16toh(cur->wb.lower.lo_dword.hs_rss.pkt_info); | 1861 | pkt_info = le16toh(cur->wb.lower.lo_dword.hs_rss.pkt_info); | |
1847 | #endif | 1862 | #endif | |
1848 | 1863 | |||
1849 | if ((staterr & IXGBE_RXD_STAT_DD) == 0) | 1864 | if ((staterr & IXGBE_RXD_STAT_DD) == 0) | |
1850 | break; | 1865 | break; | |
1851 | 1866 | |||
1852 | count--; | 1867 | count++; | |
1853 | sendmp = NULL; | 1868 | sendmp = NULL; | |
1854 | nbuf = NULL; | 1869 | nbuf = NULL; | |
1855 | rsc = 0; | 1870 | rsc = 0; | |
1856 | cur->wb.upper.status_error = 0; | 1871 | cur->wb.upper.status_error = 0; | |
1857 | rbuf = &rxr->rx_buffers[i]; | 1872 | rbuf = &rxr->rx_buffers[i]; | |
1858 | mp = rbuf->buf; | 1873 | mp = rbuf->buf; | |
1859 | 1874 | |||
1860 | len = le16toh(cur->wb.upper.length); | 1875 | len = le16toh(cur->wb.upper.length); | |
1861 | ptype = le32toh(cur->wb.lower.lo_dword.data) & | 1876 | ptype = le32toh(cur->wb.lower.lo_dword.data) & | |
1862 | IXGBE_RXDADV_PKTTYPE_MASK; | 1877 | IXGBE_RXDADV_PKTTYPE_MASK; | |
1863 | eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); | 1878 | eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); | |
1864 | 1879 | |||
1865 | /* Make sure bad packets are discarded */ | 1880 | /* Make sure bad packets are discarded */ | |
1866 | if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { | 1881 | if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) { | |
1867 | #if __FreeBSD_version >= 1100036 | 1882 | #if __FreeBSD_version >= 1100036 | |
1868 | if (adapter->feat_en & IXGBE_FEATURE_VF) | 1883 | if (adapter->feat_en & IXGBE_FEATURE_VF) | |
1869 | if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); | 1884 | if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); | |
1870 | #endif | 1885 | #endif | |
1871 | rxr->rx_discarded.ev_count++; | 1886 | rxr->rx_discarded.ev_count++; | |
1872 | ixgbe_rx_discard(rxr, i); | 1887 | ixgbe_rx_discard(rxr, i); | |
1888 | discard_multidesc = false; | |||
1873 | goto next_desc; | 1889 | goto next_desc; | |
1874 | } | 1890 | } | |
1875 | 1891 | |||
1892 | /* pre-alloc new mbuf */ | |||
1893 | if (!discard_multidesc) | |||
1894 | newmp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, MT_DATA, | |||
1895 | M_PKTHDR, rxr->mbuf_sz); | |||
1896 | else | |||
1897 | newmp = NULL; | |||
1898 | if (newmp == NULL) { | |||
1899 | rxr->no_jmbuf.ev_count++; | |||
1900 | /* | |||
1901 | * Descriptor initialization is already done by the | |||
1902 | * above code (cur->wb.upper.status_error = 0). | |||
1903 | * So, we can reuse current rbuf->buf for new packet. | |||
1904 | * | |||
1905 | * Rewrite the buffer addr, see comment in | |||
1906 | * ixgbe_rx_discard(). | |||
1907 | */ | |||
1908 | cur->read.pkt_addr = rbuf->addr; | |||
1909 | m_freem(rbuf->fmp); | |||
1910 | rbuf->fmp = NULL; | |||
1911 | if (!eop) { | |||
1912 | /* Discard the entire packet. */ | |||
1913 | discard_multidesc = true; | |||
1914 | } else | |||
1915 | discard_multidesc = false; | |||
1916 | goto next_desc; | |||
1917 | } | |||
1918 | discard_multidesc = false; | |||
1919 | ||||
1876 | bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0, | 1920 | bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0, | |
1877 | rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD); | 1921 | rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD); | |
1878 | 1922 | |||
1879 | /* | 1923 | /* | |
1880 | * On 82599 which supports a hardware | 1924 | * On 82599 which supports a hardware | |
1881 | * LRO (called HW RSC), packets need | 1925 | * LRO (called HW RSC), packets need | |
1882 | * not be fragmented across sequential | 1926 | * not be fragmented across sequential | |
1883 | * descriptors, rather the next descriptor | 1927 | * descriptors, rather the next descriptor | |
1884 | * is indicated in bits of the descriptor. | 1928 | * is indicated in bits of the descriptor. | |
1885 | * This also means that we might proceses | 1929 | * This also means that we might proceses | |
1886 | * more than one packet at a time, something | 1930 | * more than one packet at a time, something | |
1887 | * that has never been true before, it | 1931 | * that has never been true before, it | |
1888 | * required eliminating global chain pointers | 1932 | * required eliminating global chain pointers | |
@@ -1911,49 +1955,53 @@ ixgbe_rxeof(struct ix_queue *que) | @@ -1911,49 +1955,53 @@ ixgbe_rxeof(struct ix_queue *que) | |||
1911 | /* | 1955 | /* | |
1912 | * Rather than using the fmp/lmp global pointers | 1956 | * Rather than using the fmp/lmp global pointers | |
1913 | * we now keep the head of a packet chain in the | 1957 | * we now keep the head of a packet chain in the | |
1914 | * buffer struct and pass this along from one | 1958 | * buffer struct and pass this along from one | |
1915 | * descriptor to the next, until we get EOP. | 1959 | * descriptor to the next, until we get EOP. | |
1916 | */ | 1960 | */ | |
1917 | mp->m_len = len; | 1961 | mp->m_len = len; | |
1918 | /* | 1962 | /* | |
1919 | * See if there is a stored head | 1963 | * See if there is a stored head | |
1920 | * that determines what we are | 1964 | * that determines what we are | |
1921 | */ | 1965 | */ | |
1922 | sendmp = rbuf->fmp; | 1966 | sendmp = rbuf->fmp; | |
1923 | if (sendmp != NULL) { /* secondary frag */ | 1967 | if (sendmp != NULL) { /* secondary frag */ | |
1924 | rbuf->buf = rbuf->fmp = NULL; | 1968 | rbuf->buf = newmp; | |
1969 | rbuf->fmp = NULL; | |||
1925 | mp->m_flags &= ~M_PKTHDR; | 1970 | mp->m_flags &= ~M_PKTHDR; | |
1926 | sendmp->m_pkthdr.len += mp->m_len; | 1971 | sendmp->m_pkthdr.len += mp->m_len; | |
1927 | } else { | 1972 | } else { | |
1928 | /* | 1973 | /* | |
1929 | * Optimize. This might be a small packet, | 1974 | * Optimize. This might be a small packet, | |
1930 | * maybe just a TCP ACK. Do a fast copy that | 1975 | * maybe just a TCP ACK. Do a fast copy that | |
1931 | * is cache aligned into a new mbuf, and | 1976 | * is cache aligned into a new mbuf, and | |
1932 | * leave the old mbuf+cluster for re-use. | 1977 | * leave the old mbuf+cluster for re-use. | |
1933 | */ | 1978 | */ | |
1934 | if (eop && len <= IXGBE_RX_COPY_LEN) { | 1979 | if (eop && len <= IXGBE_RX_COPY_LEN) { | |
1935 | sendmp = m_gethdr(M_NOWAIT, MT_DATA); | 1980 | sendmp = m_gethdr(M_NOWAIT, MT_DATA); | |
1936 | if (sendmp != NULL) { | 1981 | if (sendmp != NULL) { | |
1937 | sendmp->m_data += IXGBE_RX_COPY_ALIGN; | 1982 | sendmp->m_data += IXGBE_RX_COPY_ALIGN; | |
1938 | ixgbe_bcopy(mp->m_data, sendmp->m_data, | 1983 | ixgbe_bcopy(mp->m_data, sendmp->m_data, | |
1939 | len); | 1984 | len); | |
1940 | sendmp->m_len = len; | 1985 | sendmp->m_len = len; | |
1941 | rxr->rx_copies.ev_count++; | 1986 | rxr->rx_copies.ev_count++; | |
1942 | rbuf->flags |= IXGBE_RX_COPY; | 1987 | rbuf->flags |= IXGBE_RX_COPY; | |
1988 | ||||
1989 | m_freem(newmp); | |||
1943 | } | 1990 | } | |
1944 | } | 1991 | } | |
1945 | if (sendmp == NULL) { | 1992 | if (sendmp == NULL) { | |
1946 | rbuf->buf = rbuf->fmp = NULL; | 1993 | rbuf->buf = newmp; | |
1994 | rbuf->fmp = NULL; | |||
1947 | sendmp = mp; | 1995 | sendmp = mp; | |
1948 | } | 1996 | } | |
1949 | 1997 | |||
1950 | /* first desc of a non-ps chain */ | 1998 | /* first desc of a non-ps chain */ | |
1951 | sendmp->m_flags |= M_PKTHDR; | 1999 | sendmp->m_flags |= M_PKTHDR; | |
1952 | sendmp->m_pkthdr.len = mp->m_len; | 2000 | sendmp->m_pkthdr.len = mp->m_len; | |
1953 | } | 2001 | } | |
1954 | ++processed; | 2002 | ++processed; | |
1955 | 2003 | |||
1956 | /* Pass the head pointer on */ | 2004 | /* Pass the head pointer on */ | |
1957 | if (eop == 0) { | 2005 | if (eop == 0) { | |
1958 | nbuf->fmp = sendmp; | 2006 | nbuf->fmp = sendmp; | |
1959 | sendmp = NULL; | 2007 | sendmp = NULL; |
--- src/sys/dev/pci/ixgbe/ixgbe.c 2020/09/02 12:34:55 1.199.2.12
+++ src/sys/dev/pci/ixgbe/ixgbe.c 2021/03/11 16:00:24 1.199.2.13
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ixgbe.c,v 1.199.2.12 2020/09/02 12:34:55 martin Exp $ */ | 1 | /* $NetBSD: ixgbe.c,v 1.199.2.13 2021/03/11 16:00:24 martin Exp $ */ | |
2 | 2 | |||
3 | /****************************************************************************** | 3 | /****************************************************************************** | |
4 | 4 | |||
5 | Copyright (c) 2001-2017, Intel Corporation | 5 | Copyright (c) 2001-2017, Intel Corporation | |
6 | All rights reserved. | 6 | All rights reserved. | |
7 | 7 | |||
8 | Redistribution and use in source and binary forms, with or without | 8 | Redistribution and use in source and binary forms, with or without | |
9 | modification, are permitted provided that the following conditions are met: | 9 | modification, are permitted provided that the following conditions are met: | |
10 | 10 | |||
11 | 1. Redistributions of source code must retain the above copyright notice, | 11 | 1. Redistributions of source code must retain the above copyright notice, | |
12 | this list of conditions and the following disclaimer. | 12 | this list of conditions and the following disclaimer. | |
13 | 13 | |||
14 | 2. Redistributions in binary form must reproduce the above copyright | 14 | 2. Redistributions in binary form must reproduce the above copyright | |
@@ -57,26 +57,27 @@ | @@ -57,26 +57,27 @@ | |||
57 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 57 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
58 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 58 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
59 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 59 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
60 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 60 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
61 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 61 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
62 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 62 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
63 | * POSSIBILITY OF SUCH DAMAGE. | 63 | * POSSIBILITY OF SUCH DAMAGE. | |
64 | */ | 64 | */ | |
65 | 65 | |||
66 | #ifdef _KERNEL_OPT | 66 | #ifdef _KERNEL_OPT | |
67 | #include "opt_inet.h" | 67 | #include "opt_inet.h" | |
68 | #include "opt_inet6.h" | 68 | #include "opt_inet6.h" | |
69 | #include "opt_net_mpsafe.h" | 69 | #include "opt_net_mpsafe.h" | |
70 | #include "opt_ixgbe.h" | |||
70 | #endif | 71 | #endif | |
71 | 72 | |||
72 | #include "ixgbe.h" | 73 | #include "ixgbe.h" | |
73 | #include "ixgbe_sriov.h" | 74 | #include "ixgbe_sriov.h" | |
74 | #include "vlan.h" | 75 | #include "vlan.h" | |
75 | 76 | |||
76 | #include <sys/cprng.h> | 77 | #include <sys/cprng.h> | |
77 | #include <dev/mii/mii.h> | 78 | #include <dev/mii/mii.h> | |
78 | #include <dev/mii/miivar.h> | 79 | #include <dev/mii/miivar.h> | |
79 | 80 | |||
80 | /************************************************************************ | 81 | /************************************************************************ | |
81 | * Driver version | 82 | * Driver version | |
82 | ************************************************************************/ | 83 | ************************************************************************/ | |
@@ -933,26 +934,28 @@ ixgbe_attach(device_t parent, device_t d | @@ -933,26 +934,28 @@ ixgbe_attach(device_t parent, device_t d | |||
933 | ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) { | 934 | ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) { | |
934 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | 935 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | |
935 | adapter->num_tx_desc = DEFAULT_TXD; | 936 | adapter->num_tx_desc = DEFAULT_TXD; | |
936 | } else | 937 | } else | |
937 | adapter->num_tx_desc = ixgbe_txd; | 938 | adapter->num_tx_desc = ixgbe_txd; | |
938 | 939 | |||
939 | if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | 940 | if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | |
940 | ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) { | 941 | ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) { | |
941 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | 942 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | |
942 | adapter->num_rx_desc = DEFAULT_RXD; | 943 | adapter->num_rx_desc = DEFAULT_RXD; | |
943 | } else | 944 | } else | |
944 | adapter->num_rx_desc = ixgbe_rxd; | 945 | adapter->num_rx_desc = ixgbe_rxd; | |
945 | 946 | |||
947 | adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; | |||
948 | ||||
946 | /* Allocate our TX/RX Queues */ | 949 | /* Allocate our TX/RX Queues */ | |
947 | if (ixgbe_allocate_queues(adapter)) { | 950 | if (ixgbe_allocate_queues(adapter)) { | |
948 | error = ENOMEM; | 951 | error = ENOMEM; | |
949 | goto err_out; | 952 | goto err_out; | |
950 | } | 953 | } | |
951 | 954 | |||
952 | hw->phy.reset_if_overtemp = TRUE; | 955 | hw->phy.reset_if_overtemp = TRUE; | |
953 | error = ixgbe_reset_hw(hw); | 956 | error = ixgbe_reset_hw(hw); | |
954 | hw->phy.reset_if_overtemp = FALSE; | 957 | hw->phy.reset_if_overtemp = FALSE; | |
955 | if (error == IXGBE_ERR_SFP_NOT_PRESENT) { | 958 | if (error == IXGBE_ERR_SFP_NOT_PRESENT) { | |
956 | /* | 959 | /* | |
957 | * No optics in this port, set up | 960 | * No optics in this port, set up | |
958 | * so the timer routine will probe | 961 | * so the timer routine will probe | |
@@ -1844,27 +1847,27 @@ ixgbe_add_hw_stats(struct adapter *adapt | @@ -1844,27 +1847,27 @@ ixgbe_add_hw_stats(struct adapter *adapt | |||
1844 | break; | 1847 | break; | |
1845 | 1848 | |||
1846 | evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR, | 1849 | evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR, | |
1847 | NULL, adapter->queues[i].evnamebuf, "IRQs on queue"); | 1850 | NULL, adapter->queues[i].evnamebuf, "IRQs on queue"); | |
1848 | evcnt_attach_dynamic(&adapter->queues[i].handleq, | 1851 | evcnt_attach_dynamic(&adapter->queues[i].handleq, | |
1849 | EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, | 1852 | EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, | |
1850 | "Handled queue in softint"); | 1853 | "Handled queue in softint"); | |
1851 | evcnt_attach_dynamic(&adapter->queues[i].req, EVCNT_TYPE_MISC, | 1854 | evcnt_attach_dynamic(&adapter->queues[i].req, EVCNT_TYPE_MISC, | |
1852 | NULL, adapter->queues[i].evnamebuf, "Requeued in softint"); | 1855 | NULL, adapter->queues[i].evnamebuf, "Requeued in softint"); | |
1853 | evcnt_attach_dynamic(&txr->tso_tx, EVCNT_TYPE_MISC, | 1856 | evcnt_attach_dynamic(&txr->tso_tx, EVCNT_TYPE_MISC, | |
1854 | NULL, adapter->queues[i].evnamebuf, "TSO"); | 1857 | NULL, adapter->queues[i].evnamebuf, "TSO"); | |
1855 | evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, | 1858 | evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, | |
1856 | NULL, adapter->queues[i].evnamebuf, | 1859 | NULL, adapter->queues[i].evnamebuf, | |
1857 | "Queue No Descriptor Available"); | 1860 | "TX Queue No Descriptor Available"); | |
1858 | evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, | 1861 | evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, | |
1859 | NULL, adapter->queues[i].evnamebuf, | 1862 | NULL, adapter->queues[i].evnamebuf, | |
1860 | "Queue Packets Transmitted"); | 1863 | "Queue Packets Transmitted"); | |
1861 | #ifndef IXGBE_LEGACY_TX | 1864 | #ifndef IXGBE_LEGACY_TX | |
1862 | evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, | 1865 | evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, | |
1863 | NULL, adapter->queues[i].evnamebuf, | 1866 | NULL, adapter->queues[i].evnamebuf, | |
1864 | "Packets dropped in pcq"); | 1867 | "Packets dropped in pcq"); | |
1865 | #endif | 1868 | #endif | |
1866 | 1869 | |||
1867 | if (sysctl_createv(log, 0, &rnode, &cnode, | 1870 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
1868 | CTLFLAG_READONLY, | 1871 | CTLFLAG_READONLY, | |
1869 | CTLTYPE_INT, | 1872 | CTLTYPE_INT, | |
1870 | "rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"), | 1873 | "rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"), | |
@@ -3288,26 +3291,33 @@ ixgbe_add_device_sysctls(struct adapter | @@ -3288,26 +3291,33 @@ ixgbe_add_device_sysctls(struct adapter | |||
3288 | if (sysctl_createv(log, 0, &rnode, &cnode, | 3291 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
3289 | CTLFLAG_READWRITE, CTLTYPE_INT, | 3292 | CTLFLAG_READWRITE, CTLTYPE_INT, | |
3290 | "debug", SYSCTL_DESCR("Debug Info"), | 3293 | "debug", SYSCTL_DESCR("Debug Info"), | |
3291 | ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | 3294 | ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | |
3292 | aprint_error_dev(dev, "could not create sysctl\n"); | 3295 | aprint_error_dev(dev, "could not create sysctl\n"); | |
3293 | 3296 | |||
3294 | if (sysctl_createv(log, 0, &rnode, &cnode, | 3297 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
3295 | CTLFLAG_READONLY, CTLTYPE_INT, | 3298 | CTLFLAG_READONLY, CTLTYPE_INT, | |
3296 | "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"), | 3299 | "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"), | |
3297 | NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0) | 3300 | NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0) | |
3298 | aprint_error_dev(dev, "could not create sysctl\n"); | 3301 | aprint_error_dev(dev, "could not create sysctl\n"); | |
3299 | 3302 | |||
3300 | if (sysctl_createv(log, 0, &rnode, &cnode, | 3303 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
3304 | CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", | |||
3305 | SYSCTL_DESCR("Number of jumbo buffers per queue"), | |||
3306 | NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, | |||
3307 | CTL_EOL) != 0) | |||
3308 | aprint_error_dev(dev, "could not create sysctl\n"); | |||
3309 | ||||
3310 | if (sysctl_createv(log, 0, &rnode, &cnode, | |||
3301 | CTLFLAG_READONLY, CTLTYPE_INT, | 3311 | CTLFLAG_READONLY, CTLTYPE_INT, | |
3302 | "num_queues", SYSCTL_DESCR("Number of queues"), | 3312 | "num_queues", SYSCTL_DESCR("Number of queues"), | |
3303 | NULL, 0, &adapter->num_queues, 0, CTL_CREATE, CTL_EOL) != 0) | 3313 | NULL, 0, &adapter->num_queues, 0, CTL_CREATE, CTL_EOL) != 0) | |
3304 | aprint_error_dev(dev, "could not create sysctl\n"); | 3314 | aprint_error_dev(dev, "could not create sysctl\n"); | |
3305 | 3315 | |||
3306 | /* Sysctls for all devices */ | 3316 | /* Sysctls for all devices */ | |
3307 | if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, | 3317 | if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, | |
3308 | CTLTYPE_INT, "fc", SYSCTL_DESCR(IXGBE_SYSCTL_DESC_SET_FC), | 3318 | CTLTYPE_INT, "fc", SYSCTL_DESCR(IXGBE_SYSCTL_DESC_SET_FC), | |
3309 | ixgbe_sysctl_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, | 3319 | ixgbe_sysctl_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, | |
3310 | CTL_EOL) != 0) | 3320 | CTL_EOL) != 0) | |
3311 | aprint_error_dev(dev, "could not create sysctl\n"); | 3321 | aprint_error_dev(dev, "could not create sysctl\n"); | |
3312 | 3322 | |||
3313 | adapter->enable_aim = ixgbe_enable_aim; | 3323 | adapter->enable_aim = ixgbe_enable_aim; | |
@@ -5372,29 +5382,29 @@ ixgbe_set_advertise(struct adapter *adap | @@ -5372,29 +5382,29 @@ ixgbe_set_advertise(struct adapter *adap | |||
5372 | 5382 | |||
5373 | /* No speed changes for backplane media */ | 5383 | /* No speed changes for backplane media */ | |
5374 | if (hw->phy.media_type == ixgbe_media_type_backplane) | 5384 | if (hw->phy.media_type == ixgbe_media_type_backplane) | |
5375 | return (ENODEV); | 5385 | return (ENODEV); | |
5376 | 5386 | |||
5377 | if (!((hw->phy.media_type == ixgbe_media_type_copper) || | 5387 | if (!((hw->phy.media_type == ixgbe_media_type_copper) || | |
5378 | (hw->phy.multispeed_fiber))) { | 5388 | (hw->phy.multispeed_fiber))) { | |
5379 | device_printf(dev, | 5389 | device_printf(dev, | |
5380 | "Advertised speed can only be set on copper or " | 5390 | "Advertised speed can only be set on copper or " | |
5381 | "multispeed fiber media types.\n"); | 5391 | "multispeed fiber media types.\n"); | |
5382 | return (EINVAL); | 5392 | return (EINVAL); | |
5383 | } | 5393 | } | |
5384 | 5394 | |||
5385 | if (advertise < 0x0 || advertise > 0x2f) { | 5395 | if (advertise < 0x0 || advertise > 0x3f) { | |
5386 | device_printf(dev, | 5396 | device_printf(dev, | |
5387 | "Invalid advertised speed; valid modes are 0x0 through 0x7\n"); | 5397 | "Invalid advertised speed; valid modes are 0x0 through 0x3f\n"); | |
5388 | return (EINVAL); | 5398 | return (EINVAL); | |
5389 | } | 5399 | } | |
5390 | 5400 | |||
5391 | if (hw->mac.ops.get_link_capabilities) { | 5401 | if (hw->mac.ops.get_link_capabilities) { | |
5392 | err = hw->mac.ops.get_link_capabilities(hw, &link_caps, | 5402 | err = hw->mac.ops.get_link_capabilities(hw, &link_caps, | |
5393 | &negotiate); | 5403 | &negotiate); | |
5394 | if (err != IXGBE_SUCCESS) { | 5404 | if (err != IXGBE_SUCCESS) { | |
5395 | device_printf(dev, "Unable to determine supported advertise speeds\n"); | 5405 | device_printf(dev, "Unable to determine supported advertise speeds\n"); | |
5396 | return (ENODEV); | 5406 | return (ENODEV); | |
5397 | } | 5407 | } | |
5398 | } | 5408 | } | |
5399 | 5409 | |||
5400 | /* Set new value and report new advertised mode */ | 5410 | /* Set new value and report new advertised mode */ |
--- src/sys/dev/pci/ixgbe/ixgbe.h 2020/07/10 11:35:51 1.56.2.3
+++ src/sys/dev/pci/ixgbe/ixgbe.h 2021/03/11 16:00:24 1.56.2.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ixgbe.h,v 1.56.2.3 2020/07/10 11:35:51 martin Exp $ */ | 1 | /* $NetBSD: ixgbe.h,v 1.56.2.4 2021/03/11 16:00:24 martin Exp $ */ | |
2 | 2 | |||
3 | /****************************************************************************** | 3 | /****************************************************************************** | |
4 | SPDX-License-Identifier: BSD-3-Clause | 4 | SPDX-License-Identifier: BSD-3-Clause | |
5 | 5 | |||
6 | Copyright (c) 2001-2017, Intel Corporation | 6 | Copyright (c) 2001-2017, Intel Corporation | |
7 | All rights reserved. | 7 | All rights reserved. | |
8 | 8 | |||
9 | Redistribution and use in source and binary forms, with or without | 9 | Redistribution and use in source and binary forms, with or without | |
10 | modification, are permitted provided that the following conditions are met: | 10 | modification, are permitted provided that the following conditions are met: | |
11 | 11 | |||
12 | 1. Redistributions of source code must retain the above copyright notice, | 12 | 1. Redistributions of source code must retain the above copyright notice, | |
13 | this list of conditions and the following disclaimer. | 13 | this list of conditions and the following disclaimer. | |
14 | 14 | |||
@@ -206,27 +206,27 @@ | @@ -206,27 +206,27 @@ | |||
206 | #define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) | 206 | #define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B) | |
207 | #define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") | 207 | #define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n") | |
208 | #define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) | 208 | #define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) | |
209 | #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) | 209 | #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) | |
210 | 210 | |||
211 | #define MAX_NUM_MULTICAST_ADDRESSES 128 | 211 | #define MAX_NUM_MULTICAST_ADDRESSES 128 | |
212 | #define IXGBE_82598_SCATTER 100 | 212 | #define IXGBE_82598_SCATTER 100 | |
213 | #define IXGBE_82599_SCATTER 32 | 213 | #define IXGBE_82599_SCATTER 32 | |
214 | #define MSIX_82598_BAR 3 | 214 | #define MSIX_82598_BAR 3 | |
215 | #define MSIX_82599_BAR 4 | 215 | #define MSIX_82599_BAR 4 | |
216 | #define IXGBE_TSO_SIZE 262140 | 216 | #define IXGBE_TSO_SIZE 262140 | |
217 | #define IXGBE_RX_HDR 128 | 217 | #define IXGBE_RX_HDR 128 | |
218 | #define IXGBE_VFTA_SIZE 128 | 218 | #define IXGBE_VFTA_SIZE 128 | |
219 | #define IXGBE_BR_SIZE 4096 | 219 | #define IXGBE_BR_SIZE 2048 | |
220 | #define IXGBE_QUEUE_MIN_FREE 32 | 220 | #define IXGBE_QUEUE_MIN_FREE 32 | |
221 | #define IXGBE_MAX_TX_BUSY 10 | 221 | #define IXGBE_MAX_TX_BUSY 10 | |
222 | #define IXGBE_QUEUE_HUNG 0x80000000 | 222 | #define IXGBE_QUEUE_HUNG 0x80000000 | |
223 | 223 | |||
224 | #define IXGBE_EITR_DEFAULT 128 | 224 | #define IXGBE_EITR_DEFAULT 128 | |
225 | 225 | |||
226 | /* IOCTL define to gather SFP+ Diagnostic data */ | 226 | /* IOCTL define to gather SFP+ Diagnostic data */ | |
227 | #define SIOCGI2C SIOCGIFGENERIC | 227 | #define SIOCGI2C SIOCGIFGENERIC | |
228 | 228 | |||
229 | /* Offload bits in mbuf flag */ | 229 | /* Offload bits in mbuf flag */ | |
230 | #define M_CSUM_OFFLOAD \ | 230 | #define M_CSUM_OFFLOAD \ | |
231 | (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4|M_CSUM_UDPv6|M_CSUM_TCPv6) | 231 | (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4|M_CSUM_UDPv6|M_CSUM_TCPv6) | |
232 | 232 | |||
@@ -550,26 +550,27 @@ struct adapter { | @@ -550,26 +550,27 @@ struct adapter { | |||
550 | */ | 550 | */ | |
551 | struct tx_ring *tx_rings; | 551 | struct tx_ring *tx_rings; | |
552 | u32 num_tx_desc; | 552 | u32 num_tx_desc; | |
553 | u32 tx_process_limit; | 553 | u32 tx_process_limit; | |
554 | 554 | |||
555 | /* | 555 | /* | |
556 | * Receive rings | 556 | * Receive rings | |
557 | * Allocated at run time, an array of rings | 557 | * Allocated at run time, an array of rings | |
558 | */ | 558 | */ | |
559 | struct rx_ring *rx_rings; | 559 | struct rx_ring *rx_rings; | |
560 | u64 active_queues; | 560 | u64 active_queues; | |
561 | u32 num_rx_desc; | 561 | u32 num_rx_desc; | |
562 | u32 rx_process_limit; | 562 | u32 rx_process_limit; | |
563 | int num_jcl; | |||
563 | 564 | |||
564 | /* Multicast array memory */ | 565 | /* Multicast array memory */ | |
565 | struct ixgbe_mc_addr *mta; | 566 | struct ixgbe_mc_addr *mta; | |
566 | 567 | |||
567 | /* SR-IOV */ | 568 | /* SR-IOV */ | |
568 | int iov_mode; | 569 | int iov_mode; | |
569 | int num_vfs; | 570 | int num_vfs; | |
570 | int pool; | 571 | int pool; | |
571 | struct ixgbe_vf *vfs; | 572 | struct ixgbe_vf *vfs; | |
572 | 573 | |||
573 | /* Bypass */ | 574 | /* Bypass */ | |
574 | struct ixgbe_bp_data bypass; | 575 | struct ixgbe_bp_data bypass; | |
575 | 576 |
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.h 2019/03/05 08:25:02 1.11
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.h 2021/03/11 16:00:24 1.11.4.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /*$NetBSD: ixgbe_netbsd.h,v 1.11 2019/03/05 08:25:02 msaitoh Exp $*/ | 1 | /*$NetBSD: ixgbe_netbsd.h,v 1.11.4.1 2021/03/11 16:00:24 martin Exp $*/ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 2011 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by Coyote Point Systems, Inc. | 7 | * by Coyote Point Systems, Inc. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -30,26 +30,40 @@ | @@ -30,26 +30,40 @@ | |||
30 | 30 | |||
31 | #ifndef _IXGBE_NETBSD_H | 31 | #ifndef _IXGBE_NETBSD_H | |
32 | #define _IXGBE_NETBSD_H | 32 | #define _IXGBE_NETBSD_H | |
33 | 33 | |||
34 | #if 0 /* Enable this if you don't want to use TX multiqueue function */ | 34 | #if 0 /* Enable this if you don't want to use TX multiqueue function */ | |
35 | #define IXGBE_LEGACY_TX 1 | 35 | #define IXGBE_LEGACY_TX 1 | |
36 | #endif | 36 | #endif | |
37 | 37 | |||
38 | #define ETHERCAP_VLAN_HWCSUM 0 | 38 | #define ETHERCAP_VLAN_HWCSUM 0 | |
39 | #define MJUM9BYTES (9 * 1024) | 39 | #define MJUM9BYTES (9 * 1024) | |
40 | #define MJUM16BYTES (16 * 1024) | 40 | #define MJUM16BYTES (16 * 1024) | |
41 | #define MJUMPAGESIZE PAGE_SIZE | 41 | #define MJUMPAGESIZE PAGE_SIZE | |
42 | 42 | |||
43 | /* | |||
44 | * Number of jcl per queue is calculated by | |||
45 | * adapter->num_rx_desc * IXGBE_JCLNUM_MULTI. The lower limit is 2. | |||
46 | */ | |||
47 | #define IXGBE_JCLNUM_MULTI_LOWLIM 2 | |||
48 | #define IXGBE_JCLNUM_MULTI_DEFAULT 3 | |||
49 | #if !defined(IXGBE_JCLNUM_MULTI) | |||
50 | # define IXGBE_JCLNUM_MULTI IXGBE_JCLNUM_MULTI_DEFAULT | |||
51 | #else | |||
52 | # if (IXGBE_JCLNUM_MULTI < IXGBE_JCLNUM_MULTI_LOWLIM) | |||
53 | # error IXGBE_JCLNUM_MULTI is too low. | |||
54 | # endif | |||
55 | #endif | |||
56 | ||||
43 | #define IFCAP_RXCSUM \ | 57 | #define IFCAP_RXCSUM \ | |
44 | (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|\ | 58 | (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|\ | |
45 | IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx) | 59 | IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx) | |
46 | 60 | |||
47 | #define IFCAP_TXCSUM \ | 61 | #define IFCAP_TXCSUM \ | |
48 | (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx|\ | 62 | (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx|\ | |
49 | IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_UDPv6_Tx) | 63 | IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_UDPv6_Tx) | |
50 | 64 | |||
51 | #define IFCAP_HWCSUM (IFCAP_RXCSUM|IFCAP_TXCSUM) | 65 | #define IFCAP_HWCSUM (IFCAP_RXCSUM|IFCAP_TXCSUM) | |
52 | 66 | |||
53 | struct ixgbe_dma_tag { | 67 | struct ixgbe_dma_tag { | |
54 | bus_dma_tag_t dt_dmat; | 68 | bus_dma_tag_t dt_dmat; | |
55 | bus_size_t dt_alignment; | 69 | bus_size_t dt_alignment; |
--- src/sys/dev/pci/ixgbe/ixgbe_vf.c 2020/07/10 11:35:51 1.18.2.2
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.c 2021/03/11 16:00:24 1.18.2.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ixgbe_vf.c,v 1.18.2.2 2020/07/10 11:35:51 martin Exp $ */ | 1 | /* $NetBSD: ixgbe_vf.c,v 1.18.2.3 2021/03/11 16:00:24 martin Exp $ */ | |
2 | 2 | |||
3 | /****************************************************************************** | 3 | /****************************************************************************** | |
4 | SPDX-License-Identifier: BSD-3-Clause | 4 | SPDX-License-Identifier: BSD-3-Clause | |
5 | 5 | |||
6 | Copyright (c) 2001-2017, Intel Corporation | 6 | Copyright (c) 2001-2017, Intel Corporation | |
7 | All rights reserved. | 7 | All rights reserved. | |
8 | 8 | |||
9 | Redistribution and use in source and binary forms, with or without | 9 | Redistribution and use in source and binary forms, with or without | |
10 | modification, are permitted provided that the following conditions are met: | 10 | modification, are permitted provided that the following conditions are met: | |
11 | 11 | |||
12 | 1. Redistributions of source code must retain the above copyright notice, | 12 | 1. Redistributions of source code must retain the above copyright notice, | |
13 | this list of conditions and the following disclaimer. | 13 | this list of conditions and the following disclaimer. | |
14 | 14 | |||
@@ -111,27 +111,28 @@ static void ixgbe_virt_clr_reg(struct ix | @@ -111,27 +111,28 @@ static void ixgbe_virt_clr_reg(struct ix | |||
111 | 111 | |||
112 | /* DCA_RXCTRL default value */ | 112 | /* DCA_RXCTRL default value */ | |
113 | vfdca_rxctrl = IXGBE_DCA_RXCTRL_DESC_RRO_EN | | 113 | vfdca_rxctrl = IXGBE_DCA_RXCTRL_DESC_RRO_EN | | |
114 | IXGBE_DCA_RXCTRL_DATA_WRO_EN | | 114 | IXGBE_DCA_RXCTRL_DATA_WRO_EN | | |
115 | IXGBE_DCA_RXCTRL_HEAD_WRO_EN; | 115 | IXGBE_DCA_RXCTRL_HEAD_WRO_EN; | |
116 | 116 | |||
117 | /* DCA_TXCTRL default value */ | 117 | /* DCA_TXCTRL default value */ | |
118 | vfdca_txctrl = IXGBE_DCA_TXCTRL_DESC_RRO_EN | | 118 | vfdca_txctrl = IXGBE_DCA_TXCTRL_DESC_RRO_EN | | |
119 | IXGBE_DCA_TXCTRL_DESC_WRO_EN | | 119 | IXGBE_DCA_TXCTRL_DESC_WRO_EN | | |
120 | IXGBE_DCA_TXCTRL_DATA_RRO_EN; | 120 | IXGBE_DCA_TXCTRL_DATA_RRO_EN; | |
121 | 121 | |||
122 | IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0); | 122 | IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0); | |
123 | 123 | |||
124 | for (i = 0; i < 7; i++) { | 124 | KASSERT(IXGBE_VF_MAX_TX_QUEUES == IXGBE_VF_MAX_RX_QUEUES); | |
125 | for (i = 0; i < IXGBE_VF_MAX_TX_QUEUES; i++) { | |||
125 | IXGBE_WRITE_REG(hw, IXGBE_VFRDH(i), 0); | 126 | IXGBE_WRITE_REG(hw, IXGBE_VFRDH(i), 0); | |
126 | IXGBE_WRITE_REG(hw, IXGBE_VFRDT(i), 0); | 127 | IXGBE_WRITE_REG(hw, IXGBE_VFRDT(i), 0); | |
127 | IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), 0); | 128 | IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), 0); | |
128 | IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(i), vfsrrctl); | 129 | IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(i), vfsrrctl); | |
129 | IXGBE_WRITE_REG(hw, IXGBE_VFTDH(i), 0); | 130 | IXGBE_WRITE_REG(hw, IXGBE_VFTDH(i), 0); | |
130 | IXGBE_WRITE_REG(hw, IXGBE_VFTDT(i), 0); | 131 | IXGBE_WRITE_REG(hw, IXGBE_VFTDT(i), 0); | |
131 | IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(i), 0); | 132 | IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(i), 0); | |
132 | IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAH(i), 0); | 133 | IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAH(i), 0); | |
133 | IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAL(i), 0); | 134 | IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAL(i), 0); | |
134 | IXGBE_WRITE_REG(hw, IXGBE_VFDCA_RXCTRL(i), vfdca_rxctrl); | 135 | IXGBE_WRITE_REG(hw, IXGBE_VFDCA_RXCTRL(i), vfdca_rxctrl); | |
135 | IXGBE_WRITE_REG(hw, IXGBE_VFDCA_TXCTRL(i), vfdca_txctrl); | 136 | IXGBE_WRITE_REG(hw, IXGBE_VFDCA_TXCTRL(i), vfdca_txctrl); | |
136 | } | 137 | } | |
137 | 138 | |||
@@ -165,27 +166,27 @@ s32 ixgbe_start_hw_vf(struct ixgbe_hw *h | @@ -165,27 +166,27 @@ s32 ixgbe_start_hw_vf(struct ixgbe_hw *h | |||
165 | s32 ixgbe_init_hw_vf(struct ixgbe_hw *hw) | 166 | s32 ixgbe_init_hw_vf(struct ixgbe_hw *hw) | |
166 | { | 167 | { | |
167 | s32 status = hw->mac.ops.start_hw(hw); | 168 | s32 status = hw->mac.ops.start_hw(hw); | |
168 | 169 | |||
169 | hw->mac.ops.get_mac_addr(hw, hw->mac.addr); | 170 | hw->mac.ops.get_mac_addr(hw, hw->mac.addr); | |
170 | 171 | |||
171 | return status; | 172 | return status; | |
172 | } | 173 | } | |
173 | 174 | |||
174 | /** | 175 | /** | |
175 | * ixgbe_reset_hw_vf - Performs hardware reset | 176 | * ixgbe_reset_hw_vf - Performs hardware reset | |
176 | * @hw: pointer to hardware structure | 177 | * @hw: pointer to hardware structure | |
177 | * | 178 | * | |
178 | * Resets the hardware by reseting the transmit and receive units, masks and | 179 | * Resets the hardware by resetting the transmit and receive units, masks and | |
179 | * clears all interrupts. | 180 | * clears all interrupts. | |
180 | **/ | 181 | **/ | |
181 | s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw) | 182 | s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw) | |
182 | { | 183 | { | |
183 | struct ixgbe_mbx_info *mbx = &hw->mbx; | 184 | struct ixgbe_mbx_info *mbx = &hw->mbx; | |
184 | u32 timeout = IXGBE_VF_INIT_TIMEOUT; | 185 | u32 timeout = IXGBE_VF_INIT_TIMEOUT; | |
185 | s32 ret_val = IXGBE_ERR_INVALID_MAC_ADDR; | 186 | s32 ret_val = IXGBE_ERR_INVALID_MAC_ADDR; | |
186 | u32 msgbuf[IXGBE_VF_PERMADDR_MSG_LEN]; | 187 | u32 msgbuf[IXGBE_VF_PERMADDR_MSG_LEN]; | |
187 | u8 *addr = (u8 *)(&msgbuf[1]); | 188 | u8 *addr = (u8 *)(&msgbuf[1]); | |
188 | 189 | |||
189 | DEBUGFUNC("ixgbevf_reset_hw_vf"); | 190 | DEBUGFUNC("ixgbevf_reset_hw_vf"); | |
190 | 191 | |||
191 | /* Call adapter stop to disable tx/rx and clear interrupts */ | 192 | /* Call adapter stop to disable tx/rx and clear interrupts */ | |
@@ -774,27 +775,27 @@ int ixgbevf_get_queues(struct ixgbe_hw * | @@ -774,27 +775,27 @@ int ixgbevf_get_queues(struct ixgbe_hw * | |||
774 | default: | 775 | default: | |
775 | return 0; | 776 | return 0; | |
776 | } | 777 | } | |
777 | 778 | |||
778 | /* Fetch queue configuration from the PF */ | 779 | /* Fetch queue configuration from the PF */ | |
779 | msg[0] = IXGBE_VF_GET_QUEUES; | 780 | msg[0] = IXGBE_VF_GET_QUEUES; | |
780 | msg[1] = msg[2] = msg[3] = msg[4] = 0; | 781 | msg[1] = msg[2] = msg[3] = msg[4] = 0; | |
781 | 782 | |||
782 | err = ixgbevf_write_msg_read_ack(hw, msg, msg, 5); | 783 | err = ixgbevf_write_msg_read_ack(hw, msg, msg, 5); | |
783 | if (!err) { | 784 | if (!err) { | |
784 | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | 785 | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | |
785 | 786 | |||
786 | /* | 787 | /* | |
787 | * if we we didn't get an ACK there must have been | 788 | * if we didn't get an ACK there must have been | |
788 | * some sort of mailbox error so we should treat it | 789 | * some sort of mailbox error so we should treat it | |
789 | * as such | 790 | * as such | |
790 | */ | 791 | */ | |
791 | if (msg[0] != (IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_ACK)) | 792 | if (msg[0] != (IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_ACK)) | |
792 | return IXGBE_ERR_MBX; | 793 | return IXGBE_ERR_MBX; | |
793 | 794 | |||
794 | /* record and validate values from message */ | 795 | /* record and validate values from message */ | |
795 | hw->mac.max_tx_queues = msg[IXGBE_VF_TX_QUEUES]; | 796 | hw->mac.max_tx_queues = msg[IXGBE_VF_TX_QUEUES]; | |
796 | if (hw->mac.max_tx_queues == 0 || | 797 | if (hw->mac.max_tx_queues == 0 || | |
797 | hw->mac.max_tx_queues > IXGBE_VF_MAX_TX_QUEUES) | 798 | hw->mac.max_tx_queues > IXGBE_VF_MAX_TX_QUEUES) | |
798 | hw->mac.max_tx_queues = IXGBE_VF_MAX_TX_QUEUES; | 799 | hw->mac.max_tx_queues = IXGBE_VF_MAX_TX_QUEUES; | |
799 | 800 | |||
800 | hw->mac.max_rx_queues = msg[IXGBE_VF_RX_QUEUES]; | 801 | hw->mac.max_rx_queues = msg[IXGBE_VF_RX_QUEUES]; |
--- src/sys/dev/pci/ixgbe/ixgbe_x540.c 2018/06/11 10:34:18 1.16
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.c 2021/03/11 16:00:24 1.16.8.1
@@ -814,27 +814,27 @@ s32 ixgbe_acquire_swfw_sync_X540(struct | @@ -814,27 +814,27 @@ s32 ixgbe_acquire_swfw_sync_X540(struct | |||
814 | * currently using resource (hwmask), or other software | 814 | * currently using resource (hwmask), or other software | |
815 | * thread currently using resource (swmask) | 815 | * thread currently using resource (swmask) | |
816 | */ | 816 | */ | |
817 | ixgbe_release_swfw_sync_semaphore(hw); | 817 | ixgbe_release_swfw_sync_semaphore(hw); | |
818 | msec_delay(5); | 818 | msec_delay(5); | |
819 | } | 819 | } | |
820 | 820 | |||
821 | /* If the resource is not released by the FW/HW the SW can assume that | 821 | /* If the resource is not released by the FW/HW the SW can assume that | |
822 | * the FW/HW malfunctions. In that case the SW should set the SW bit(s) | 822 | * the FW/HW malfunctions. In that case the SW should set the SW bit(s) | |
823 | * of the requested resource(s) while ignoring the corresponding FW/HW | 823 | * of the requested resource(s) while ignoring the corresponding FW/HW | |
824 | * bits in the SW_FW_SYNC register. | 824 | * bits in the SW_FW_SYNC register. | |
825 | */ | 825 | */ | |
826 | if (ixgbe_get_swfw_sync_semaphore(hw)) { | 826 | if (ixgbe_get_swfw_sync_semaphore(hw)) { | |
827 | DEBUGOUT("Failed to get NVM sempahore and register semaphore while forcefully ignoring FW sempahore bit(s) and setting SW semaphore bit(s), returning IXGBE_ERR_SWFW_SYNC\n"); | 827 | DEBUGOUT("Failed to get NVM semaphore and register semaphore while forcefully ignoring FW semaphore bit(s) and setting SW semaphore bit(s), returning IXGBE_ERR_SWFW_SYNC\n"); | |
828 | return IXGBE_ERR_SWFW_SYNC; | 828 | return IXGBE_ERR_SWFW_SYNC; | |
829 | } | 829 | } | |
830 | swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw)); | 830 | swfw_sync = IXGBE_READ_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw)); | |
831 | if (swfw_sync & (fwmask | hwmask)) { | 831 | if (swfw_sync & (fwmask | hwmask)) { | |
832 | swfw_sync |= swmask; | 832 | swfw_sync |= swmask; | |
833 | IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw), swfw_sync); | 833 | IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw), swfw_sync); | |
834 | ixgbe_release_swfw_sync_semaphore(hw); | 834 | ixgbe_release_swfw_sync_semaphore(hw); | |
835 | msec_delay(5); | 835 | msec_delay(5); | |
836 | return IXGBE_SUCCESS; | 836 | return IXGBE_SUCCESS; | |
837 | } | 837 | } | |
838 | /* If the resource is not released by other SW the SW can assume that | 838 | /* If the resource is not released by other SW the SW can assume that | |
839 | * the other SW malfunctions. In that case the SW should clear all SW | 839 | * the other SW malfunctions. In that case the SW should clear all SW | |
840 | * flags that it does not own and then repeat the whole process once | 840 | * flags that it does not own and then repeat the whole process once |
--- src/sys/dev/pci/ixgbe/ixv.c 2020/07/10 11:35:51 1.125.2.10
+++ src/sys/dev/pci/ixgbe/ixv.c 2021/03/11 16:00:24 1.125.2.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /*$NetBSD: ixv.c,v 1.125.2.10 2020/07/10 11:35:51 martin Exp $*/ | 1 | /*$NetBSD: ixv.c,v 1.125.2.11 2021/03/11 16:00:24 martin Exp $*/ | |
2 | 2 | |||
3 | /****************************************************************************** | 3 | /****************************************************************************** | |
4 | 4 | |||
5 | Copyright (c) 2001-2017, Intel Corporation | 5 | Copyright (c) 2001-2017, Intel Corporation | |
6 | All rights reserved. | 6 | All rights reserved. | |
7 | 7 | |||
8 | Redistribution and use in source and binary forms, with or without | 8 | Redistribution and use in source and binary forms, with or without | |
9 | modification, are permitted provided that the following conditions are met: | 9 | modification, are permitted provided that the following conditions are met: | |
10 | 10 | |||
11 | 1. Redistributions of source code must retain the above copyright notice, | 11 | 1. Redistributions of source code must retain the above copyright notice, | |
12 | this list of conditions and the following disclaimer. | 12 | this list of conditions and the following disclaimer. | |
13 | 13 | |||
14 | 2. Redistributions in binary form must reproduce the above copyright | 14 | 2. Redistributions in binary form must reproduce the above copyright | |
@@ -28,26 +28,27 @@ | @@ -28,26 +28,27 @@ | |||
28 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 28 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
29 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 29 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
32 | POSSIBILITY OF SUCH DAMAGE. | 32 | POSSIBILITY OF SUCH DAMAGE. | |
33 | 33 | |||
34 | ******************************************************************************/ | 34 | ******************************************************************************/ | |
35 | /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/ | 35 | /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/ | |
36 | 36 | |||
37 | #ifdef _KERNEL_OPT | 37 | #ifdef _KERNEL_OPT | |
38 | #include "opt_inet.h" | 38 | #include "opt_inet.h" | |
39 | #include "opt_inet6.h" | 39 | #include "opt_inet6.h" | |
40 | #include "opt_net_mpsafe.h" | 40 | #include "opt_net_mpsafe.h" | |
41 | #include "opt_ixgbe.h" | |||
41 | #endif | 42 | #endif | |
42 | 43 | |||
43 | #include "ixgbe.h" | 44 | #include "ixgbe.h" | |
44 | #include "vlan.h" | 45 | #include "vlan.h" | |
45 | 46 | |||
46 | /************************************************************************ | 47 | /************************************************************************ | |
47 | * Driver version | 48 | * Driver version | |
48 | ************************************************************************/ | 49 | ************************************************************************/ | |
49 | static const char ixv_driver_version[] = "2.0.1-k"; | 50 | static const char ixv_driver_version[] = "2.0.1-k"; | |
50 | /* XXX NetBSD: + 1.5.17 */ | 51 | /* XXX NetBSD: + 1.5.17 */ | |
51 | 52 | |||
52 | /************************************************************************ | 53 | /************************************************************************ | |
53 | * PCI Device ID Table | 54 | * PCI Device ID Table | |
@@ -488,26 +489,28 @@ ixv_attach(device_t parent, device_t dev | @@ -488,26 +489,28 @@ ixv_attach(device_t parent, device_t dev | |||
488 | ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) { | 489 | ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) { | |
489 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | 490 | aprint_error_dev(dev, "TXD config issue, using default!\n"); | |
490 | adapter->num_tx_desc = DEFAULT_TXD; | 491 | adapter->num_tx_desc = DEFAULT_TXD; | |
491 | } else | 492 | } else | |
492 | adapter->num_tx_desc = ixv_txd; | 493 | adapter->num_tx_desc = ixv_txd; | |
493 | 494 | |||
494 | if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | 495 | if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || | |
495 | ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) { | 496 | ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) { | |
496 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | 497 | aprint_error_dev(dev, "RXD config issue, using default!\n"); | |
497 | adapter->num_rx_desc = DEFAULT_RXD; | 498 | adapter->num_rx_desc = DEFAULT_RXD; | |
498 | } else | 499 | } else | |
499 | adapter->num_rx_desc = ixv_rxd; | 500 | adapter->num_rx_desc = ixv_rxd; | |
500 | 501 | |||
502 | adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; | |||
503 | ||||
501 | /* Setup MSI-X */ | 504 | /* Setup MSI-X */ | |
502 | error = ixv_configure_interrupts(adapter); | 505 | error = ixv_configure_interrupts(adapter); | |
503 | if (error) | 506 | if (error) | |
504 | goto err_out; | 507 | goto err_out; | |
505 | 508 | |||
506 | /* Allocate our TX/RX Queues */ | 509 | /* Allocate our TX/RX Queues */ | |
507 | if (ixgbe_allocate_queues(adapter)) { | 510 | if (ixgbe_allocate_queues(adapter)) { | |
508 | aprint_error_dev(dev, "ixgbe_allocate_queues() failed!\n"); | 511 | aprint_error_dev(dev, "ixgbe_allocate_queues() failed!\n"); | |
509 | error = ENOMEM; | 512 | error = ENOMEM; | |
510 | goto err_out; | 513 | goto err_out; | |
511 | } | 514 | } | |
512 | 515 | |||
513 | /* hw.ix defaults init */ | 516 | /* hw.ix defaults init */ | |
@@ -2489,26 +2492,33 @@ ixv_add_device_sysctls(struct adapter *a | @@ -2489,26 +2492,33 @@ ixv_add_device_sysctls(struct adapter *a | |||
2489 | 2492 | |||
2490 | if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { | 2493 | if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { | |
2491 | aprint_error_dev(dev, "could not create sysctl root\n"); | 2494 | aprint_error_dev(dev, "could not create sysctl root\n"); | |
2492 | return; | 2495 | return; | |
2493 | } | 2496 | } | |
2494 | 2497 | |||
2495 | if (sysctl_createv(log, 0, &rnode, &cnode, | 2498 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
2496 | CTLFLAG_READWRITE, CTLTYPE_INT, | 2499 | CTLFLAG_READWRITE, CTLTYPE_INT, | |
2497 | "debug", SYSCTL_DESCR("Debug Info"), | 2500 | "debug", SYSCTL_DESCR("Debug Info"), | |
2498 | ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | 2501 | ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) | |
2499 | aprint_error_dev(dev, "could not create sysctl\n"); | 2502 | aprint_error_dev(dev, "could not create sysctl\n"); | |
2500 | 2503 | |||
2501 | if (sysctl_createv(log, 0, &rnode, &cnode, | 2504 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
2505 | CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", | |||
2506 | SYSCTL_DESCR("Number of jumbo buffers per queue"), | |||
2507 | NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, | |||
2508 | CTL_EOL) != 0) | |||
2509 | aprint_error_dev(dev, "could not create sysctl\n"); | |||
2510 | ||||
2511 | if (sysctl_createv(log, 0, &rnode, &cnode, | |||
2502 | CTLFLAG_READWRITE, CTLTYPE_BOOL, | 2512 | CTLFLAG_READWRITE, CTLTYPE_BOOL, | |
2503 | "enable_aim", SYSCTL_DESCR("Interrupt Moderation"), | 2513 | "enable_aim", SYSCTL_DESCR("Interrupt Moderation"), | |
2504 | NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) | 2514 | NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) | |
2505 | aprint_error_dev(dev, "could not create sysctl\n"); | 2515 | aprint_error_dev(dev, "could not create sysctl\n"); | |
2506 | 2516 | |||
2507 | if (sysctl_createv(log, 0, &rnode, &cnode, | 2517 | if (sysctl_createv(log, 0, &rnode, &cnode, | |
2508 | CTLFLAG_READWRITE, CTLTYPE_BOOL, | 2518 | CTLFLAG_READWRITE, CTLTYPE_BOOL, | |
2509 | "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"), | 2519 | "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"), | |
2510 | NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL) != 0) | 2520 | NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL) != 0) | |
2511 | aprint_error_dev(dev, "could not create sysctl\n"); | 2521 | aprint_error_dev(dev, "could not create sysctl\n"); | |
2512 | } | 2522 | } | |
2513 | 2523 | |||
2514 | /************************************************************************ | 2524 | /************************************************************************ | |
@@ -2588,27 +2598,27 @@ ixv_add_stats_sysctls(struct adapter *ad | @@ -2588,27 +2598,27 @@ ixv_add_stats_sysctls(struct adapter *ad | |||
2588 | break; | 2598 | break; | |
2589 | 2599 | |||
2590 | evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR, | 2600 | evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR, | |
2591 | NULL, adapter->queues[i].evnamebuf, "IRQs on queue"); | 2601 | NULL, adapter->queues[i].evnamebuf, "IRQs on queue"); | |
2592 | evcnt_attach_dynamic(&adapter->queues[i].handleq, | 2602 | evcnt_attach_dynamic(&adapter->queues[i].handleq, | |
2593 | EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, | 2603 | EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, | |
2594 | "Handled queue in softint"); | 2604 | "Handled queue in softint"); | |
2595 | evcnt_attach_dynamic(&adapter->queues[i].req, EVCNT_TYPE_MISC, | 2605 | evcnt_attach_dynamic(&adapter->queues[i].req, EVCNT_TYPE_MISC, | |
2596 | NULL, adapter->queues[i].evnamebuf, "Requeued in softint"); | 2606 | NULL, adapter->queues[i].evnamebuf, "Requeued in softint"); | |
2597 | evcnt_attach_dynamic(&txr->tso_tx, EVCNT_TYPE_MISC, | 2607 | evcnt_attach_dynamic(&txr->tso_tx, EVCNT_TYPE_MISC, | |
2598 | NULL, adapter->queues[i].evnamebuf, "TSO"); | 2608 | NULL, adapter->queues[i].evnamebuf, "TSO"); | |
2599 | evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, | 2609 | evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, | |
2600 | NULL, adapter->queues[i].evnamebuf, | 2610 | NULL, adapter->queues[i].evnamebuf, | |
2601 | "Queue No Descriptor Available"); | 2611 | "TX Queue No Descriptor Available"); | |
2602 | evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, | 2612 | evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, | |
2603 | NULL, adapter->queues[i].evnamebuf, | 2613 | NULL, adapter->queues[i].evnamebuf, | |
2604 | "Queue Packets Transmitted"); | 2614 | "Queue Packets Transmitted"); | |
2605 | #ifndef IXGBE_LEGACY_TX | 2615 | #ifndef IXGBE_LEGACY_TX | |
2606 | evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, | 2616 | evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, | |
2607 | NULL, adapter->queues[i].evnamebuf, | 2617 | NULL, adapter->queues[i].evnamebuf, | |
2608 | "Packets dropped in pcq"); | 2618 | "Packets dropped in pcq"); | |
2609 | #endif | 2619 | #endif | |
2610 | 2620 | |||
2611 | #ifdef LRO | 2621 | #ifdef LRO | |
2612 | struct lro_ctrl *lro = &rxr->lro; | 2622 | struct lro_ctrl *lro = &rxr->lro; | |
2613 | #endif /* LRO */ | 2623 | #endif /* LRO */ | |
2614 | 2624 |