Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jul 2015 20:57:00 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285221 - head/sys/dev/cxgbe
Message-ID:  <201507062057.t66Kv0b5090813@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Mon Jul  6 20:56:59 2015
New Revision: 285221
URL: https://svnweb.freebsd.org/changeset/base/285221

Log:
  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.
  
  MFC after:	3 days

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_netmap.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h	Mon Jul  6 20:28:42 2015	(r285220)
+++ head/sys/dev/cxgbe/adapter.h	Mon Jul  6 20:56:59 2015	(r285221)
@@ -1052,7 +1052,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: head/sys/dev/cxgbe/t4_netmap.c
==============================================================================
--- head/sys/dev/cxgbe/t4_netmap.c	Mon Jul  6 20:28:42 2015	(r285220)
+++ head/sys/dev/cxgbe/t4_netmap.c	Mon Jul  6 20:56:59 2015	(r285221)
@@ -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);
@@ -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: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c	Mon Jul  6 20:28:42 2015	(r285220)
+++ head/sys/dev/cxgbe/t4_sge.c	Mon Jul  6 20:56:59 2015	(r285221)
@@ -2903,12 +2903,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);
@@ -2922,7 +2922,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?201507062057.t66Kv0b5090813>