svn commit: r367800 - head/sys/dev/ena

Marcin Wojtas mw at FreeBSD.org
Wed Nov 18 15:02:13 UTC 2020


Author: mw
Date: Wed Nov 18 15:02:12 2020
New Revision: 367800
URL: https://svnweb.freebsd.org/changeset/base/367800

Log:
  Add Rx offsets support for the ENA driver
  
  For the first descriptor in a chain the data may start at an offset.
  It is optional feature of some devices, so the driver must ack that
  it supports it.
  
  The data pointer of the mbuf is simply shifted by the given value.
  
  Submitted by:   Maciej Bielski <mba at semihalf.com>
  Submitted by:   Michal Krawczyk <mk at semihalf.com>
  Obtained from:  Semihalf
  Sponsored by:   Amazon, Inc
  MFC after:      1 week
  Differential revision:  https://reviews.freebsd.org/D27116

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena_datapath.c

Modified: head/sys/dev/ena/ena.c
==============================================================================
--- head/sys/dev/ena/ena.c	Wed Nov 18 14:59:22 2020	(r367799)
+++ head/sys/dev/ena/ena.c	Wed Nov 18 15:02:12 2020	(r367800)
@@ -2797,6 +2797,8 @@ ena_config_host_info(struct ena_com_dev *ena_dev, devi
 		(DRV_MODULE_VER_MINOR << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) |
 		(DRV_MODULE_VER_SUBMINOR << ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT);
 	host_info->num_cpus = mp_ncpus;
+	host_info->driver_supported_features =
+	    ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK;
 
 	rc = ena_com_set_host_attributes(ena_dev);
 	if (unlikely(rc != 0)) {

Modified: head/sys/dev/ena/ena_datapath.c
==============================================================================
--- head/sys/dev/ena/ena_datapath.c	Wed Nov 18 14:59:22 2020	(r367799)
+++ head/sys/dev/ena/ena_datapath.c	Wed Nov 18 15:02:12 2020	(r367800)
@@ -431,6 +431,10 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
 	mbuf->m_flags |= M_PKTHDR;
 	mbuf->m_pkthdr.len = len;
 	mbuf->m_len = len;
+	// Only for the first segment the data starts at specific offset
+	mbuf->m_data = mtodo(mbuf, ena_rx_ctx->pkt_offset);
+	ena_trace(NULL, ENA_DBG | ENA_RXPTH,
+		"Mbuf data offset=%u\n", ena_rx_ctx->pkt_offset);
 	mbuf->m_pkthdr.rcvif = rx_ring->que->adapter->ifp;
 
 	/* Fill mbuf with hash key and it's interpretation for optimization */
@@ -575,6 +579,8 @@ ena_rx_cleanup(struct ena_ring *rx_ring)
 		ena_rx_ctx.ena_bufs = rx_ring->ena_bufs;
 		ena_rx_ctx.max_bufs = adapter->max_rx_sgl_size;
 		ena_rx_ctx.descs = 0;
+		ena_rx_ctx.pkt_offset = 0;
+
 		bus_dmamap_sync(io_cq->cdesc_addr.mem_handle.tag,
 		    io_cq->cdesc_addr.mem_handle.map, BUS_DMASYNC_POSTREAD);
 		rc = ena_com_rx_pkt(io_cq, io_sq, &ena_rx_ctx);


More information about the svn-src-all mailing list