Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Aug 2015 04:00:37 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r286274 - stable/10/sys/dev/cxgbe
Message-ID:  <201508040400.t7440bDv079492@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Aug  4 04:00:36 2015
New Revision: 286274
URL: https://svnweb.freebsd.org/changeset/base/286274

Log:
  MFC r284988, r285220, and r285221.
  
  r284988:
  cxgbe(4): request an automatic tx update when a netmap tx queue idles.
  The NIC tx queues already do this.
  
  r285220:
  cxgbe(4): Do not override the the global defaults for congestion drops.
  The hw.cxgbe.cong_drop knob is not affected by this change because the
  driver sets up congestion drop on a per-queue basis.
  
  r285221:
  cxgbe(4): Add a new knob that controls the congestion response of netmap
  rx queues.  The default is to drop rather than backpressure.
  
  This decouples the congestion settings of NIC and netmap rx queues.

Modified:
  stable/10/sys/dev/cxgbe/adapter.h
  stable/10/sys/dev/cxgbe/t4_netmap.c
  stable/10/sys/dev/cxgbe/t4_sge.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/cxgbe/adapter.h
==============================================================================
--- stable/10/sys/dev/cxgbe/adapter.h	Tue Aug  4 03:43:09 2015	(r286273)
+++ stable/10/sys/dev/cxgbe/adapter.h	Tue Aug  4 04:00:36 2015	(r286274)
@@ -1045,7 +1045,7 @@ void t4_update_fl_bufsize(struct ifnet *
 int parse_pkt(struct mbuf **);
 void *start_wrq_wr(struct sge_wrq *, int, struct wrq_cookie *);
 void commit_wrq_wr(struct sge_wrq *, void *, struct wrq_cookie *);
-int tnl_cong(struct port_info *);
+int tnl_cong(struct port_info *, int);
 
 /* t4_tracer.c */
 struct t4_tracer;

Modified: stable/10/sys/dev/cxgbe/t4_netmap.c
==============================================================================
--- stable/10/sys/dev/cxgbe/t4_netmap.c	Tue Aug  4 03:43:09 2015	(r286273)
+++ stable/10/sys/dev/cxgbe/t4_netmap.c	Tue Aug  4 04:00:36 2015	(r286274)
@@ -77,6 +77,15 @@ int holdoff_tmr_idx = 2;
 SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_holdoff_tmr_idx, CTLFLAG_RWTUN,
     &holdoff_tmr_idx, 0, "Holdoff timer index for netmap rx queues.");
 
+/*
+ * Congestion drops.
+ * -1: no congestion feedback (not recommended).
+ *  0: backpressure the channel instead of dropping packets right away.
+ *  1: no backpressure, drop packets for the congested queue immediately.
+ */
+static int nm_cong_drop = 1;
+TUNABLE_INT("hw.cxgbe.nm_cong_drop", &nm_cong_drop);
+
 /* netmap ifnet routines */
 static void cxgbe_nm_init(void *);
 static int cxgbe_nm_ioctl(struct ifnet *, unsigned long, caddr_t);
@@ -405,8 +414,8 @@ alloc_nm_txq_hwq(struct port_info *pi, s
 	    V_FW_EQ_ETH_CMD_VFN(0));
 	c.alloc_to_len16 = htobe32(F_FW_EQ_ETH_CMD_ALLOC |
 	    F_FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c));
-	c.autoequiqe_to_viid = htobe32(F_FW_EQ_ETH_CMD_AUTOEQUEQE |
-	    V_FW_EQ_ETH_CMD_VIID(pi->nm_viid));
+	c.autoequiqe_to_viid = htobe32(F_FW_EQ_ETH_CMD_AUTOEQUIQE |
+	    F_FW_EQ_ETH_CMD_AUTOEQUEQE | V_FW_EQ_ETH_CMD_VIID(pi->nm_viid));
 	c.fetchszm_to_iqid =
 	    htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) |
 		V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO |
@@ -503,7 +512,7 @@ cxgbe_netmap_on(struct adapter *sc, stru
 	nm_set_native_flags(na);
 
 	for_each_nm_rxq(pi, i, nm_rxq) {
-		alloc_nm_rxq_hwq(pi, nm_rxq, tnl_cong(pi));
+		alloc_nm_rxq_hwq(pi, nm_rxq, tnl_cong(pi, nm_cong_drop));
 		nm_rxq->fl_hwidx = hwidx;
 		slot = netmap_reset(na, NR_RX, i, 0);
 		MPASS(slot != NULL);	/* XXXNM: error check, not assert */

Modified: stable/10/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- stable/10/sys/dev/cxgbe/t4_sge.c	Tue Aug  4 03:43:09 2015	(r286273)
+++ stable/10/sys/dev/cxgbe/t4_sge.c	Tue Aug  4 04:00:36 2015	(r286274)
@@ -471,12 +471,6 @@ t4_tweak_chip_settings(struct adapter *s
 	    V_TIMERVALUE5(us_to_core_ticks(sc, intr_timer[5]));
 	t4_write_reg(sc, A_SGE_TIMER_VALUE_4_AND_5, v);
 
-	if (cong_drop == 0) {
-		m = F_TUNNELCNGDROP0 | F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 |
-		    F_TUNNELCNGDROP3;
-		t4_set_reg_field(sc, A_TP_PARA_REG3, m, 0);
-	}
-
 	/* 4K, 16K, 64K, 256K DDP "page sizes" */
 	v = V_HPZ0(0) | V_HPZ1(2) | V_HPZ2(4) | V_HPZ3(6);
 	t4_write_reg(sc, A_ULP_RX_TDDP_PSZ, v);
@@ -684,17 +678,6 @@ t4_read_chip_settings(struct adapter *sc
 	s->timer_val[4] = G_TIMERVALUE4(r) / core_ticks_per_usec(sc);
 	s->timer_val[5] = G_TIMERVALUE5(r) / core_ticks_per_usec(sc);
 
-	if (cong_drop == 0) {
-		m = F_TUNNELCNGDROP0 | F_TUNNELCNGDROP1 | F_TUNNELCNGDROP2 |
-		    F_TUNNELCNGDROP3;
-		r = t4_read_reg(sc, A_TP_PARA_REG3);
-		if (r & m) {
-			device_printf(sc->dev,
-			    "invalid TP_PARA_REG3(0x%x)\n", r);
-			rc = EINVAL;
-		}
-	}
-
 	v = V_HPZ0(0) | V_HPZ1(2) | V_HPZ2(4) | V_HPZ3(6);
 	r = t4_read_reg(sc, A_ULP_RX_TDDP_PSZ);
 	if (r != v) {
@@ -2915,12 +2898,12 @@ free_mgmtq(struct adapter *sc)
 }
 
 int
-tnl_cong(struct port_info *pi)
+tnl_cong(struct port_info *pi, int drop)
 {
 
-	if (cong_drop == -1)
+	if (drop == -1)
 		return (-1);
-	else if (cong_drop == 1)
+	else if (drop == 1)
 		return (0);
 	else
 		return (pi->rx_chan_map);
@@ -2934,7 +2917,8 @@ alloc_rxq(struct port_info *pi, struct s
 	struct sysctl_oid_list *children;
 	char name[16];
 
-	rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx, tnl_cong(pi));
+	rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx,
+	    tnl_cong(pi, cong_drop));
 	if (rc != 0)
 		return (rc);
 



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