Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Aug 2023 12:47:47 GMT
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0834f13da9e3 - main - iavf: remove compatibility code and address some warnings
Message-ID:  <202308231247.37NCllfv042506@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/src/commit/?id=0834f13da9e3b2912368f9ee3467997cd76911a4

commit 0834f13da9e3b2912368f9ee3467997cd76911a4
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2023-08-22 10:45:56 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2023-08-23 12:48:11 +0000

    iavf: remove compatibility code and address some warnings
    
    Code for pre-11 FreeBSD versions is removed.
    Also removed are macros that are not used anymore and "i" variable
    does not shadow anymore other "i" variable.
    
    Differential Revision: https://reviews.freebsd.org/D41547
    Approved by:    erj
---
 sys/dev/iavf/iavf_iflib.h     |  3 ---
 sys/dev/iavf/iavf_lib.h       | 14 --------------
 sys/dev/iavf/iavf_vc_common.c | 34 +++++++++++-----------------------
 sys/dev/iavf/if_iavf_iflib.c  |  4 ++--
 4 files changed, 13 insertions(+), 42 deletions(-)

diff --git a/sys/dev/iavf/iavf_iflib.h b/sys/dev/iavf/iavf_iflib.h
index 927c89fceeed..ec083d66a209 100644
--- a/sys/dev/iavf/iavf_iflib.h
+++ b/sys/dev/iavf/iavf_iflib.h
@@ -122,9 +122,6 @@
     ((struct iavf_sc *)iflib_get_softc(_ctx))
 
 /* Use the correct assert function for each lock type */
-#define IFLIB_CTX_ASSERT(_ctx) \
-    sx_assert(iflib_ctx_lock_get(_ctx), SA_XLOCKED)
-
 #define IAVF_VC_LOCK(_sc)                mtx_lock(&(_sc)->vc_mtx)
 #define IAVF_VC_UNLOCK(_sc)              mtx_unlock(&(_sc)->vc_mtx)
 #define IAVF_VC_LOCK_DESTROY(_sc)        mtx_destroy(&(_sc)->vc_mtx)
diff --git a/sys/dev/iavf/iavf_lib.h b/sys/dev/iavf/iavf_lib.h
index d560d971b0f6..f3ccd9f0c52f 100644
--- a/sys/dev/iavf/iavf_lib.h
+++ b/sys/dev/iavf/iavf_lib.h
@@ -204,20 +204,6 @@ MALLOC_DECLARE(M_IAVF);
 	IAVF_DEFAULT_RSS_HENA_BASE |			\
 	IAVF_DEFAULT_ADV_RSS_HENA)
 
-/* Pre-11 counter(9) compatibility */
-#define IAVF_SET_IPACKETS(vsi, count)	(vsi)->ipackets = (count)
-#define IAVF_SET_IERRORS(vsi, count)	(vsi)->ierrors = (count)
-#define IAVF_SET_OPACKETS(vsi, count)	(vsi)->opackets = (count)
-#define IAVF_SET_OERRORS(vsi, count)	(vsi)->oerrors = (count)
-#define IAVF_SET_COLLISIONS(vsi, count)	/* Do nothing; collisions is always 0. */
-#define IAVF_SET_IBYTES(vsi, count)	(vsi)->ibytes = (count)
-#define IAVF_SET_OBYTES(vsi, count)	(vsi)->obytes = (count)
-#define IAVF_SET_IMCASTS(vsi, count)	(vsi)->imcasts = (count)
-#define IAVF_SET_OMCASTS(vsi, count)	(vsi)->omcasts = (count)
-#define IAVF_SET_IQDROPS(vsi, count)	(vsi)->iqdrops = (count)
-#define IAVF_SET_OQDROPS(vsi, count)	(vsi)->oqdrops = (count)
-#define IAVF_SET_NOPROTO(vsi, count)	(vsi)->noproto = (count)
-
 /* For stats sysctl naming */
 #define IAVF_QUEUE_NAME_LEN 32
 
diff --git a/sys/dev/iavf/iavf_vc_common.c b/sys/dev/iavf/iavf_vc_common.c
index 4577757090f5..8f45fe044094 100644
--- a/sys/dev/iavf/iavf_vc_common.c
+++ b/sys/dev/iavf/iavf_vc_common.c
@@ -39,10 +39,6 @@
  */
 #include "iavf_vc_common.h"
 
-/* busy wait delay in msec */
-#define IAVF_BUSY_WAIT_DELAY 10
-#define IAVF_BUSY_WAIT_COUNT 50
-
 /* Static function decls */
 static void iavf_handle_link_event(struct iavf_sc *sc,
     struct virtchnl_pf_event *vpe);
@@ -662,27 +658,19 @@ void
 iavf_update_stats_counters(struct iavf_sc *sc, struct iavf_eth_stats *es)
 {
 	struct iavf_vsi *vsi = &sc->vsi;
-	uint64_t tx_discards;
-
-	tx_discards = es->tx_discards;
 
 	/* Update ifnet stats */
-	IAVF_SET_IPACKETS(vsi, es->rx_unicast +
-	                   es->rx_multicast +
-			   es->rx_broadcast);
-	IAVF_SET_OPACKETS(vsi, es->tx_unicast +
-	                   es->tx_multicast +
-			   es->tx_broadcast);
-	IAVF_SET_IBYTES(vsi, es->rx_bytes);
-	IAVF_SET_OBYTES(vsi, es->tx_bytes);
-	IAVF_SET_IMCASTS(vsi, es->rx_multicast);
-	IAVF_SET_OMCASTS(vsi, es->tx_multicast);
-
-	IAVF_SET_OERRORS(vsi, es->tx_errors);
-	IAVF_SET_IQDROPS(vsi, es->rx_discards);
-	IAVF_SET_OQDROPS(vsi, tx_discards);
-	IAVF_SET_NOPROTO(vsi, es->rx_unknown_protocol);
-	IAVF_SET_COLLISIONS(vsi, 0);
+	vsi->ipackets = es->rx_unicast + es->rx_multicast + es->rx_broadcast;
+	vsi->opackets = es->tx_unicast + es->tx_multicast + es->tx_broadcast;
+	vsi->ibytes = es->rx_bytes;
+	vsi->obytes = es->tx_bytes;
+	vsi->imcasts = es->rx_multicast;
+	vsi->omcasts = es->tx_multicast;
+
+	vsi->oerrors = es->tx_errors;
+	vsi->iqdrops = es->rx_discards;
+	vsi->oqdrops = es->tx_discards;
+	vsi->noproto = es->rx_unknown_protocol;
 
 	vsi->eth_stats = *es;
 }
diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c
index d53e59e29b51..b2531b797941 100644
--- a/sys/dev/iavf/if_iavf_iflib.c
+++ b/sys/dev/iavf/if_iavf_iflib.c
@@ -728,7 +728,7 @@ iavf_if_init(if_ctx_t ctx)
 
 	INIT_DBG_IF(ifp, "begin");
 
-	IFLIB_CTX_ASSERT(ctx);
+	sx_assert(iflib_ctx_lock_get(ctx), SA_XLOCKED);
 
 	error = iavf_reset_complete(hw);
 	if (error) {
@@ -870,7 +870,7 @@ iavf_if_msix_intr_assign(if_ctx_t ctx, int msix __unused)
 fail:
 	iflib_irq_free(ctx, &vsi->irq);
 	rx_que = vsi->rx_queues;
-	for (int i = 0; i < vsi->num_rx_queues; i++, rx_que++)
+	for (i = 0; i < vsi->num_rx_queues; i++, rx_que++)
 		iflib_irq_free(ctx, &rx_que->que_irq);
 	return (err);
 }



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