]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[intelxl] Set maximum frame size to 9728 bytes as per datasheet
authorMichael Brown <mcb30@ipxe.org>
Fri, 12 Aug 2022 11:48:35 +0000 (12:48 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 12 Aug 2022 12:03:12 +0000 (13:03 +0100)
The PRTGL_SAH register contains the current maximum frame size, and is
not guaranteed on reset to contain the actual maximum frame size
supported by the hardware, which the datasheet specifies as 9728 bytes
(including the 4-byte CRC).

Set the maximum packet size to a hardcoded 9728 bytes instead of
reading from the PRTGL_SAH register.

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

index 3cba4ccc34007d512841387656a84408bc679bc4..0f5e70d76c5fe8b7d3c2ef150f1efdd3973ba093 100644 (file)
@@ -63,8 +63,6 @@ static int intelxl_fetch_mac ( struct intelxl_nic *intelxl,
        union intelxl_receive_address mac;
        uint32_t prtpm_sal;
        uint32_t prtpm_sah;
-       uint32_t prtgl_sah;
-       size_t mfs;
 
        /* Read NVM-loaded address */
        prtpm_sal = readl ( intelxl->regs + INTELXL_PRTPM_SAL );
@@ -84,11 +82,6 @@ static int intelxl_fetch_mac ( struct intelxl_nic *intelxl,
               intelxl, eth_ntoa ( mac.raw ) );
        memcpy ( netdev->hw_addr, mac.raw, ETH_ALEN );
 
-       /* Get maximum frame size */
-       prtgl_sah = readl ( intelxl->regs + INTELXL_PRTGL_SAH );
-       mfs = INTELXL_PRTGL_SAH_MFS_GET ( prtgl_sah );
-       netdev->max_pkt_len = ( mfs - 4 /* CRC */ );
-
        return 0;
 }
 
@@ -1363,7 +1356,7 @@ static int intelxl_open ( struct net_device *netdev ) {
        memcpy ( mac.raw, netdev->ll_addr, sizeof ( mac.raw ) );
        prtgl_sal = le32_to_cpu ( mac.reg.low );
        prtgl_sah = ( le32_to_cpu ( mac.reg.high ) |
-                     INTELXL_PRTGL_SAH_MFS_SET ( intelxl->mfs ) );
+                     INTELXL_PRTGL_SAH_MFS ( intelxl->mfs ) );
        writel ( prtgl_sal, intelxl->regs + INTELXL_PRTGL_SAL );
        writel ( prtgl_sah, intelxl->regs + INTELXL_PRTGL_SAH );
 
@@ -1639,6 +1632,7 @@ static int intelxl_probe ( struct pci_device *pci ) {
                goto err_alloc;
        }
        netdev_init ( netdev, &intelxl_operations );
+       netdev->max_pkt_len = INTELXL_MAX_PKT_LEN;
        intelxl = netdev->priv;
        pci_set_drvdata ( pci, netdev );
        netdev->dev = &pci->dev;
index 7e4932619bb28b7c9ca81822661b6bb8c761e634..ddd3e888c0229d9c96ffbe53a333ae622c4c0797 100644 (file)
@@ -750,6 +750,9 @@ intelxl_init_ring ( struct intelxl_ring *ring, unsigned int count, size_t len,
  */
 #define INTELXL_RX_FILL 16
 
+/** Maximum packet length (excluding CRC) */
+#define INTELXL_MAX_PKT_LEN ( 9728 - 4 /* CRC */ )
+
 /******************************************************************************
  *
  * Top level
@@ -826,8 +829,7 @@ intelxl_init_ring ( struct intelxl_ring *ring, unsigned int count, size_t len,
 
 /** Port MAC Address High Register */
 #define INTELXL_PRTGL_SAH 0x1e2140
-#define INTELXL_PRTGL_SAH_MFS_GET(x)   ( (x) >> 16 )   /**< Max frame size */
-#define INTELXL_PRTGL_SAH_MFS_SET(x)   ( (x) << 16 )   /**< Max frame size */
+#define INTELXL_PRTGL_SAH_MFS(x)       ( (x) << 16 )   /**< Max frame size */
 
 /** Physical Function MAC Address Low Register */
 #define INTELXL_PRTPM_SAL 0x1e4440