net: iflib: let the drivers use isc_capenable

Since isc_capenable (private copy of ifp->if_capenable) is
now synchronized to if_capenable, use it in the drivers
when checking the IFCAP_* bits.
This results in better cache usage and avoids indirection
through the ifp pointer.

PR:             260068
Reviewed by:    kbowling, gallatin
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D33156
This commit is contained in:
Vincenzo Maffione 2021-12-28 11:00:32 +00:00
parent 4561c4f0ca
commit 52f45d8ace
5 changed files with 10 additions and 7 deletions

View File

@ -706,7 +706,7 @@ em_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
i++;
} while (!eop);
if (if_getcapenable(ri->iri_ifp) & IFCAP_RXCSUM)
if (scctx->isc_capenable & IFCAP_RXCSUM)
em_receive_checksum(staterr, staterr >> 24, ri);
if (staterr & E1000_RXD_STAT_VP) {

View File

@ -665,6 +665,7 @@ static int
iavf_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
{
struct iavf_vsi *vsi = arg;
if_softc_ctx_t scctx = vsi->shared;
struct iavf_rx_queue *que = &vsi->rx_queues[ri->iri_qsidx];
struct rx_ring *rxr = &que->rxr;
union iavf_rx_desc *cur;
@ -726,7 +727,7 @@ iavf_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
rxr->packets++;
rxr->rx_packets++;
if ((if_getcapenable(vsi->ifp) & IFCAP_RXCSUM) != 0)
if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0)
iavf_rx_checksum(ri, status, error, ptype);
ri->iri_flowid = le32toh(cur->wb.qword0.hi_dword.rss);
ri->iri_rsstype = iavf_ptype_to_hash(ptype);

View File

@ -282,6 +282,7 @@ static int
ice_ift_rxd_pkt_get(void *arg, if_rxd_info_t ri)
{
struct ice_softc *sc = (struct ice_softc *)arg;
if_softc_ctx_t scctx = sc->scctx;
struct ice_rx_queue *rxq = &sc->pf_vsi.rx_queues[ri->iri_qsidx];
union ice_32b_rx_flex_desc *cur;
u16 status0, plen, vtag, ptype;
@ -334,7 +335,7 @@ ice_ift_rxd_pkt_get(void *arg, if_rxd_info_t ri)
rxq->stats.rx_packets++;
rxq->stats.rx_bytes += ri->iri_len;
if ((iflib_get_ifp(sc->ctx)->if_capenable & IFCAP_RXCSUM) != 0)
if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0)
ice_rx_checksum(rxq, &ri->iri_csum_flags,
&ri->iri_csum_data, status0, ptype);
ri->iri_flowid = le32toh(RX_FLEX_NIC(&cur->wb, rss_hash));

View File

@ -393,9 +393,9 @@ static int
ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
{
struct ixgbe_softc *sc = arg;
if_softc_ctx_t scctx = sc->shared;
struct ix_rx_queue *que = &sc->rx_queues[ri->iri_qsidx];
struct rx_ring *rxr = &que->rxr;
struct ifnet *ifp = iflib_get_ifp(sc->ctx);
union ixgbe_adv_rx_desc *rxd;
uint16_t pkt_info, len, cidx, i;
@ -433,7 +433,7 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
/* Make sure bad packets are discarded */
if (eop && (staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) {
if (sc->feat_en & IXGBE_FEATURE_VF)
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
if_inc_counter(ri->iri_ifp, IFCOUNTER_IERRORS, 1);
rxr->rx_discarded++;
return (EBADMSG);
@ -452,7 +452,7 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
rxr->packets++;
rxr->rx_bytes += ri->iri_len;
if ((ifp->if_capenable & IFCAP_RXCSUM) != 0)
if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0)
ixgbe_rx_checksum(staterr, ri, ptype);
ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss);

View File

@ -658,6 +658,7 @@ static int
ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
{
struct ixl_vsi *vsi = arg;
if_softc_ctx_t scctx = vsi->shared;
struct ixl_rx_queue *que = &vsi->rx_queues[ri->iri_qsidx];
struct rx_ring *rxr = &que->rxr;
union i40e_rx_desc *cur;
@ -719,7 +720,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
rxr->packets++;
rxr->rx_packets++;
if ((if_getcapenable(vsi->ifp) & IFCAP_RXCSUM) != 0)
if ((scctx->isc_capenable & IFCAP_RXCSUM) != 0)
rxr->csum_errs += ixl_rx_checksum(ri, status, error, ptype);
ri->iri_flowid = le32toh(cur->wb.qword0.hi_dword.rss);
ri->iri_rsstype = ixl_ptype_to_hash(ptype);