The branch main has been updated by np:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5f00292fe3b76aba9115f3b2dfc887acb647eb91

commit 5f00292fe3b76aba9115f3b2dfc887acb647eb91
Author:     Navdeep Parhar <[email protected]>
AuthorDate: 2021-04-23 07:26:47 +0000
Commit:     Navdeep Parhar <[email protected]>
CommitDate: 2021-04-23 07:26:47 +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.
    
    MFC after:      2 weeks
    Sponsored by:   Chelsio Communications
---
 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 6774e1bbb833..6e5d263c7649 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;
@@ -11671,12 +11672,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;
@@ -11686,32 +11713,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);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to