aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-08-12 12:48:35 +0100
committerMichael Brown <mcb30@ipxe.org>2022-08-12 13:03:12 +0100
commitd6e36a2d736efaa9e44784bc58f4d90356774971 (patch)
treea02b107e4910db018cde66f980e4b990ed30a6ec
parent99242bbe2ead2d36eff65aefc2251e822cc4b2c6 (diff)
downloadipxe-d6e36a2d736efaa9e44784bc58f4d90356774971.zip
ipxe-d6e36a2d736efaa9e44784bc58f4d90356774971.tar.gz
ipxe-d6e36a2d736efaa9e44784bc58f4d90356774971.tar.bz2
[intelxl] Set maximum frame size to 9728 bytes as per datasheet
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>
-rw-r--r--src/drivers/net/intelxl.c10
-rw-r--r--src/drivers/net/intelxl.h6
2 files changed, 6 insertions, 10 deletions
diff --git a/src/drivers/net/intelxl.c b/src/drivers/net/intelxl.c
index 3cba4cc..0f5e70d 100644
--- a/src/drivers/net/intelxl.c
+++ b/src/drivers/net/intelxl.c
@@ -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;
diff --git a/src/drivers/net/intelxl.h b/src/drivers/net/intelxl.h
index 7e49326..ddd3e88 100644
--- a/src/drivers/net/intelxl.h
+++ b/src/drivers/net/intelxl.h
@@ -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