Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Update ixg(4) and ixv(4) up to FreeBSD r28...



details:   https://anonhg.NetBSD.org/src/rev/0a100d339310
branches:  trunk
changeset: 349252:0a100d339310
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Dec 02 10:24:31 2016 +0000

description:
Update ixg(4) and ixv(4) up to FreeBSD r285590:
- Fix igxbe SRIOV VF (if_ixv) initialization bugs.  The MAC address for
  an if_ixv instance can now set at creation time, and the receive ring
  tail pointer is correctly initialized (previously, things still worked
  because the receive ring tail pointer was being fixed up as a side
  effect of other activity).

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c   |  100 +++++++++++++++++++++++------------------
 sys/dev/pci/ixgbe/ixgbe.c     |   17 ++++--
 sys/dev/pci/ixgbe/ixgbe.h     |    5 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h |    4 +-
 sys/dev/pci/ixgbe/ixgbe_vf.c  |    6 +-
 sys/dev/pci/ixgbe/ixv.c       |   12 ++--
 6 files changed, 81 insertions(+), 63 deletions(-)

diffs (267 lines):

diff -r 6fb92c2557b6 -r 0a100d339310 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Fri Dec 02 10:21:43 2016 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Fri Dec 02 10:24:31 2016 +0000
@@ -58,8 +58,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 283881 2015-06-01 17:15:25Z jfv $*/
-/*$NetBSD: ix_txrx.c,v 1.5 2016/12/02 10:21:43 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 285528 2015-07-14 09:13:18Z hiren $*/
+/*$NetBSD: ix_txrx.c,v 1.6 2016/12/02 10:24:31 msaitoh Exp $*/
 
 #include "ixgbe.h"
 
@@ -1985,52 +1985,62 @@
                                ixgbe_rx_checksum(staterr, sendmp, ptype,
                                   &adapter->stats.pf);
                        }
-#if __FreeBSD_version >= 800000
-#ifdef RSS
-                       sendmp->m_pkthdr.flowid =
-                           le32toh(cur->wb.lower.hi_dword.rss);
-#if __FreeBSD_version < 1100054
-                       sendmp->m_flags |= M_FLOWID;
+#if 0 /* FreeBSD */
+                        /*
+                         * In case of multiqueue, we have RXCSUM.PCSD bit set
+                         * and never cleared. This means we have RSS hash
+                         * available to be used.   
+                         */
+                        if (adapter->num_queues > 1) {
+                                sendmp->m_pkthdr.flowid =
+                                    le32toh(cur->wb.lower.hi_dword.rss);
+                                switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) {  
+                                    case IXGBE_RXDADV_RSSTYPE_IPV4:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_IPV4);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV4_TCP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_TCP_IPV4);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_IPV6);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_TCP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_TCP_IPV6);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_EX:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_IPV6_EX);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_TCP_IPV6_EX);
+                                        break;
+#if __FreeBSD_version > 1100000
+                                    case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_UDP_IPV4);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_UDP_IPV6);
+                                        break;
+                                    case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_RSS_UDP_IPV6_EX);
+                                        break;
 #endif
-                       switch (pkt_info & IXGBE_RXDADV_RSSTYPE_MASK) {
-                       case IXGBE_RXDADV_RSSTYPE_IPV4_TCP:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV4);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV4:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV4);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV6_TCP:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV6);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV6_EX:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV6_EX);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV6:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV6);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV6_EX);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_UDP_IPV4);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_UDP_IPV6);
-                               break;
-                       case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
-                               M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_UDP_IPV6_EX);
-                               break;
-                       default:
+                                    default:
+                                        M_HASHTYPE_SET(sendmp,
+                                            M_HASHTYPE_OPAQUE);
+                                }
+                        } else {
+                                sendmp->m_pkthdr.flowid = que->msix;
                                M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE);
                        }
-#else /* RSS */
-                       sendmp->m_pkthdr.flowid = que->msix;
-#if __FreeBSD_version >= 1100054
-                       M_HASHTYPE_SET(sendmp, M_HASHTYPE_OPAQUE);
-#else
-                       sendmp->m_flags |= M_FLOWID;
-#endif
-#endif /* RSS */
 #endif /* FreeBSD_version */
                }
 next_desc:
diff -r 6fb92c2557b6 -r 0a100d339310 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Dec 02 10:21:43 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Dec 02 10:24:31 2016 +0000
@@ -58,8 +58,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 283881 2015-06-01 17:15:25Z jfv $*/
-/*$NetBSD: ixgbe.c,v 1.45 2016/12/02 10:21:43 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 285590 2015-07-15 00:35:50Z pkelsey $*/
+/*$NetBSD: ixgbe.c,v 1.46 2016/12/02 10:24:31 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -262,6 +262,9 @@
 
 MODULE_DEPEND(ix, pci, 1, 1, 1);
 MODULE_DEPEND(ix, ether, 1, 1, 1);
+#ifdef DEV_NETMAP
+MODULE_DEPEND(ix, netmap, 1, 1, 1);
+#endif /* DEV_NETMAP */
 #endif
 
 /*
@@ -3277,10 +3280,12 @@
                 * so we do not need to clear the bit, but do it just in case
                 * this code is moved elsewhere.
                 */
-               if (adapter->num_queues > 1 && adapter->fc == ixgbe_fc_none)
+               if (adapter->num_queues > 1 &&
+                   adapter->hw.fc.requested_mode == ixgbe_fc_none) {
                        srrctl |= IXGBE_SRRCTL_DROP_EN;
-               else
+               } else {
                        srrctl &= ~IXGBE_SRRCTL_DROP_EN;
+               }
 
                IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(j), srrctl);
 
@@ -5530,10 +5535,10 @@
     uint32_t *msg)
 {
 
-       switch (msg[0]) {
+       switch (msg[1]) {
        case IXGBE_API_VER_1_0:
        case IXGBE_API_VER_1_1:
-               vf->api_ver = msg[0];
+               vf->api_ver = msg[1];
                ixgbe_send_vf_ack(adapter, vf, msg[0]);
                break;
        default:
diff -r 6fb92c2557b6 -r 0a100d339310 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Fri Dec 02 10:21:43 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Fri Dec 02 10:24:31 2016 +0000
@@ -58,8 +58,8 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 283881 2015-06-01 17:15:25Z jfv $*/
-/*$NetBSD: ixgbe.h,v 1.13 2016/12/02 10:21:43 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 283893 2015-06-01 20:05:06Z jhb $*/
+/*$NetBSD: ixgbe.h,v 1.14 2016/12/02 10:24:31 msaitoh Exp $*/
 
 
 #ifndef _IXGBE_H_
@@ -111,6 +111,7 @@
 #ifdef PCI_IOV
 #include <sys/nv.h>
 #include <sys/iov_schema.h>
+#include <dev/pci/pci_iov.h>
 #endif
 
 #include "ixgbe_netbsd.h"
diff -r 6fb92c2557b6 -r 0a100d339310 sys/dev/pci/ixgbe/ixgbe_mbx.h
--- a/sys/dev/pci/ixgbe/ixgbe_mbx.h     Fri Dec 02 10:21:43 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_mbx.h     Fri Dec 02 10:24:31 2016 +0000
@@ -30,8 +30,8 @@
   POSSIBILITY OF SUCH DAMAGE.
 
 ******************************************************************************/
-/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.h 283881 2015-06-01 17:15:25Z jfv $*/
-/*$NetBSD: ixgbe_mbx.h,v 1.7 2016/12/02 10:21:43 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.h 283883 2015-06-01 17:43:34Z jfv $*/
+/*$NetBSD: ixgbe_mbx.h,v 1.8 2016/12/02 10:24:31 msaitoh Exp $*/
 
 #ifndef _IXGBE_MBX_H_
 #define _IXGBE_MBX_H_
diff -r 6fb92c2557b6 -r 0a100d339310 sys/dev/pci/ixgbe/ixgbe_vf.c
--- a/sys/dev/pci/ixgbe/ixgbe_vf.c      Fri Dec 02 10:21:43 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.c      Fri Dec 02 10:24:31 2016 +0000
@@ -30,8 +30,8 @@
   POSSIBILITY OF SUCH DAMAGE.
 
 ******************************************************************************/
-/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 283881 2015-06-01 17:15:25Z jfv $*/
-/*$NetBSD: ixgbe_vf.c,v 1.9 2016/12/02 10:21:43 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 285590 2015-07-15 00:35:50Z pkelsey $*/
+/*$NetBSD: ixgbe_vf.c,v 1.10 2016/12/02 10:24:31 msaitoh Exp $*/
 
 
 #include "ixgbe_api.h"
@@ -226,6 +226,8 @@
        if (ret_val)
                return ret_val;
 
+       msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
+
        if (msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK) &&
            msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK))
                return IXGBE_ERR_INVALID_MAC_ADDR;
diff -r 6fb92c2557b6 -r 0a100d339310 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Fri Dec 02 10:21:43 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Fri Dec 02 10:24:31 2016 +0000
@@ -30,8 +30,8 @@
   POSSIBILITY OF SUCH DAMAGE.
 
 ******************************************************************************/
-/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 283881 2015-06-01 17:15:25Z jfv $*/
-/*$NetBSD: ixv.c,v 1.23 2016/12/02 10:21:43 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 285590 2015-07-15 00:35:50Z pkelsey $*/
+/*$NetBSD: ixv.c,v 1.24 2016/12/02 10:24:31 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1743,10 +1743,6 @@
                reg |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF;
                IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(i), reg);
 
-               /* Set the Tail Pointer */
-               IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr->me),
-                   adapter->num_rx_desc - 1);
-
                /* Set the processing limit */
                rxr->process_limit = ixv_rx_process_limit;
 
@@ -1765,6 +1761,10 @@
                                msec_delay(1);
                }
                wmb();
+
+               /* Set the Tail Pointer */
+               IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr->me),
+                   adapter->num_rx_desc - 1);
        }
 
        rxcsum = IXGBE_READ_REG(hw, IXGBE_RXCSUM);



Home | Main Index | Thread Index | Old Index