]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ena] Increase receive ring size to 128 entries
authorMichael Brown <mcb30@ipxe.org>
Fri, 26 Aug 2022 12:17:48 +0000 (13:17 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 26 Aug 2022 18:38:27 +0000 (19:38 +0100)
Some versions of the ENA hardware (observed on a c6i.large instance in
eu-west-2) seem to require a receive ring containing at least 128
entries: any smaller ring will never see receive completions or will
stall after the first few completions.

Increase the receive ring size to 128 entries (determined empirically)
for compatibility with these hardware versions.  Limit the receive
ring fill level to 16 (as at present) to avoid consuming more memory
than will typically be available in the internal heap.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/ena.c
src/drivers/net/ena.h

index c2a48a27d0d52b3f0eb2aea739f2893d8845b176..400ae44fac0c9e5c0bb28074085992a4decc8b86 100644 (file)
@@ -395,7 +395,7 @@ static int ena_create_sq ( struct ena_nic *ena, struct ena_sq *sq,
        sq->phase = ENA_SQE_PHASE;
 
        /* Calculate fill level */
-       sq->fill = sq->count;
+       sq->fill = sq->max;
        if ( sq->fill > cq->actual )
                sq->fill = cq->actual;
 
@@ -1010,11 +1010,11 @@ static int ena_probe ( struct pci_device *pci ) {
        ena->acq.phase = ENA_ACQ_PHASE;
        ena_cq_init ( &ena->tx.cq, ENA_TX_COUNT,
                      sizeof ( ena->tx.cq.cqe.tx[0] ) );
-       ena_sq_init ( &ena->tx.sq, ENA_SQ_TX, ENA_TX_COUNT,
+       ena_sq_init ( &ena->tx.sq, ENA_SQ_TX, ENA_TX_COUNT, ENA_TX_COUNT,
                      sizeof ( ena->tx.sq.sqe.tx[0] ), ena->tx_ids );
        ena_cq_init ( &ena->rx.cq, ENA_RX_COUNT,
                      sizeof ( ena->rx.cq.cqe.rx[0] ) );
-       ena_sq_init ( &ena->rx.sq, ENA_SQ_RX, ENA_RX_COUNT,
+       ena_sq_init ( &ena->rx.sq, ENA_SQ_RX, ENA_RX_COUNT, ENA_RX_FILL,
                      sizeof ( ena->rx.sq.sqe.rx[0] ), ena->rx_ids );
 
        /* Fix up PCI device */
index cbee1e768a97ac82311934993717cad06b8f6233..4e1896e86b07eaf71b11284f6cbe0816942ff68a 100644 (file)
@@ -28,7 +28,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define ENA_TX_COUNT 16
 
 /** Number of receive queue entries */
-#define ENA_RX_COUNT 16
+#define ENA_RX_COUNT 128
+
+/** Receive queue maximum fill level */
+#define ENA_RX_FILL 16
 
 /** Base address low register offset */
 #define ENA_BASE_LO 0x0
@@ -608,6 +611,8 @@ struct ena_sq {
        uint8_t direction;
        /** Number of entries */
        uint8_t count;
+       /** Maximum fill level */
+       uint8_t max;
        /** Fill level (limited to completion queue size) */
        uint8_t fill;
 };
@@ -618,16 +623,18 @@ struct ena_sq {
  * @v sq               Submission queue
  * @v direction                Direction
  * @v count            Number of entries
+ * @v max              Maximum fill level
  * @v size             Size of each entry
  * @v ids              Buffer IDs
  */
 static inline __attribute__ (( always_inline )) void
 ena_sq_init ( struct ena_sq *sq, unsigned int direction, unsigned int count,
-             size_t size, uint8_t *ids ) {
+             unsigned int max, size_t size, uint8_t *ids ) {
 
        sq->len = ( count * size );
        sq->direction = direction;
        sq->count = count;
+       sq->max = max;
        sq->ids = ids;
 }