Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Apr 2016 18:57:31 +0000 (UTC)
From:      David C Somayajulu <davidcs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r298283 - stable/9/sys/dev/bxe
Message-ID:  <201604191857.u3JIvV5q008971@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davidcs
Date: Tue Apr 19 18:57:31 2016
New Revision: 298283
URL: https://svnweb.freebsd.org/changeset/base/298283

Log:
  MFC r297873
  
  1. Process tx completions in bxe_periodic_callout_func() and restart
     transmissions if possible.
  2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED
  3. remove code not needed in bxe_init_internal_common()
  
  Submitted by:vaishali.kulkarni@qlogic.com;venkata.bhavaraju@qlogic.com

Modified:
  stable/9/sys/dev/bxe/bxe.c
  stable/9/sys/dev/bxe/bxe_stats.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/bxe/bxe.c
==============================================================================
--- stable/9/sys/dev/bxe/bxe.c	Tue Apr 19 18:47:34 2016	(r298282)
+++ stable/9/sys/dev/bxe/bxe.c	Tue Apr 19 18:57:31 2016	(r298283)
@@ -498,7 +498,9 @@ static const struct {
     { STATS_OFFSET32(mbuf_alloc_sge),
                 4, STATS_FLAGS_FUNC, "mbuf_alloc_sge"},
     { STATS_OFFSET32(mbuf_alloc_tpa),
-                4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}
+                4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"},
+    { STATS_OFFSET32(tx_queue_full_return),
+                4, STATS_FLAGS_FUNC, "tx_queue_full_return"}
 };
 
 static const struct {
@@ -609,7 +611,9 @@ static const struct {
     { Q_STATS_OFFSET32(mbuf_alloc_sge),
                 4, "mbuf_alloc_sge"},
     { Q_STATS_OFFSET32(mbuf_alloc_tpa),
-                4, "mbuf_alloc_tpa"}
+                4, "mbuf_alloc_tpa"},
+    { Q_STATS_OFFSET32(tx_queue_full_return),
+                4, "tx_queue_full_return"}
 };
 
 #define BXE_NUM_ETH_STATS   ARRAY_SIZE(bxe_eth_stats_arr)
@@ -4626,7 +4630,7 @@ bxe_ioctl(struct ifnet *ifp,
             if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
                 /* set the receive mode flags */
                 bxe_set_rx_mode(sc);
-            } else {
+            } else if(sc->state != BXE_STATE_DISABLED) {
 		bxe_init_locked(sc);
             }
         } else {
@@ -5737,11 +5741,6 @@ bxe_tx_start(struct ifnet *ifp)
         return;
     }
 
-    if (ifp->if_drv_flags & IFF_DRV_OACTIVE) {
-        BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n");
-        return;
-    }
-
     if (!sc->link_vars.link_up) {
         BLOGW(sc, "Interface link is down, ignoring transmit request\n");
         return;
@@ -5749,6 +5748,11 @@ bxe_tx_start(struct ifnet *ifp)
 
     fp = &sc->fp[0];
 
+    if (ifp->if_drv_flags & IFF_DRV_OACTIVE) {
+        fp->eth_q_stats.tx_queue_full_return++;
+        return;
+    }
+
     BXE_FP_TX_LOCK(fp);
     bxe_tx_start_locked(sc, ifp, fp);
     BXE_FP_TX_UNLOCK(fp);
@@ -9950,21 +9954,6 @@ bxe_init_internal_common(struct bxe_soft
 {
     int i;
 
-    if (IS_MF_SI(sc)) {
-        /*
-         * In switch independent mode, the TSTORM needs to accept
-         * packets that failed classification, since approximate match
-         * mac addresses aren't written to NIG LLH.
-         */
-        REG_WR8(sc,
-                (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET),
-                2);
-    } else if (!CHIP_IS_E1(sc)) { /* 57710 doesn't support MF */
-        REG_WR8(sc,
-                (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET),
-                0);
-    }
-
     /*
      * Zero this manually as its initialization is currently missing
      * in the initTool.
@@ -12307,6 +12296,8 @@ static void
 bxe_periodic_callout_func(void *xsc)
 {
     struct bxe_softc *sc = (struct bxe_softc *)xsc;
+    struct bxe_fastpath *fp;
+    uint16_t tx_bd_avail;
     int i;
 
     if (!BXE_CORE_TRYLOCK(sc)) {
@@ -12329,6 +12320,48 @@ bxe_periodic_callout_func(void *xsc)
         return;
     }
 
+#if __FreeBSD_version >= 800000
+
+    FOR_EACH_QUEUE(sc, i) {
+        fp = &sc->fp[i];
+
+        if (BXE_FP_TX_TRYLOCK(fp)) {
+            struct ifnet *ifp = sc->ifnet;
+            /*
+             * If interface was stopped due to unavailable
+             * bds, try to process some tx completions
+             */
+            (void) bxe_txeof(sc, fp);
+           
+            tx_bd_avail = bxe_tx_avail(sc, fp);
+            if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) {
+                bxe_tx_mq_start_locked(sc, ifp, fp, NULL);
+            }
+            BXE_FP_TX_UNLOCK(fp);
+        }
+    }
+
+#else
+
+    fp = &sc->fp[0];
+    if (BXE_FP_TX_TRYLOCK(fp)) {
+        struct ifnet *ifp = sc->ifnet;
+        /*
+         * If interface was stopped due to unavailable
+         * bds, try to process some tx completions
+         */
+        (void) bxe_txeof(sc, fp);
+           
+        tx_bd_avail = bxe_tx_avail(sc, fp);
+        if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) {
+            bxe_tx_start_locked(sc, ifp, fp);
+        }
+ 
+        BXE_FP_TX_UNLOCK(fp);
+    }
+
+#endif /* #if __FreeBSD_version >= 800000 */
+
     /* Check for TX timeouts on any fastpath. */
     FOR_EACH_QUEUE(sc, i) {
         if (bxe_watchdog(sc, &sc->fp[i]) != 0) {
@@ -16177,6 +16210,7 @@ bxe_detach(device_t dev)
     if (sc->state != BXE_STATE_CLOSED) {
         BXE_CORE_LOCK(sc);
         bxe_nic_unload(sc, UNLOAD_CLOSE, TRUE);
+        sc->state = BXE_STATE_DISABLED;
         BXE_CORE_UNLOCK(sc);
     }
 

Modified: stable/9/sys/dev/bxe/bxe_stats.h
==============================================================================
--- stable/9/sys/dev/bxe/bxe_stats.h	Tue Apr 19 18:47:34 2016	(r298282)
+++ stable/9/sys/dev/bxe/bxe_stats.h	Tue Apr 19 18:57:31 2016	(r298283)
@@ -263,6 +263,9 @@ struct bxe_eth_stats {
     uint32_t mbuf_alloc_rx;
     uint32_t mbuf_alloc_sge;
     uint32_t mbuf_alloc_tpa;
+
+    /* num. of times tx queue full occured */
+    uint32_t tx_queue_full_return;
 };
 
 
@@ -366,6 +369,9 @@ struct bxe_eth_q_stats {
     uint32_t mbuf_alloc_rx;
     uint32_t mbuf_alloc_sge;
     uint32_t mbuf_alloc_tpa;
+
+    /* num. of times tx queue full occured */
+    uint32_t tx_queue_full_return;
 };
 
 struct bxe_eth_stats_old {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604191857.u3JIvV5q008971>