svn commit: r344574 - stable/12/sys/dev/ena

Marcin Wojtas mw at FreeBSD.org
Tue Feb 26 12:22:54 UTC 2019


Author: mw
Date: Tue Feb 26 12:22:53 2019
New Revision: 344574
URL: https://svnweb.freebsd.org/changeset/base/344574

Log:
  Merge ENA OOO RX fixes
  
  MFC r344150-r344151
  
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.

Modified:
  stable/12/sys/dev/ena/ena.c
  stable/12/sys/dev/ena/ena.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ena/ena.c
==============================================================================
--- stable/12/sys/dev/ena/ena.c	Tue Feb 26 09:51:53 2019	(r344573)
+++ stable/12/sys/dev/ena/ena.c	Tue Feb 26 12:22:53 2019	(r344574)
@@ -1046,10 +1046,6 @@ ena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t 
 		    "RX buffer - next to use: %d", next_to_use);
 
 		req_id = rx_ring->free_rx_ids[next_to_use];
-		rc = validate_rx_req_id(rx_ring, req_id);
-		if (unlikely(rc != 0))
-			break;
-
 		rx_info = &rx_ring->rx_buffer_info[req_id];
 
 		rc = ena_alloc_rx_mbuf(adapter, rx_ring, rx_info);
@@ -1472,21 +1468,24 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
 	struct ena_rx_buffer *rx_info;
 	struct ena_adapter *adapter;
 	unsigned int descs = ena_rx_ctx->descs;
+	int rc;
 	uint16_t ntc, len, req_id, buf = 0;
 
 	ntc = *next_to_clean;
 	adapter = rx_ring->adapter;
-	rx_info = &rx_ring->rx_buffer_info[ntc];
 
+	len = ena_bufs[buf].len;
+	req_id = ena_bufs[buf].req_id;
+	rc = validate_rx_req_id(rx_ring, req_id);
+	if (unlikely(rc != 0))
+		return (NULL);
+
+	rx_info = &rx_ring->rx_buffer_info[req_id];
 	if (unlikely(rx_info->mbuf == NULL)) {
 		device_printf(adapter->pdev, "NULL mbuf in rx_info");
 		return (NULL);
 	}
 
-	len = ena_bufs[buf].len;
-	req_id = ena_bufs[buf].req_id;
-	rx_info = &rx_ring->rx_buffer_info[req_id];
-
 	ena_trace(ENA_DBG | ENA_RXPTH, "rx_info %p, mbuf %p, paddr %jx",
 	    rx_info, rx_info->mbuf, (uintmax_t)rx_info->ena_buf.paddr);
 
@@ -1517,6 +1516,16 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
 		++buf;
 		len = ena_bufs[buf].len;
 		req_id = ena_bufs[buf].req_id;
+		rc = validate_rx_req_id(rx_ring, req_id);
+		if (unlikely(rc != 0)) {
+			/*
+			 * If the req_id is invalid, then the device will be
+			 * reset. In that case we must free all mbufs that
+			 * were already gathered.
+			 */
+			m_freem(mbuf);
+			return (NULL);
+		}
 		rx_info = &rx_ring->rx_buffer_info[req_id];
 
 		if (unlikely(rx_info->mbuf == NULL)) {

Modified: stable/12/sys/dev/ena/ena.h
==============================================================================
--- stable/12/sys/dev/ena/ena.h	Tue Feb 26 09:51:53 2019	(r344573)
+++ stable/12/sys/dev/ena/ena.h	Tue Feb 26 12:22:53 2019	(r344574)
@@ -41,7 +41,7 @@
 
 #define DRV_MODULE_VER_MAJOR	0
 #define DRV_MODULE_VER_MINOR	8
-#define DRV_MODULE_VER_SUBMINOR 2
+#define DRV_MODULE_VER_SUBMINOR 3
 
 #define DRV_MODULE_NAME		"ena"
 


More information about the svn-src-all mailing list