From owner-dev-commits-src-all@freebsd.org Sun May 16 03:37:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEC046334A6; Sun, 16 May 2021 03:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjSd65yQ4z3h8x; Sun, 16 May 2021 03:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B49F711D3C; Sun, 16 May 2021 03:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14G3bUAC021175; Sun, 16 May 2021 03:37:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14G3bUPm021174; Sun, 16 May 2021 03:37:30 GMT (envelope-from git) Date: Sun, 16 May 2021 03:37:30 GMT Message-Id: <202105160337.14G3bUPm021174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 294591a4b7be - stable/13 - cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 294591a4b7bea721162764121727dd61da252787 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 03:37:30 -0000 The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=294591a4b7bea721162764121727dd61da252787 commit 294591a4b7bea721162764121727dd61da252787 Author: Navdeep Parhar AuthorDate: 2021-04-23 07:26:47 +0000 Commit: Navdeep Parhar 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); }