The branch stable/13 has been updated by kbowling:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f09f2763b67fcbf65d7cac5b114eab72308cde60

commit f09f2763b67fcbf65d7cac5b114eab72308cde60
Author:     Kevin Bowling <kbowl...@freebsd.org>
AuthorDate: 2023-08-10 14:41:21 +0000
Commit:     Kevin Bowling <kbowl...@freebsd.org>
CommitDate: 2023-08-17 00:30:32 +0000

    igc: sync srrctl buffer sizing with e1000
    
    Approved by:    grehan
    Differential Revision:  https://reviews.freebsd.org/D31493
    
    (cherry picked from commit 0eb8cd1de26849cbaefaf3bc59aa9612fa0dfa52)
---
 sys/dev/igc/if_igc.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
index 826a35e7e15e..49d4755d057c 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -1986,6 +1986,7 @@ igc_initialize_transmit_unit(if_ctx_t ctx)
  *  Enable receive unit.
  *
  **********************************************************************/
+#define BSIZEPKT_ROUNDUP       ((1<<IGC_SRRCTL_BSIZEPKT_SHIFT)-1)
 
 static void
 igc_initialize_receive_unit(if_ctx_t ctx)
@@ -2051,24 +2052,19 @@ igc_initialize_receive_unit(if_ctx_t ctx)
                igc_initialize_rss_mapping(adapter);
 
        if (if_getmtu(ifp) > ETHERMTU) {
-               /* Set maximum packet len */
-               if (adapter->rx_mbuf_sz <= 4096) {
-                       srrctl |= 4096 >> IGC_SRRCTL_BSIZEPKT_SHIFT;
-                       rctl |= IGC_RCTL_SZ_4096 | IGC_RCTL_BSEX;
-               } else if (adapter->rx_mbuf_sz > 4096) {
-                       srrctl |= 8192 >> IGC_SRRCTL_BSIZEPKT_SHIFT;
-                       rctl |= IGC_RCTL_SZ_8192 | IGC_RCTL_BSEX;
-               }
                psize = scctx->isc_max_frame_size;
                /* are we on a vlan? */
                if (ifp->if_vlantrunk != NULL)
                        psize += VLAN_TAG_SIZE;
                IGC_WRITE_REG(&adapter->hw, IGC_RLPML, psize);
-       } else {
-               srrctl |= 2048 >> IGC_SRRCTL_BSIZEPKT_SHIFT;
-               rctl |= IGC_RCTL_SZ_2048;
        }
 
+       /* Set maximum packet buffer len */
+       srrctl |= (adapter->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >>
+           IGC_SRRCTL_BSIZEPKT_SHIFT;
+       /* srrctl above overrides this but set the register to a sane value */
+       rctl |= IGC_RCTL_SZ_2048;
+
        /*
         * If TX flow control is disabled and there's >1 queue defined,
         * enable DROP.

Reply via email to