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
This commit is contained in:
Piotr Kubaj 2023-08-22 12:45:56 +02:00
parent 838c8c4786
commit 0834f13da9
4 changed files with 12 additions and 41 deletions

View file

@ -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)

View file

@ -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

View file

@ -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);
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;
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->oerrors = es->tx_errors;
vsi->iqdrops = es->rx_discards;
vsi->oqdrops = es->tx_discards;
vsi->noproto = es->rx_unknown_protocol;
vsi->eth_stats = *es;
}

View file

@ -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);
}