Date: Tue, 29 Jan 2019 18:18:55 +0000 (UTC) From: Vincenzo Maffione <vmaffione@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r343559 - in stable/11/sys/dev: ixl netmap Message-ID: <201901291818.x0TIItdF033603@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vmaffione Date: Tue Jan 29 18:18:55 2019 New Revision: 343559 URL: https://svnweb.freebsd.org/changeset/base/343559 Log: ixl: remove unnecessary limitations related to netmap Netmap supports the case where TX rings and RX rings have different size. Remove unnecessary limitations related to netmap support, making the code simpler. Also, check that the value of the hw head index written back from the NIC is valid. Reviewed by: erj Differential Revision: https://reviews.freebsd.org/D18984 Modified: stable/11/sys/dev/ixl/if_ixl.c stable/11/sys/dev/ixl/ixl.h stable/11/sys/dev/ixl/ixl_txrx.c stable/11/sys/dev/netmap/if_ixl_netmap.h Modified: stable/11/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/11/sys/dev/ixl/if_ixl.c Tue Jan 29 18:13:46 2019 (r343558) +++ stable/11/sys/dev/ixl/if_ixl.c Tue Jan 29 18:18:55 2019 (r343559) @@ -659,13 +659,7 @@ ixl_attach(device_t dev) #endif #ifdef DEV_NETMAP - if (vsi->num_rx_desc == vsi->num_tx_desc) { - vsi->queues[0].num_desc = vsi->num_rx_desc; - ixl_netmap_attach(vsi); - } else - device_printf(dev, - "Netmap is not supported when RX and TX descriptor ring sizes differ\n"); - + ixl_netmap_attach(vsi); #endif /* DEV_NETMAP */ #ifdef IXL_IW Modified: stable/11/sys/dev/ixl/ixl.h ============================================================================== --- stable/11/sys/dev/ixl/ixl.h Tue Jan 29 18:13:46 2019 (r343558) +++ stable/11/sys/dev/ixl/ixl.h Tue Jan 29 18:18:55 2019 (r343559) @@ -513,9 +513,6 @@ struct ixl_queue { void *tag; int num_tx_desc; /* both tx and rx */ int num_rx_desc; /* both tx and rx */ -#ifdef DEV_NETMAP - int num_desc; /* for compatibility with current netmap code in kernel */ -#endif struct tx_ring txr; struct rx_ring rxr; struct task task; Modified: stable/11/sys/dev/ixl/ixl_txrx.c ============================================================================== --- stable/11/sys/dev/ixl/ixl_txrx.c Tue Jan 29 18:13:46 2019 (r343558) +++ stable/11/sys/dev/ixl/ixl_txrx.c Tue Jan 29 18:18:55 2019 (r343559) @@ -1587,7 +1587,7 @@ ixl_rx_discard(struct rx_ring *rxr, int i) struct ixl_rx_buf *rbuf; KASSERT(rxr != NULL, ("Receive ring pointer cannot be null")); - KASSERT(i < rxr->que->num_rx_desc, ("Descriptor index must be less than que->num_desc")); + KASSERT(i < rxr->que->num_rx_desc, ("Descriptor index must be less than que->num_rx_desc")); rbuf = &rxr->buffers[i]; Modified: stable/11/sys/dev/netmap/if_ixl_netmap.h ============================================================================== --- stable/11/sys/dev/netmap/if_ixl_netmap.h Tue Jan 29 18:13:46 2019 (r343558) +++ stable/11/sys/dev/netmap/if_ixl_netmap.h Tue Jan 29 18:18:55 2019 (r343559) @@ -129,12 +129,8 @@ ixl_netmap_attach(struct ixl_vsi *vsi) na.ifp = vsi->ifp; na.na_flags = NAF_BDG_MAYSLEEP; - // XXX check that queues is set. - nm_prinf("queues is %p", vsi->queues); - if (vsi->queues) { - na.num_tx_desc = vsi->queues[0].num_desc; - na.num_rx_desc = vsi->queues[0].num_desc; - } + na.num_tx_desc = vsi->num_tx_desc; + na.num_rx_desc = vsi->num_rx_desc; na.nm_txsync = ixl_netmap_txsync; na.nm_rxsync = ixl_netmap_rxsync; na.nm_register = ixl_netmap_reg; @@ -266,8 +262,10 @@ ixl_netmap_txsync(struct netmap_kring *kring, int flag /* * Second part: reclaim buffers for completed transmissions. */ - nic_i = LE32_TO_CPU(*(volatile __le32 *)&txr->base[que->num_desc]); - if (nic_i != txr->next_to_clean) { + nic_i = LE32_TO_CPU(*(volatile __le32 *)&txr->base[que->num_tx_desc]); + if (unlikely(nic_i >= que->num_tx_desc)) { + nm_prerr("error: invalid value of hw head index %u", nic_i); + } else if (nic_i != txr->next_to_clean) { /* some tx completed, increment avail */ txr->next_to_clean = nic_i; kring->nr_hwtail = nm_prev(netmap_idx_n2k(kring, nic_i), lim);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901291818.x0TIItdF033603>