Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions drivers/net/ethernet/broadcom/genet/bcmgenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define GENET_Q0_TX_BD_CNT \
(TOTAL_DESC - priv->hw_params->tx_queues * priv->hw_params->tx_bds_per_q)

#define RX_BUF_LENGTH 2048
#define RX_BUF_LENGTH 10240
#define SKB_ALIGNMENT 32

/* Tx/Rx DMA register offset, skip 256 descriptors */
Expand Down Expand Up @@ -2616,6 +2616,14 @@ static void init_umac(struct bcmgenet_priv *priv)
reg |= RBUF_ALIGN_2B | RBUF_64B_EN;
bcmgenet_rbuf_writel(priv, reg, RBUF_CTRL);

/* 8 bit register, units of 16 bytes, and should be aligned to burst
* size (256bytes). So max threshold of 3840 bytes to meet these
* criteria.
* (There will also be a 64 byte status block, giving 3904 bytes total)
*/
reg = 0xf0;
bcmgenet_rbuf_writel(priv, reg, RBUF_PKT_RDY_THLD);

/* enable rx checksumming */
reg = bcmgenet_rbuf_readl(priv, RBUF_CHK_CTRL);
reg |= RBUF_RXCHK_EN | RBUF_L3_PARSE_DIS;
Expand Down Expand Up @@ -3955,6 +3963,10 @@ static int bcmgenet_probe(struct platform_device *pdev)
priv->tx_pause = 1;
priv->rx_pause = 1;

dev->mtu = ETH_DATA_LEN;
dev->min_mtu = ETH_MIN_MTU;
dev->max_mtu = ENET_MAX_MTU_SIZE;

SET_NETDEV_DEV(dev, &pdev->dev);
dev_set_drvdata(&pdev->dev, dev);
dev->watchdog_timeo = 2 * HZ;
Expand Down Expand Up @@ -4021,7 +4033,7 @@ static int bcmgenet_probe(struct platform_device *pdev)

/* Mii wait queue */
init_waitqueue_head(&priv->wq);
/* Always use RX_BUF_LENGTH (2KB) buffer for all chips */
/* Always use RX_BUF_LENGTH (10KB) buffer for all chips */
priv->rx_buf_len = RX_BUF_LENGTH;
INIT_WORK(&priv->bcmgenet_irq_work, bcmgenet_irq_task);

Expand Down
12 changes: 7 additions & 5 deletions drivers/net/ethernet/broadcom/genet/bcmgenet.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
/* which ring is descriptor based */
#define DESC_INDEX 16

/* Body(1500) + EH_SIZE(14) + VLANTAG(4) + BRCMTAG(6) + FCS(4) = 1528.
* 1536 is multiple of 256 bytes
/* The hardware is always triggering on 3840bytes received or end of packet, and
* the driver doesn't handle fragmentation.
* With that threshold, packets with an MTU of up to 3824 are received
* correctly.
*/
#define ENET_BRCM_TAG_LEN 6
#define ENET_PAD 8
#define ENET_MAX_MTU_SIZE (ETH_DATA_LEN + ETH_HLEN + VLAN_HLEN + \
ENET_BRCM_TAG_LEN + ETH_FCS_LEN + ENET_PAD)
#define ENET_MAX_MTU_SIZE 3824
#define DMA_MAX_BURST_LENGTH 0x10

/* misc. configuration */
Expand Down Expand Up @@ -219,6 +219,8 @@ struct bcmgenet_rx_stats64 {
#define RBUF_ALIGN_2B (1 << 1)
#define RBUF_BAD_DIS (1 << 2)

#define RBUF_PKT_RDY_THLD 0x08

#define RBUF_STATUS 0x0C
#define RBUF_STATUS_WOL (1 << 0)
#define RBUF_STATUS_MPD_INTR_ACTIVE (1 << 1)
Expand Down
Loading