svn commit: r298290 - stable/7/sys/dev/bxe

David C Somayajulu davidcs at FreeBSD.org
Tue Apr 19 19:19:00 UTC 2016


Author: davidcs
Date: Tue Apr 19 19:18:59 2016
New Revision: 298290
URL: https://svnweb.freebsd.org/changeset/base/298290

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 at qlogic.com;venkata.bhavaraju at qlogic.com

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

Modified: stable/7/sys/dev/bxe/bxe.c
==============================================================================
--- stable/7/sys/dev/bxe/bxe.c	Tue Apr 19 19:14:04 2016	(r298289)
+++ stable/7/sys/dev/bxe/bxe.c	Tue Apr 19 19:18:59 2016	(r298290)
@@ -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 {
@@ -5729,11 +5733,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;
@@ -5741,6 +5740,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);
@@ -9942,21 +9946,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.
@@ -12299,6 +12288,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)) {
@@ -12321,6 +12312,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) {
@@ -16169,6 +16202,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/7/sys/dev/bxe/bxe_stats.h
==============================================================================
--- stable/7/sys/dev/bxe/bxe_stats.h	Tue Apr 19 19:14:04 2016	(r298289)
+++ stable/7/sys/dev/bxe/bxe_stats.h	Tue Apr 19 19:18:59 2016	(r298290)
@@ -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 {


More information about the svn-src-stable-7 mailing list