Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 May 2021 03:37:30 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 294591a4b7be - stable/13 - cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.
Message-ID:  <202105160337.14G3bUPm021174@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=294591a4b7bea721162764121727dd61da252787

commit 294591a4b7bea721162764121727dd61da252787
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2021-04-23 07:26:47 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2021-05-16 03:36:13 +0000

    cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.
    
    It can be called to (re)apply the settings in the driver softc to the
    hardware.
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 5f00292fe3b76aba9115f3b2dfc887acb647eb91)
---
 sys/dev/cxgbe/t4_main.c | 58 ++++++++++++++++++++++++++++---------------------
 1 file changed, 33 insertions(+), 25 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 1477a30dd0cd..a6ddce1c238f 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -823,6 +823,7 @@ static int mod_event(module_t, int, void *);
 static int notify_siblings(device_t, int);
 static uint64_t vi_get_counter(struct ifnet *, ift_counter);
 static uint64_t cxgbe_get_counter(struct ifnet *, ift_counter);
+static void enable_vxlan_rx(struct adapter *);
 
 struct {
 	uint16_t device;
@@ -11665,12 +11666,38 @@ struct vxlan_evargs {
 };
 
 static void
-t4_vxlan_start(struct adapter *sc, void *arg)
+enable_vxlan_rx(struct adapter *sc)
 {
-	struct vxlan_evargs *v = arg;
+	int i, rc;
 	struct port_info *pi;
 	uint8_t match_all_mac[ETHER_ADDR_LEN] = {0};
-	int i, rc;
+
+	ASSERT_SYNCHRONIZED_OP(sc);
+
+	t4_write_reg(sc, A_MPS_RX_VXLAN_TYPE, V_VXLAN(sc->vxlan_port) |
+	    F_VXLAN_EN);
+	for_each_port(sc, i) {
+		pi = sc->port[i];
+		if (pi->vxlan_tcam_entry == true)
+			continue;
+		rc = t4_alloc_raw_mac_filt(sc, pi->vi[0].viid, match_all_mac,
+		    match_all_mac, sc->rawf_base + pi->port_id, 1, pi->port_id,
+		    true);
+		if (rc < 0) {
+			rc = -rc;
+			CH_ERR(&pi->vi[0],
+			    "failed to add VXLAN TCAM entry: %d.\n", rc);
+		} else {
+			MPASS(rc == sc->rawf_base + pi->port_id);
+			pi->vxlan_tcam_entry = true;
+		}
+	}
+}
+
+static void
+t4_vxlan_start(struct adapter *sc, void *arg)
+{
+	struct vxlan_evargs *v = arg;
 
 	if (sc->nrawf == 0 || chip_id(sc) <= CHELSIO_T5)
 		return;
@@ -11680,32 +11707,13 @@ t4_vxlan_start(struct adapter *sc, void *arg)
 	if (sc->vxlan_refcount == 0) {
 		sc->vxlan_port = v->port;
 		sc->vxlan_refcount = 1;
-		t4_write_reg(sc, A_MPS_RX_VXLAN_TYPE,
-		    V_VXLAN(v->port) | F_VXLAN_EN);
-		for_each_port(sc, i) {
-			pi = sc->port[i];
-			if (pi->vxlan_tcam_entry == true)
-				continue;
-			rc = t4_alloc_raw_mac_filt(sc, pi->vi[0].viid,
-			    match_all_mac, match_all_mac,
-			    sc->rawf_base + pi->port_id, 1, pi->port_id, true);
-			if (rc < 0) {
-				rc = -rc;
-				log(LOG_ERR,
-				    "%s: failed to add VXLAN TCAM entry: %d.\n",
-				    device_get_name(pi->vi[0].dev), rc);
-			} else {
-				MPASS(rc == sc->rawf_base + pi->port_id);
-				rc = 0;
-				pi->vxlan_tcam_entry = true;
-			}
-		}
+		enable_vxlan_rx(sc);
 	} else if (sc->vxlan_port == v->port) {
 		sc->vxlan_refcount++;
 	} else {
-		log(LOG_ERR, "%s: VXLAN already configured on port  %d; "
+		CH_ERR(sc, "VXLAN already configured on port  %d; "
 		    "ignoring attempt to configure it on port %d\n",
-		    device_get_nameunit(sc->dev), sc->vxlan_port, v->port);
+		    sc->vxlan_port, v->port);
 	}
 	end_synchronized_op(sc, 0);
 }



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