Wed Mar 31 07:53:53 2021 UTC ()
KNF a bit. No functional change.


(msaitoh)
diff -r1.69 -r1.70 src/sys/dev/pci/ixgbe/ix_txrx.c
diff -r1.279 -r1.280 src/sys/dev/pci/ixgbe/ixgbe.c
diff -r1.157 -r1.158 src/sys/dev/pci/ixgbe/ixv.c

cvs diff -r1.69 -r1.70 src/sys/dev/pci/ixgbe/ix_txrx.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ix_txrx.c 2021/03/12 01:54:29 1.69
+++ src/sys/dev/pci/ixgbe/ix_txrx.c 2021/03/31 07:53:53 1.70
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ix_txrx.c,v 1.69 2021/03/12 01:54:29 knakahara Exp $ */ 1/* $NetBSD: ix_txrx.c,v 1.70 2021/03/31 07:53:53 msaitoh 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
@@ -192,27 +192,27 @@ ixgbe_legacy_start(struct ifnet *ifp) @@ -192,27 +192,27 @@ ixgbe_legacy_start(struct ifnet *ifp)
192 } 192 }
193} /* ixgbe_legacy_start */ 193} /* ixgbe_legacy_start */
194 194
195/************************************************************************ 195/************************************************************************
196 * ixgbe_mq_start - Multiqueue Transmit Entry Point 196 * ixgbe_mq_start - Multiqueue Transmit Entry Point
197 * 197 *
198 * (if_transmit function) 198 * (if_transmit function)
199 ************************************************************************/ 199 ************************************************************************/
200int 200int
201ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m) 201ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m)
202{ 202{
203 struct adapter *adapter = ifp->if_softc; 203 struct adapter *adapter = ifp->if_softc;
204 struct tx_ring *txr; 204 struct tx_ring *txr;
205 int i; 205 int i;
206#ifdef RSS 206#ifdef RSS
207 uint32_t bucket_id; 207 uint32_t bucket_id;
208#endif 208#endif
209 209
210 /* 210 /*
211 * When doing RSS, map it to the same outbound queue 211 * When doing RSS, map it to the same outbound queue
212 * as the incoming flow would be mapped to. 212 * as the incoming flow would be mapped to.
213 * 213 *
214 * If everything is setup correctly, it should be the 214 * If everything is setup correctly, it should be the
215 * same bucket that the current CPU we're on is. 215 * same bucket that the current CPU we're on is.
216 */ 216 */
217#ifdef RSS 217#ifdef RSS
218 if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { 218 if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
@@ -1745,31 +1745,29 @@ ixgbe_rx_input(struct rx_ring *rxr, stru @@ -1745,31 +1745,29 @@ ixgbe_rx_input(struct rx_ring *rxr, stru
1745} /* ixgbe_rx_input */ 1745} /* ixgbe_rx_input */
1746 1746
1747/************************************************************************ 1747/************************************************************************
1748 * ixgbe_rx_discard 1748 * ixgbe_rx_discard
1749 ************************************************************************/ 1749 ************************************************************************/
1750static __inline void 1750static __inline void
1751ixgbe_rx_discard(struct rx_ring *rxr, int i) 1751ixgbe_rx_discard(struct rx_ring *rxr, int i)
1752{ 1752{
1753 struct ixgbe_rx_buf *rbuf; 1753 struct ixgbe_rx_buf *rbuf;
1754 1754
1755 rbuf = &rxr->rx_buffers[i]; 1755 rbuf = &rxr->rx_buffers[i];
1756 1756
1757 /* 1757 /*
1758 * With advanced descriptors the writeback 1758 * With advanced descriptors the writeback clobbers the buffer addrs,
1759 * clobbers the buffer addrs, so its easier 1759 * so its easier to just free the existing mbufs and take the normal
1760 * to just free the existing mbufs and take 1760 * refresh path to get new buffers and mapping.
1761 * the normal refresh path to get new buffers 
1762 * and mapping. 
1763 */ 1761 */
1764 1762
1765 if (rbuf->fmp != NULL) {/* Partial chain ? */ 1763 if (rbuf->fmp != NULL) {/* Partial chain ? */
1766 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0, 1764 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
1767 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD); 1765 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
1768 m_freem(rbuf->fmp); 1766 m_freem(rbuf->fmp);
1769 rbuf->fmp = NULL; 1767 rbuf->fmp = NULL;
1770 rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */ 1768 rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
1771 } else if (rbuf->buf) { 1769 } else if (rbuf->buf) {
1772 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0, 1770 bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
1773 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD); 1771 rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
1774 m_free(rbuf->buf); 1772 m_free(rbuf->buf);
1775 rbuf->buf = NULL; 1773 rbuf->buf = NULL;

cvs diff -r1.279 -r1.280 src/sys/dev/pci/ixgbe/ixgbe.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixgbe.c 2021/03/09 10:03:18 1.279
+++ src/sys/dev/pci/ixgbe/ixgbe.c 2021/03/31 07:53:53 1.280
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ixgbe.c,v 1.279 2021/03/09 10:03:18 msaitoh Exp $ */ 1/* $NetBSD: ixgbe.c,v 1.280 2021/03/31 07:53:53 msaitoh 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
@@ -1684,37 +1684,40 @@ ixgbe_update_stats_counters(struct adapt @@ -1684,37 +1684,40 @@ ixgbe_update_stats_counters(struct adapt
1684 /* Hardware workaround, gprc counts missed packets */ 1684 /* Hardware workaround, gprc counts missed packets */
1685 stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx; 1685 stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx;
1686 1686
1687 lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); 1687 lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC);
1688 stats->lxontxc.ev_count += lxon; 1688 stats->lxontxc.ev_count += lxon;
1689 lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); 1689 lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
1690 stats->lxofftxc.ev_count += lxoff; 1690 stats->lxofftxc.ev_count += lxoff;
1691 total = lxon + lxoff; 1691 total = lxon + lxoff;
1692 1692
1693 if (hw->mac.type != ixgbe_mac_82598EB) { 1693 if (hw->mac.type != ixgbe_mac_82598EB) {
1694 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCL) + 1694 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCL) +
1695 ((u64)IXGBE_READ_REG(hw, IXGBE_GORCH) << 32); 1695 ((u64)IXGBE_READ_REG(hw, IXGBE_GORCH) << 32);
1696 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCL) + 1696 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCL) +
1697 ((u64)IXGBE_READ_REG(hw, IXGBE_GOTCH) << 32) - total * ETHER_MIN_LEN; 1697 ((u64)IXGBE_READ_REG(hw, IXGBE_GOTCH) << 32)
 1698 - total * ETHER_MIN_LEN;
1698 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORL) + 1699 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORL) +
1699 ((u64)IXGBE_READ_REG(hw, IXGBE_TORH) << 32); 1700 ((u64)IXGBE_READ_REG(hw, IXGBE_TORH) << 32);
1700 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); 1701 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT);
1701 stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); 1702 stats->lxoffrxc.ev_count
 1703 += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT);
1702 } else { 1704 } else {
1703 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXC); 1705 stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXC);
1704 stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); 1706 stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC);
1705 /* 82598 only has a counter in the high register */ 1707 /* 82598 only has a counter in the high register */
1706 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCH); 1708 stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCH);
1707 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCH) - total * ETHER_MIN_LEN; 1709 stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCH)
 1710 - total * ETHER_MIN_LEN;
1708 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORH); 1711 stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORH);
1709 } 1712 }
1710 1713
1711 /* 1714 /*
1712 * Workaround: mprc hardware is incorrectly counting 1715 * Workaround: mprc hardware is incorrectly counting
1713 * broadcasts, so for now we subtract those. 1716 * broadcasts, so for now we subtract those.
1714 */ 1717 */
1715 bprc = IXGBE_READ_REG(hw, IXGBE_BPRC); 1718 bprc = IXGBE_READ_REG(hw, IXGBE_BPRC);
1716 stats->bprc.ev_count += bprc; 1719 stats->bprc.ev_count += bprc;
1717 stats->mprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPRC) 1720 stats->mprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPRC)
1718 - ((hw->mac.type == ixgbe_mac_82598EB) ? bprc : 0); 1721 - ((hw->mac.type == ixgbe_mac_82598EB) ? bprc : 0);
1719 1722
1720 stats->prc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PRC64); 1723 stats->prc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PRC64);
@@ -1906,72 +1909,67 @@ ixgbe_add_hw_stats(struct adapter *adapt @@ -1906,72 +1909,67 @@ ixgbe_add_hw_stats(struct adapter *adapt
1906 evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, 1909 evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC,
1907 NULL, adapter->queues[i].evnamebuf, 1910 NULL, adapter->queues[i].evnamebuf,
1908 "TX Queue No Descriptor Available"); 1911 "TX Queue No Descriptor Available");
1909 evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, 1912 evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC,
1910 NULL, adapter->queues[i].evnamebuf, 1913 NULL, adapter->queues[i].evnamebuf,
1911 "Queue Packets Transmitted"); 1914 "Queue Packets Transmitted");
1912#ifndef IXGBE_LEGACY_TX 1915#ifndef IXGBE_LEGACY_TX
1913 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, 1916 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC,
1914 NULL, adapter->queues[i].evnamebuf, 1917 NULL, adapter->queues[i].evnamebuf,
1915 "Packets dropped in pcq"); 1918 "Packets dropped in pcq");
1916#endif 1919#endif
1917 1920
1918 if (sysctl_createv(log, 0, &rnode, &cnode, 1921 if (sysctl_createv(log, 0, &rnode, &cnode,
1919 CTLFLAG_READONLY, 1922 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxck",
1920 CTLTYPE_INT, 1923 SYSCTL_DESCR("Receive Descriptor next to check"),
1921 "rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"), 1924 ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
1922 ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0, 
1923 CTL_CREATE, CTL_EOL) != 0) 1925 CTL_CREATE, CTL_EOL) != 0)
1924 break; 1926 break;
1925 1927
1926 if (sysctl_createv(log, 0, &rnode, &cnode, 1928 if (sysctl_createv(log, 0, &rnode, &cnode,
1927 CTLFLAG_READONLY, 1929 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
1928 CTLTYPE_INT, 1930 SYSCTL_DESCR("Receive Descriptor Head"),
1929 "rxd_head", SYSCTL_DESCR("Receive Descriptor Head"), 
1930 ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0, 1931 ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
1931 CTL_CREATE, CTL_EOL) != 0) 1932 CTL_CREATE, CTL_EOL) != 0)
1932 break; 1933 break;
1933 1934
1934 if (sysctl_createv(log, 0, &rnode, &cnode, 1935 if (sysctl_createv(log, 0, &rnode, &cnode,
1935 CTLFLAG_READONLY, 1936 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_tail",
1936 CTLTYPE_INT, 1937 SYSCTL_DESCR("Receive Descriptor Tail"),
1937 "rxd_tail", SYSCTL_DESCR("Receive Descriptor Tail"), 
1938 ixgbe_sysctl_rdt_handler, 0, (void *)rxr, 0, 1938 ixgbe_sysctl_rdt_handler, 0, (void *)rxr, 0,
1939 CTL_CREATE, CTL_EOL) != 0) 1939 CTL_CREATE, CTL_EOL) != 0)
1940 break; 1940 break;
1941 1941
1942 if (i < __arraycount(stats->qprc)) { 1942 if (i < __arraycount(stats->qprc)) {
1943 evcnt_attach_dynamic(&stats->qprc[i], 1943 evcnt_attach_dynamic(&stats->qprc[i], EVCNT_TYPE_MISC,
1944 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 1944 NULL, adapter->queues[i].evnamebuf, "qprc");
1945 "qprc"); 1945 evcnt_attach_dynamic(&stats->qptc[i], EVCNT_TYPE_MISC,
1946 evcnt_attach_dynamic(&stats->qptc[i], 1946 NULL, adapter->queues[i].evnamebuf, "qptc");
1947 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 1947 evcnt_attach_dynamic(&stats->qbrc[i], EVCNT_TYPE_MISC,
1948 "qptc"); 1948 NULL, adapter->queues[i].evnamebuf, "qbrc");
1949 evcnt_attach_dynamic(&stats->qbrc[i], 1949 evcnt_attach_dynamic(&stats->qbtc[i], EVCNT_TYPE_MISC,
1950 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 1950 NULL, adapter->queues[i].evnamebuf, "qbtc");
1951 "qbrc"); 
1952 evcnt_attach_dynamic(&stats->qbtc[i], 
1953 EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, 
1954 "qbtc"); 
1955 if (hw->mac.type >= ixgbe_mac_82599EB) 1951 if (hw->mac.type >= ixgbe_mac_82599EB)
1956 evcnt_attach_dynamic(&stats->qprdc[i], 1952 evcnt_attach_dynamic(&stats->qprdc[i],
1957 EVCNT_TYPE_MISC, NULL, 1953 EVCNT_TYPE_MISC, NULL,
1958 adapter->queues[i].evnamebuf, "qprdc"); 1954 adapter->queues[i].evnamebuf, "qprdc");
1959 } 1955 }
1960 1956
1961 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC, 1957 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC,
1962 NULL, adapter->queues[i].evnamebuf, "Queue Packets Received"); 1958 NULL, adapter->queues[i].evnamebuf,
 1959 "Queue Packets Received");
1963 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC, 1960 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC,
1964 NULL, adapter->queues[i].evnamebuf, "Queue Bytes Received"); 1961 NULL, adapter->queues[i].evnamebuf,
 1962 "Queue Bytes Received");
1965 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC, 1963 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC,
1966 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames"); 1964 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames");
1967 evcnt_attach_dynamic(&rxr->no_jmbuf, EVCNT_TYPE_MISC, 1965 evcnt_attach_dynamic(&rxr->no_jmbuf, EVCNT_TYPE_MISC,
1968 NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf"); 1966 NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf");
1969 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC, 1967 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC,
1970 NULL, adapter->queues[i].evnamebuf, "Rx discarded"); 1968 NULL, adapter->queues[i].evnamebuf, "Rx discarded");
1971#ifdef LRO 1969#ifdef LRO
1972 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", 1970 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued",
1973 CTLFLAG_RD, &lro->lro_queued, 0, 1971 CTLFLAG_RD, &lro->lro_queued, 0,
1974 "LRO Queued"); 1972 "LRO Queued");
1975 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed", 1973 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed",
1976 CTLFLAG_RD, &lro->lro_flushed, 0, 1974 CTLFLAG_RD, &lro->lro_flushed, 0,
1977 "LRO Flushed"); 1975 "LRO Flushed");
@@ -3183,40 +3181,46 @@ ixgbe_intr_admin_common(struct adapter * @@ -3183,40 +3181,46 @@ ixgbe_intr_admin_common(struct adapter *
3183 3181
3184 /* Check for over temp condition */ 3182 /* Check for over temp condition */
3185 if (adapter->feat_en & IXGBE_FEATURE_TEMP_SENSOR) { 3183 if (adapter->feat_en & IXGBE_FEATURE_TEMP_SENSOR) {
3186 switch (adapter->hw.mac.type) { 3184 switch (adapter->hw.mac.type) {
3187 case ixgbe_mac_X550EM_a: 3185 case ixgbe_mac_X550EM_a:
3188 if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a)) 3186 if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a))
3189 break; 3187 break;
3190 /* Disable interrupt to prevent log spam */ 3188 /* Disable interrupt to prevent log spam */
3191 *eims_disable |= IXGBE_EICR_GPI_SDP0_X550EM_a; 3189 *eims_disable |= IXGBE_EICR_GPI_SDP0_X550EM_a;
3192 3190
3193 retval = hw->phy.ops.check_overtemp(hw); 3191 retval = hw->phy.ops.check_overtemp(hw);
3194 if (retval != IXGBE_ERR_OVERTEMP) 3192 if (retval != IXGBE_ERR_OVERTEMP)
3195 break; 3193 break;
3196 device_printf(adapter->dev, "CRITICAL: OVER TEMP!! PHY IS SHUT DOWN!!\n"); 3194 device_printf(adapter->dev,
3197 device_printf(adapter->dev, "System shutdown required!\n"); 3195 "CRITICAL: OVER TEMP!! "
 3196 "PHY IS SHUT DOWN!!\n");
 3197 device_printf(adapter->dev,
 3198 "System shutdown required!\n");
3198 break; 3199 break;
3199 default: 3200 default:
3200 if (!(eicr & IXGBE_EICR_TS)) 3201 if (!(eicr & IXGBE_EICR_TS))
3201 break; 3202 break;
3202 /* Disable interrupt to prevent log spam */ 3203 /* Disable interrupt to prevent log spam */
3203 *eims_disable |= IXGBE_EIMS_TS; 3204 *eims_disable |= IXGBE_EIMS_TS;
3204 3205
3205 retval = hw->phy.ops.check_overtemp(hw); 3206 retval = hw->phy.ops.check_overtemp(hw);
3206 if (retval != IXGBE_ERR_OVERTEMP) 3207 if (retval != IXGBE_ERR_OVERTEMP)
3207 break; 3208 break;
3208 device_printf(adapter->dev, "CRITICAL: OVER TEMP!! PHY IS SHUT DOWN!!\n"); 3209 device_printf(adapter->dev,
3209 device_printf(adapter->dev, "System shutdown required!\n"); 3210 "CRITICAL: OVER TEMP!! "
 3211 "PHY IS SHUT DOWN!!\n");
 3212 device_printf(adapter->dev,
 3213 "System shutdown required!\n");
3210 break; 3214 break;
3211 } 3215 }
3212 } 3216 }
3213 3217
3214 /* Check for VF message */ 3218 /* Check for VF message */
3215 if ((adapter->feat_en & IXGBE_FEATURE_SRIOV) && 3219 if ((adapter->feat_en & IXGBE_FEATURE_SRIOV) &&
3216 (eicr & IXGBE_EICR_MAILBOX)) { 3220 (eicr & IXGBE_EICR_MAILBOX)) {
3217 task_requests |= IXGBE_REQUEST_TASK_MBX; 3221 task_requests |= IXGBE_REQUEST_TASK_MBX;
3218 *eims_disable |= IXGBE_EIMS_MAILBOX; 3222 *eims_disable |= IXGBE_EIMS_MAILBOX;
3219 } 3223 }
3220 } 3224 }
3221 3225
3222 /* Check for fan failure */ 3226 /* Check for fan failure */
@@ -3349,27 +3353,28 @@ ixgbe_add_device_sysctls(struct adapter  @@ -3349,27 +3353,28 @@ ixgbe_add_device_sysctls(struct adapter
3349 struct sysctllog **log; 3353 struct sysctllog **log;
3350 const struct sysctlnode *rnode, *cnode; 3354 const struct sysctlnode *rnode, *cnode;
3351 3355
3352 log = &adapter->sysctllog; 3356 log = &adapter->sysctllog;
3353 3357
3354 if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) { 3358 if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) {
3355 aprint_error_dev(dev, "could not create sysctl root\n"); 3359 aprint_error_dev(dev, "could not create sysctl root\n");
3356 return; 3360 return;
3357 } 3361 }
3358 3362
3359 if (sysctl_createv(log, 0, &rnode, &cnode, 3363 if (sysctl_createv(log, 0, &rnode, &cnode,
3360 CTLFLAG_READWRITE, CTLTYPE_INT, 3364 CTLFLAG_READWRITE, CTLTYPE_INT,
3361 "debug", SYSCTL_DESCR("Debug Info"), 3365 "debug", SYSCTL_DESCR("Debug Info"),
3362 ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) 3366 ixgbe_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL)
 3367 != 0)
3363 aprint_error_dev(dev, "could not create sysctl\n"); 3368 aprint_error_dev(dev, "could not create sysctl\n");
3364 3369
3365 if (sysctl_createv(log, 0, &rnode, &cnode, 3370 if (sysctl_createv(log, 0, &rnode, &cnode,
3366 CTLFLAG_READONLY, CTLTYPE_INT, 3371 CTLFLAG_READONLY, CTLTYPE_INT,
3367 "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"), 3372 "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"),
3368 NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0) 3373 NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0)
3369 aprint_error_dev(dev, "could not create sysctl\n"); 3374 aprint_error_dev(dev, "could not create sysctl\n");
3370 3375
3371 if (sysctl_createv(log, 0, &rnode, &cnode, 3376 if (sysctl_createv(log, 0, &rnode, &cnode,
3372 CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", 3377 CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue",
3373 SYSCTL_DESCR("Number of jumbo buffers per queue"), 3378 SYSCTL_DESCR("Number of jumbo buffers per queue"),
3374 NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, 3379 NULL, 0, &adapter->num_jcl, 0, CTL_CREATE,
3375 CTL_EOL) != 0) 3380 CTL_EOL) != 0)
@@ -3403,28 +3408,30 @@ ixgbe_add_device_sysctls(struct adapter  @@ -3403,28 +3408,30 @@ ixgbe_add_device_sysctls(struct adapter
3403 3408
3404 /* 3409 /*
3405 * If each "que->txrx_use_workqueue" is changed in sysctl handler, 3410 * If each "que->txrx_use_workqueue" is changed in sysctl handler,
3406 * it causesflip-flopping softint/workqueue mode in one deferred 3411 * it causesflip-flopping softint/workqueue mode in one deferred
3407 * processing. Therefore, preempt_disable()/preempt_enable() are 3412 * processing. Therefore, preempt_disable()/preempt_enable() are
3408 * required in ixgbe_sched_handle_que() to avoid 3413 * required in ixgbe_sched_handle_que() to avoid
3409 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule(). 3414 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule().
3410 * I think changing "que->txrx_use_workqueue" in interrupt handler 3415 * I think changing "que->txrx_use_workqueue" in interrupt handler
3411 * is lighter than doing preempt_disable()/preempt_enable() in every 3416 * is lighter than doing preempt_disable()/preempt_enable() in every
3412 * ixgbe_sched_handle_que(). 3417 * ixgbe_sched_handle_que().
3413 */ 3418 */
3414 adapter->txrx_use_workqueue = ixgbe_txrx_workqueue; 3419 adapter->txrx_use_workqueue = ixgbe_txrx_workqueue;
3415 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, 3420 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
3416 CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"), 3421 CTLTYPE_BOOL, "txrx_workqueue",
3417 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL) != 0) 3422 SYSCTL_DESCR("Use workqueue for packet processing"),
 3423 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE,
 3424 CTL_EOL) != 0)
3418 aprint_error_dev(dev, "could not create sysctl\n"); 3425 aprint_error_dev(dev, "could not create sysctl\n");
3419 3426
3420#ifdef IXGBE_DEBUG 3427#ifdef IXGBE_DEBUG
3421 /* testing sysctls (for all devices) */ 3428 /* testing sysctls (for all devices) */
3422 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, 3429 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
3423 CTLTYPE_INT, "power_state", SYSCTL_DESCR("PCI Power State"), 3430 CTLTYPE_INT, "power_state", SYSCTL_DESCR("PCI Power State"),
3424 ixgbe_sysctl_power_state, 0, (void *)adapter, 0, CTL_CREATE, 3431 ixgbe_sysctl_power_state, 0, (void *)adapter, 0, CTL_CREATE,
3425 CTL_EOL) != 0) 3432 CTL_EOL) != 0)
3426 aprint_error_dev(dev, "could not create sysctl\n"); 3433 aprint_error_dev(dev, "could not create sysctl\n");
3427 3434
3428 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READONLY, 3435 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READONLY,
3429 CTLTYPE_STRING, "print_rss_config", 3436 CTLTYPE_STRING, "print_rss_config",
3430 SYSCTL_DESCR("Prints RSS Configuration"), 3437 SYSCTL_DESCR("Prints RSS Configuration"),
@@ -3467,27 +3474,28 @@ ixgbe_add_device_sysctls(struct adapter  @@ -3467,27 +3474,28 @@ ixgbe_add_device_sysctls(struct adapter
3467 aprint_error_dev(dev, "could not create sysctl\n"); 3474 aprint_error_dev(dev, "could not create sysctl\n");
3468 return; 3475 return;
3469 } 3476 }
3470 3477
3471 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY, 3478 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY,
3472 CTLTYPE_INT, "temp", 3479 CTLTYPE_INT, "temp",
3473 SYSCTL_DESCR("Current External PHY Temperature (Celsius)"), 3480 SYSCTL_DESCR("Current External PHY Temperature (Celsius)"),
3474 ixgbe_sysctl_phy_temp, 0, (void *)adapter, 0, CTL_CREATE, 3481 ixgbe_sysctl_phy_temp, 0, (void *)adapter, 0, CTL_CREATE,
3475 CTL_EOL) != 0) 3482 CTL_EOL) != 0)
3476 aprint_error_dev(dev, "could not create sysctl\n"); 3483 aprint_error_dev(dev, "could not create sysctl\n");
3477 3484
3478 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY, 3485 if (sysctl_createv(log, 0, &phy_node, &cnode, CTLFLAG_READONLY,
3479 CTLTYPE_INT, "overtemp_occurred", 3486 CTLTYPE_INT, "overtemp_occurred",
3480 SYSCTL_DESCR("External PHY High Temperature Event Occurred"), 3487 SYSCTL_DESCR(
 3488 "External PHY High Temperature Event Occurred"),
3481 ixgbe_sysctl_phy_overtemp_occurred, 0, (void *)adapter, 0, 3489 ixgbe_sysctl_phy_overtemp_occurred, 0, (void *)adapter, 0,
3482 CTL_CREATE, CTL_EOL) != 0) 3490 CTL_CREATE, CTL_EOL) != 0)
3483 aprint_error_dev(dev, "could not create sysctl\n"); 3491 aprint_error_dev(dev, "could not create sysctl\n");
3484 } 3492 }
3485 3493
3486 if ((hw->mac.type == ixgbe_mac_X550EM_a) 3494 if ((hw->mac.type == ixgbe_mac_X550EM_a)
3487 && (hw->phy.type == ixgbe_phy_fw)) 3495 && (hw->phy.type == ixgbe_phy_fw))
3488 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, 3496 if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
3489 CTLTYPE_BOOL, "force_10_100_autonego", 3497 CTLTYPE_BOOL, "force_10_100_autonego",
3490 SYSCTL_DESCR("Force autonego on 10M and 100M"), 3498 SYSCTL_DESCR("Force autonego on 10M and 100M"),
3491 NULL, 0, &hw->phy.force_10_100_autonego, 0, 3499 NULL, 0, &hw->phy.force_10_100_autonego, 0,
3492 CTL_CREATE, CTL_EOL) != 0) 3500 CTL_CREATE, CTL_EOL) != 0)
3493 aprint_error_dev(dev, "could not create sysctl\n"); 3501 aprint_error_dev(dev, "could not create sysctl\n");
@@ -5527,28 +5535,27 @@ ixgbe_set_advertise(struct adapter *adap @@ -5527,28 +5535,27 @@ ixgbe_set_advertise(struct adapter *adap
5527 /* No speed changes for backplane media */ 5535 /* No speed changes for backplane media */
5528 if (hw->phy.media_type == ixgbe_media_type_backplane) 5536 if (hw->phy.media_type == ixgbe_media_type_backplane)
5529 return (ENODEV); 5537 return (ENODEV);
5530 5538
5531 if (!((hw->phy.media_type == ixgbe_media_type_copper) || 5539 if (!((hw->phy.media_type == ixgbe_media_type_copper) ||
5532 (hw->phy.multispeed_fiber))) { 5540 (hw->phy.multispeed_fiber))) {
5533 device_printf(dev, 5541 device_printf(dev,
5534 "Advertised speed can only be set on copper or " 5542 "Advertised speed can only be set on copper or "
5535 "multispeed fiber media types.\n"); 5543 "multispeed fiber media types.\n");
5536 return (EINVAL); 5544 return (EINVAL);
5537 } 5545 }
5538 5546
5539 if (advertise < 0x0 || advertise > 0x3f) { 5547 if (advertise < 0x0 || advertise > 0x3f) {
5540 device_printf(dev, 5548 device_printf(dev, "Invalid advertised speed; valid modes are 0x0 through 0x3f\n");
5541 "Invalid advertised speed; valid modes are 0x0 through 0x3f\n"); 
5542 return (EINVAL); 5549 return (EINVAL);
5543 } 5550 }
5544 5551
5545 if (hw->mac.ops.get_link_capabilities) { 5552 if (hw->mac.ops.get_link_capabilities) {
5546 err = hw->mac.ops.get_link_capabilities(hw, &link_caps, 5553 err = hw->mac.ops.get_link_capabilities(hw, &link_caps,
5547 &negotiate); 5554 &negotiate);
5548 if (err != IXGBE_SUCCESS) { 5555 if (err != IXGBE_SUCCESS) {
5549 device_printf(dev, "Unable to determine supported advertise speeds\n"); 5556 device_printf(dev, "Unable to determine supported advertise speeds\n");
5550 return (ENODEV); 5557 return (ENODEV);
5551 } 5558 }
5552 } 5559 }
5553 5560
5554 /* Set new value and report new advertised mode */ 5561 /* Set new value and report new advertised mode */
@@ -6515,27 +6522,28 @@ ixgbe_ioctl(struct ifnet *ifp, u_long co @@ -6515,27 +6522,28 @@ ixgbe_ioctl(struct ifnet *ifp, u_long co
6515 6522
6516/************************************************************************ 6523/************************************************************************
6517 * ixgbe_check_fan_failure 6524 * ixgbe_check_fan_failure
6518 ************************************************************************/ 6525 ************************************************************************/
6519static int 6526static int
6520ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt) 6527ixgbe_check_fan_failure(struct adapter *adapter, u32 reg, bool in_interrupt)
6521{ 6528{
6522 u32 mask; 6529 u32 mask;
6523 6530
6524 mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(&adapter->hw) : 6531 mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(&adapter->hw) :
6525 IXGBE_ESDP_SDP1; 6532 IXGBE_ESDP_SDP1;
6526 6533
6527 if (reg & mask) { 6534 if (reg & mask) {
6528 device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n"); 6535 device_printf(adapter->dev,
 6536 "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
6529 return IXGBE_ERR_FAN_FAILURE; 6537 return IXGBE_ERR_FAN_FAILURE;
6530 } 6538 }
6531 6539
6532 return IXGBE_SUCCESS; 6540 return IXGBE_SUCCESS;
6533} /* ixgbe_check_fan_failure */ 6541} /* ixgbe_check_fan_failure */
6534 6542
6535/************************************************************************ 6543/************************************************************************
6536 * ixgbe_handle_que 6544 * ixgbe_handle_que
6537 ************************************************************************/ 6545 ************************************************************************/
6538static void 6546static void
6539ixgbe_handle_que(void *context) 6547ixgbe_handle_que(void *context)
6540{ 6548{
6541 struct ix_queue *que = context; 6549 struct ix_queue *que = context;
@@ -6662,27 +6670,28 @@ alloc_retry: @@ -6662,27 +6670,28 @@ alloc_retry:
6662 adapter->osdep.intrs = NULL; 6670 adapter->osdep.intrs = NULL;
6663 return ENXIO; 6671 return ENXIO;
6664 } 6672 }
6665 aprint_normal_dev(dev, "interrupting at %s\n", intrstr); 6673 aprint_normal_dev(dev, "interrupting at %s\n", intrstr);
6666 /* 6674 /*
6667 * Try allocating a fast interrupt and the associated deferred 6675 * Try allocating a fast interrupt and the associated deferred
6668 * processing contexts. 6676 * processing contexts.
6669 */ 6677 */
6670 if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) { 6678 if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
6671 txr->txr_si = 6679 txr->txr_si =
6672 softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS, 6680 softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
6673 ixgbe_deferred_mq_start, txr); 6681 ixgbe_deferred_mq_start, txr);
6674 6682
6675 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev)); 6683 snprintf(wqname, sizeof(wqname), "%sdeferTx",
 6684 device_xname(dev));
6676 defertx_error = workqueue_create(&adapter->txr_wq, wqname, 6685 defertx_error = workqueue_create(&adapter->txr_wq, wqname,
6677 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, 6686 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI,
6678 IPL_NET, IXGBE_WORKQUEUE_FLAGS); 6687 IPL_NET, IXGBE_WORKQUEUE_FLAGS);
6679 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int)); 6688 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
6680 } 6689 }
6681 que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS, 6690 que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
6682 ixgbe_handle_que, que); 6691 ixgbe_handle_que, que);
6683 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev)); 6692 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
6684 error = workqueue_create(&adapter->que_wq, wqname, 6693 error = workqueue_create(&adapter->que_wq, wqname,
6685 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 6694 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
6686 IXGBE_WORKQUEUE_FLAGS); 6695 IXGBE_WORKQUEUE_FLAGS);
6687 6696
6688 if ((!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX) 6697 if ((!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)
@@ -6832,27 +6841,28 @@ ixgbe_allocate_msix(struct adapter *adap @@ -6832,27 +6841,28 @@ ixgbe_allocate_msix(struct adapter *adap
6832 ixgbe_handle_que, que); 6841 ixgbe_handle_que, que);
6833 if (que->que_si == NULL) { 6842 if (que->que_si == NULL) {
6834 aprint_error_dev(dev, 6843 aprint_error_dev(dev,
6835 "couldn't establish software interrupt\n"); 6844 "couldn't establish software interrupt\n");
6836 error = ENXIO; 6845 error = ENXIO;
6837 goto err_out; 6846 goto err_out;
6838 } 6847 }
6839 } 6848 }
6840 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev)); 6849 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
6841 error = workqueue_create(&adapter->txr_wq, wqname, 6850 error = workqueue_create(&adapter->txr_wq, wqname,
6842 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 6851 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
6843 IXGBE_WORKQUEUE_FLAGS); 6852 IXGBE_WORKQUEUE_FLAGS);
6844 if (error) { 6853 if (error) {
6845 aprint_error_dev(dev, "couldn't create workqueue for deferred Tx\n"); 6854 aprint_error_dev(dev,
 6855 "couldn't create workqueue for deferred Tx\n");
6846 goto err_out; 6856 goto err_out;
6847 } 6857 }
6848 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int)); 6858 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
6849 6859
6850 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev)); 6860 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
6851 error = workqueue_create(&adapter->que_wq, wqname, 6861 error = workqueue_create(&adapter->que_wq, wqname,
6852 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 6862 ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
6853 IXGBE_WORKQUEUE_FLAGS); 6863 IXGBE_WORKQUEUE_FLAGS);
6854 if (error) { 6864 if (error) {
6855 aprint_error_dev(dev, "couldn't create workqueue for Tx/Rx\n"); 6865 aprint_error_dev(dev, "couldn't create workqueue for Tx/Rx\n");
6856 goto err_out; 6866 goto err_out;
6857 } 6867 }
6858 6868

cvs diff -r1.157 -r1.158 src/sys/dev/pci/ixgbe/ixv.c (expand / switch to unified diff)

--- src/sys/dev/pci/ixgbe/ixv.c 2021/03/31 07:52:14 1.157
+++ src/sys/dev/pci/ixgbe/ixv.c 2021/03/31 07:53:53 1.158
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/*$NetBSD: ixv.c,v 1.157 2021/03/31 07:52:14 msaitoh Exp $*/ 1/*$NetBSD: ixv.c,v 1.158 2021/03/31 07:53:53 msaitoh 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
@@ -2545,48 +2545,49 @@ ixv_add_device_sysctls(struct adapter *a @@ -2545,48 +2545,49 @@ ixv_add_device_sysctls(struct adapter *a
2545 struct sysctllog **log; 2545 struct sysctllog **log;
2546 const struct sysctlnode *rnode, *cnode; 2546 const struct sysctlnode *rnode, *cnode;
2547 device_t dev; 2547 device_t dev;
2548 2548
2549 dev = adapter->dev; 2549 dev = adapter->dev;
2550 log = &adapter->sysctllog; 2550 log = &adapter->sysctllog;
2551 2551
2552 if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { 2552 if ((rnode = ixv_sysctl_instance(adapter)) == NULL) {
2553 aprint_error_dev(dev, "could not create sysctl root\n"); 2553 aprint_error_dev(dev, "could not create sysctl root\n");
2554 return; 2554 return;
2555 } 2555 }
2556 2556
2557 if (sysctl_createv(log, 0, &rnode, &cnode, 2557 if (sysctl_createv(log, 0, &rnode, &cnode,
2558 CTLFLAG_READWRITE, CTLTYPE_INT, 2558 CTLFLAG_READWRITE, CTLTYPE_INT, "debug",
2559 "debug", SYSCTL_DESCR("Debug Info"), 2559 SYSCTL_DESCR("Debug Info"),
2560 ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) 2560 ixv_sysctl_debug, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
2561 aprint_error_dev(dev, "could not create sysctl\n"); 2561 aprint_error_dev(dev, "could not create sysctl\n");
2562 2562
2563 if (sysctl_createv(log, 0, &rnode, &cnode, 2563 if (sysctl_createv(log, 0, &rnode, &cnode,
2564 CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue", 2564 CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue",
2565 SYSCTL_DESCR("Number of jumbo buffers per queue"), 2565 SYSCTL_DESCR("Number of jumbo buffers per queue"),
2566 NULL, 0, &adapter->num_jcl, 0, CTL_CREATE, 2566 NULL, 0, &adapter->num_jcl, 0, CTL_CREATE,
2567 CTL_EOL) != 0) 2567 CTL_EOL) != 0)
2568 aprint_error_dev(dev, "could not create sysctl\n"); 2568 aprint_error_dev(dev, "could not create sysctl\n");
2569 2569
2570 if (sysctl_createv(log, 0, &rnode, &cnode, 2570 if (sysctl_createv(log, 0, &rnode, &cnode,
2571 CTLFLAG_READWRITE, CTLTYPE_BOOL, 2571 CTLFLAG_READWRITE, CTLTYPE_BOOL, "enable_aim",
2572 "enable_aim", SYSCTL_DESCR("Interrupt Moderation"), 2572 SYSCTL_DESCR("Interrupt Moderation"),
2573 NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) 2573 NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
2574 aprint_error_dev(dev, "could not create sysctl\n"); 2574 aprint_error_dev(dev, "could not create sysctl\n");
2575 2575
2576 if (sysctl_createv(log, 0, &rnode, &cnode, 2576 if (sysctl_createv(log, 0, &rnode, &cnode,
2577 CTLFLAG_READWRITE, CTLTYPE_BOOL, 2577 CTLFLAG_READWRITE, CTLTYPE_BOOL, "txrx_workqueue",
2578 "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"), 2578 SYSCTL_DESCR("Use workqueue for packet processing"),
2579 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL) != 0) 2579 NULL, 0, &adapter->txrx_use_workqueue, 0, CTL_CREATE, CTL_EOL)
 2580 != 0)
2580 aprint_error_dev(dev, "could not create sysctl\n"); 2581 aprint_error_dev(dev, "could not create sysctl\n");
2581} 2582}
2582 2583
2583/************************************************************************ 2584/************************************************************************
2584 * ixv_add_stats_sysctls - Add statistic sysctls for the VF. 2585 * ixv_add_stats_sysctls - Add statistic sysctls for the VF.
2585 ************************************************************************/ 2586 ************************************************************************/
2586static void 2587static void
2587ixv_add_stats_sysctls(struct adapter *adapter) 2588ixv_add_stats_sysctls(struct adapter *adapter)
2588{ 2589{
2589 device_t dev = adapter->dev; 2590 device_t dev = adapter->dev;
2590 struct tx_ring *txr = adapter->tx_rings; 2591 struct tx_ring *txr = adapter->tx_rings;
2591 struct rx_ring *rxr = adapter->rx_rings; 2592 struct rx_ring *rxr = adapter->rx_rings;
2592 struct ixgbevf_hw_stats *stats = &adapter->stats.vf; 2593 struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
@@ -2674,53 +2675,52 @@ ixv_add_stats_sysctls(struct adapter *ad @@ -2674,53 +2675,52 @@ ixv_add_stats_sysctls(struct adapter *ad
2674 NULL, adapter->queues[i].evnamebuf, 2675 NULL, adapter->queues[i].evnamebuf,
2675 "Queue Packets Transmitted"); 2676 "Queue Packets Transmitted");
2676#ifndef IXGBE_LEGACY_TX 2677#ifndef IXGBE_LEGACY_TX
2677 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, 2678 evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC,
2678 NULL, adapter->queues[i].evnamebuf, 2679 NULL, adapter->queues[i].evnamebuf,
2679 "Packets dropped in pcq"); 2680 "Packets dropped in pcq");
2680#endif 2681#endif
2681 2682
2682#ifdef LRO 2683#ifdef LRO
2683 struct lro_ctrl *lro = &rxr->lro; 2684 struct lro_ctrl *lro = &rxr->lro;
2684#endif /* LRO */ 2685#endif /* LRO */
2685 2686
2686 if (sysctl_createv(log, 0, &rnode, &cnode, 2687 if (sysctl_createv(log, 0, &rnode, &cnode,
2687 CTLFLAG_READONLY, 2688 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxck",
2688 CTLTYPE_INT, 2689 SYSCTL_DESCR("Receive Descriptor next to check"),
2689 "rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"), 2690 ixv_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
2690 ixv_sysctl_next_to_check_handler, 0, (void *)rxr, 0, 
2691 CTL_CREATE, CTL_EOL) != 0) 2691 CTL_CREATE, CTL_EOL) != 0)
2692 break; 2692 break;
2693 2693
2694 if (sysctl_createv(log, 0, &rnode, &cnode, 2694 if (sysctl_createv(log, 0, &rnode, &cnode,
2695 CTLFLAG_READONLY, 2695 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
2696 CTLTYPE_INT, 2696 SYSCTL_DESCR("Receive Descriptor Head"),
2697 "rxd_head", SYSCTL_DESCR("Receive Descriptor Head"), 
2698 ixv_sysctl_rdh_handler, 0, (void *)rxr, 0, 2697 ixv_sysctl_rdh_handler, 0, (void *)rxr, 0,
2699 CTL_CREATE, CTL_EOL) != 0) 2698 CTL_CREATE, CTL_EOL) != 0)
2700 break; 2699 break;
2701 2700
2702 if (sysctl_createv(log, 0, &rnode, &cnode, 2701 if (sysctl_createv(log, 0, &rnode, &cnode,
2703 CTLFLAG_READONLY, 2702 CTLFLAG_READONLY, CTLTYPE_INT, "rxd_tail",
2704 CTLTYPE_INT, 2703 SYSCTL_DESCR("Receive Descriptor Tail"),
2705 "rxd_tail", SYSCTL_DESCR("Receive Descriptor Tail"), 
2706 ixv_sysctl_rdt_handler, 0, (void *)rxr, 0, 2704 ixv_sysctl_rdt_handler, 0, (void *)rxr, 0,
2707 CTL_CREATE, CTL_EOL) != 0) 2705 CTL_CREATE, CTL_EOL) != 0)
2708 break; 2706 break;
2709 2707
2710 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC, 2708 evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC,
2711 NULL, adapter->queues[i].evnamebuf, "Queue Packets Received"); 2709 NULL, adapter->queues[i].evnamebuf,
 2710 "Queue Packets Received");
2712 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC, 2711 evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC,
2713 NULL, adapter->queues[i].evnamebuf, "Queue Bytes Received"); 2712 NULL, adapter->queues[i].evnamebuf,
 2713 "Queue Bytes Received");
2714 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC, 2714 evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC,
2715 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames"); 2715 NULL, adapter->queues[i].evnamebuf, "Copied RX Frames");
2716 evcnt_attach_dynamic(&rxr->no_jmbuf, EVCNT_TYPE_MISC, 2716 evcnt_attach_dynamic(&rxr->no_jmbuf, EVCNT_TYPE_MISC,
2717 NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf"); 2717 NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf");
2718 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC, 2718 evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC,
2719 NULL, adapter->queues[i].evnamebuf, "Rx discarded"); 2719 NULL, adapter->queues[i].evnamebuf, "Rx discarded");
2720#ifdef LRO 2720#ifdef LRO
2721 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", 2721 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued",
2722 CTLFLAG_RD, &lro->lro_queued, 0, 2722 CTLFLAG_RD, &lro->lro_queued, 0,
2723 "LRO Queued"); 2723 "LRO Queued");
2724 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed", 2724 SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed",
2725 CTLFLAG_RD, &lro->lro_flushed, 0, 2725 CTLFLAG_RD, &lro->lro_flushed, 0,
2726 "LRO Flushed"); 2726 "LRO Flushed");
@@ -3338,37 +3338,37 @@ ixv_allocate_msix(struct adapter *adapte @@ -3338,37 +3338,37 @@ ixv_allocate_msix(struct adapter *adapte
3338 que->que_si 3338 que->que_si
3339 = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS, 3339 = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
3340 ixv_handle_que, que); 3340 ixv_handle_que, que);
3341 if (que->que_si == NULL) { 3341 if (que->que_si == NULL) {
3342 aprint_error_dev(dev, 3342 aprint_error_dev(dev,
3343 "could not establish software interrupt\n"); 3343 "could not establish software interrupt\n");
3344 } 3344 }
3345 } 3345 }
3346 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev)); 3346 snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
3347 error = workqueue_create(&adapter->txr_wq, wqname, 3347 error = workqueue_create(&adapter->txr_wq, wqname,
3348 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 3348 ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
3349 IXGBE_WORKQUEUE_FLAGS); 3349 IXGBE_WORKQUEUE_FLAGS);
3350 if (error) { 3350 if (error) {
3351 aprint_error_dev(dev, "couldn't create workqueue for deferred Tx\n"); 3351 aprint_error_dev(dev,
 3352 "couldn't create workqueue for deferred Tx\n");
3352 } 3353 }
3353 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int)); 3354 adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
3354 3355
3355 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev)); 3356 snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
3356 error = workqueue_create(&adapter->que_wq, wqname, 3357 error = workqueue_create(&adapter->que_wq, wqname,
3357 ixv_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET, 3358 ixv_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
3358 IXGBE_WORKQUEUE_FLAGS); 3359 IXGBE_WORKQUEUE_FLAGS);
3359 if (error) { 3360 if (error) {
3360 aprint_error_dev(dev, 3361 aprint_error_dev(dev, "couldn't create workqueue for Tx/Rx\n");
3361 "couldn't create workqueue for Tx/Rx\n"); 
3362 } 3362 }
3363 3363
3364 /* and Mailbox */ 3364 /* and Mailbox */
3365 cpu_id++; 3365 cpu_id++;
3366 snprintf(intr_xname, sizeof(intr_xname), "%s link", device_xname(dev)); 3366 snprintf(intr_xname, sizeof(intr_xname), "%s link", device_xname(dev));
3367 adapter->vector = vector; 3367 adapter->vector = vector;
3368 intrstr = pci_intr_string(pc, adapter->osdep.intrs[vector], intrbuf, 3368 intrstr = pci_intr_string(pc, adapter->osdep.intrs[vector], intrbuf,
3369 sizeof(intrbuf)); 3369 sizeof(intrbuf));
3370#ifdef IXGBE_MPSAFE 3370#ifdef IXGBE_MPSAFE
3371 pci_intr_setattr(pc, &adapter->osdep.intrs[vector], PCI_INTR_MPSAFE, 3371 pci_intr_setattr(pc, &adapter->osdep.intrs[vector], PCI_INTR_MPSAFE,
3372 true); 3372 true);
3373#endif 3373#endif
3374 /* Set the mbx handler function */ 3374 /* Set the mbx handler function */