arch: imxrt: Introduce CONFIG_NET_GUARDSIZE to imxrt_enet.c

Summary:
- In the previous imxrt_enet.c, imxrt_enet.c assumed that
  CONFIG_NET_ETH_PKTSIZE includes the ethernet CRC (4bytes)
- However, most of the driver implementation explicitly
  add CONFIG_NET_GUARDSIZE for the CRC to the internal buffer
- This commit conforms to such rules

Imapct:
- No impact

Testing:
- Tested with iperf with imxrt1060-evk
- NOTE: need to add the following configs
  +CONFIG_EXAMPLES_IPERF=y
  +CONFIG_EXAMPLES_IPERFTEST_DEVNAME="eth0"
  +CONFIG_IOB_NBUFFERS=128
  +CONFIG_NET_ETH_PKTSIZE=1514
  +CONFIG_NET_GUARDSIZE=4
  +CONFIG_RR_INTERVAL=200

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2021-02-04 11:27:09 +09:00 committed by Xiang Xiao
parent 0e8cce4dee
commit 12a515ebb6

View File

@ -259,7 +259,8 @@
#define BUF ((struct eth_hdr_s *)priv->dev.d_buf) #define BUF ((struct eth_hdr_s *)priv->dev.d_buf)
#define IMXRT_BUF_SIZE ENET_ALIGN_UP(CONFIG_NET_ETH_PKTSIZE) #define IMXRT_BUF_SIZE ENET_ALIGN_UP(CONFIG_NET_ETH_PKTSIZE + \
CONFIG_NET_GUARDSIZE)
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
@ -2293,11 +2294,13 @@ static inline int imxrt_initphy(struct imxrt_driver_s *priv, bool renogphy)
#ifdef CONFIG_IMXRT_ENETUSEMII #ifdef CONFIG_IMXRT_ENETUSEMII
rcr = ENET_RCR_CRCFWD | rcr = ENET_RCR_CRCFWD |
CONFIG_NET_ETH_PKTSIZE << ENET_RCR_MAX_FL_SHIFT | (CONFIG_NET_ETH_PKTSIZE + CONFIG_NET_GUARDSIZE)
<< ENET_RCR_MAX_FL_SHIFT |
ENET_RCR_MII_MODE; ENET_RCR_MII_MODE;
#else #else
rcr = ENET_RCR_RMII_MODE | ENET_RCR_CRCFWD | rcr = ENET_RCR_RMII_MODE | ENET_RCR_CRCFWD |
CONFIG_NET_ETH_PKTSIZE << ENET_RCR_MAX_FL_SHIFT | (CONFIG_NET_ETH_PKTSIZE + CONFIG_NET_GUARDSIZE)
<< ENET_RCR_MAX_FL_SHIFT |
ENET_RCR_MII_MODE; ENET_RCR_MII_MODE;
#endif #endif
tcr = 0; tcr = 0;