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@semihalf.com> Submitted by: Michal Krawczyk <mk@semihalf.com> Obtained from: Semihalf Sponsored by: Amazon, Inc MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27116
This commit is contained in:
parent
9eb1615f33
commit
c74443892c
@ -2797,6 +2797,8 @@ ena_config_host_info(struct ena_com_dev *ena_dev, device_t dev)
|
||||
(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)) {
|
||||
|
@ -431,6 +431,10 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_rx_buf_info *ena_bufs,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user