Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Feb 2022 23:53:52 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 257cd2f8c3c5 - stable/13 - if_oce: fix epoch handling
Message-ID:  <202202222353.21MNrqtR051067@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=257cd2f8c3c5f43dc6c16d49bea731d4c872ebec

commit 257cd2f8c3c5f43dc6c16d49bea731d4c872ebec
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-12-18 22:43:00 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-22 23:52:15 +0000

    if_oce: fix epoch handling
    
    Thanks to gallatin@ for suggesting the patch.
    
    PR:                     260330
    Reported by:            Vincent Milum Jr.
    Reviewed by:            gallatin, glebius
    Tested by:              Vincent Milum Jr.
    Differential Revision:  https://reviews.freebsd.org/D33395
    
    (cherry picked from commit e363f832cfb283a543fa8e47ebd9e51817994fde)
---
 sys/dev/oce/oce_if.c    | 6 +++++-
 sys/dev/oce/oce_if.h    | 1 +
 sys/dev/oce/oce_queue.c | 5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c
index 271c35015a9f..1127565282c1 100644
--- a/sys/dev/oce/oce_if.c
+++ b/sys/dev/oce/oce_if.c
@@ -2039,14 +2039,17 @@ exit_rq_handler_lro:
 uint16_t
 oce_rq_handler(void *arg)
 {
+	struct epoch_tracker et;
 	struct oce_rq *rq = (struct oce_rq *)arg;
 	struct oce_cq *cq = rq->cq;
 	POCE_SOFTC sc = rq->parent;
 	struct oce_nic_rx_cqe *cqe;
 	int num_cqes = 0;
 
+	NET_EPOCH_ENTER(et);
 	if(rq->islro) {
 		oce_rq_handler_lro(arg);
+		NET_EPOCH_EXIT(et);
 		return 0;
 	}
 	LOCK(&rq->rx_lock);
@@ -2090,6 +2093,7 @@ oce_rq_handler(void *arg)
 
 	oce_check_rx_bufs(sc, num_cqes, rq);
 	UNLOCK(&rq->rx_lock);
+	NET_EPOCH_EXIT(et);
 	return 0;
 
 }
@@ -2110,7 +2114,7 @@ oce_attach_ifp(POCE_SOFTC sc)
 	ifmedia_add(&sc->media, IFM_ETHER | IFM_AUTO, 0, NULL);
 	ifmedia_set(&sc->media, IFM_ETHER | IFM_AUTO);
 
-	sc->ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST;
+	sc->ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_KNOWSEPOCH;
 	sc->ifp->if_ioctl = oce_ioctl;
 	sc->ifp->if_start = oce_start;
 	sc->ifp->if_init = oce_init;
diff --git a/sys/dev/oce/oce_if.h b/sys/dev/oce/oce_if.h
index 8938dd86ecce..c7386aab68f8 100644
--- a/sys/dev/oce/oce_if.h
+++ b/sys/dev/oce/oce_if.h
@@ -42,6 +42,7 @@
 
 #include <sys/param.h>
 #include <sys/endian.h>
+#include <sys/epoch.h>
 #include <sys/eventhandler.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
diff --git a/sys/dev/oce/oce_queue.c b/sys/dev/oce/oce_queue.c
index 04c92a5f397b..da4d33065d40 100644
--- a/sys/dev/oce/oce_queue.c
+++ b/sys/dev/oce/oce_queue.c
@@ -1233,13 +1233,15 @@ oce_rx_cq_clean(struct oce_rq *rq)
 void
 oce_stop_rx(POCE_SOFTC sc)
 {
+        struct epoch_tracker et;
         struct oce_mbx mbx;
         struct mbx_delete_nic_rq *fwcmd;
         struct mbx_delete_nic_rq_v1 *fwcmd1;
         struct oce_rq *rq;
         int i = 0;
 
-       /* before deleting disable hwlro */
+        NET_EPOCH_ENTER(et);
+        /* before deleting disable hwlro */
 	if(sc->enable_hwlro)
         	oce_mbox_nic_set_iface_lro_config(sc, 0);
 
@@ -1274,6 +1276,7 @@ oce_stop_rx(POCE_SOFTC sc)
 			UNLOCK(&rq->rx_lock);
                 }
         }
+        NET_EPOCH_EXIT(et);
 }
 
 int



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