mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 12:33:27 +08:00
Rename CONFIG_NET_BUFSIZE to CONFIG_NET_ETH_MTU is all MCU Ethernet drivers
This commit is contained in:
@@ -1161,7 +1161,7 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
||||
|
||||
/* Check if the received packet will fit within the uIP packet buffer */
|
||||
|
||||
if (packetlen < (CONFIG_NET_BUFSIZE + 4))
|
||||
if (packetlen < (CONFIG_NET_ETH_MTU + 4))
|
||||
{
|
||||
/* Get the packet memory from words #2 and #3 of descriptor */
|
||||
|
||||
@@ -1222,7 +1222,7 @@ static void c5471_receive(struct c5471_driver_s *c5471)
|
||||
* to uIP for processing.
|
||||
*/
|
||||
|
||||
if (packetlen > 0 && packetlen < CONFIG_NET_BUFSIZE)
|
||||
if (packetlen > 0 && packetlen < CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
/* Set amount of data in c5471->c_dev.d_len. */
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ struct kinetis_driver_s
|
||||
* requirements.
|
||||
*/
|
||||
|
||||
uint8_t buffers[NENET_NBUFFERS * CONFIG_NET_BUFSIZE + 16];
|
||||
uint8_t buffers[NENET_NBUFFERS * CONFIG_NET_ETH_MTU + 16];
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -833,7 +833,7 @@ static int kinetis_ifup(struct net_driver_s *dev)
|
||||
|
||||
/* Set the RX buffer size */
|
||||
|
||||
putreg32(CONFIG_NET_BUFSIZE, KINETIS_ENET_MRBR);
|
||||
putreg32(CONFIG_NET_ETH_MTU, KINETIS_ENET_MRBR);
|
||||
|
||||
/* Point to the start of the circular RX buffer descriptor queue */
|
||||
|
||||
@@ -1247,10 +1247,10 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
|
||||
|
||||
#if CONFIG_ENET_USEMII
|
||||
rcr = ENET_RCR_MII_MODE | ENET_RCR_CRCFWD |
|
||||
CONFIG_NET_BUFSIZE << ENET_RCR_MAX_FL_SHIFT;
|
||||
CONFIG_NET_ETH_MTU << ENET_RCR_MAX_FL_SHIFT;
|
||||
#else
|
||||
rcr = ENET_RCR_RMII_MODE | ENET_RCR_CRCFWD |
|
||||
CONFIG_NET_BUFSIZE << ENET_RCR_MAX_FL_SHIFT;
|
||||
CONFIG_NET_ETH_MTU << ENET_RCR_MAX_FL_SHIFT;
|
||||
#endif
|
||||
tcr = 0;
|
||||
|
||||
@@ -1328,7 +1328,7 @@ static void kinetis_initbuffers(struct kinetis_driver_s *priv)
|
||||
#ifdef CONFIG_ENET_ENHANCEDBD
|
||||
priv->txdesc[i].status2 = TXDESC_IINS | TXDESC_PINS;
|
||||
#endif
|
||||
addr += CONFIG_NET_BUFSIZE;
|
||||
addr += CONFIG_NET_ETH_MTU;
|
||||
}
|
||||
|
||||
/* Then fill in the RX descriptors */
|
||||
@@ -1342,7 +1342,7 @@ static void kinetis_initbuffers(struct kinetis_driver_s *priv)
|
||||
priv->rxdesc[i].bdu = 0;
|
||||
priv->rxdesc[i].status2 = RXDESC_INT;
|
||||
#endif
|
||||
addr += CONFIG_NET_BUFSIZE;
|
||||
addr += CONFIG_NET_ETH_MTU;
|
||||
}
|
||||
|
||||
/* Set the wrap bit in the last descriptors to form a ring */
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
/* Descriptor Memory Layout *********************************************************/
|
||||
/* EMAC DMA RAM and descriptor definitions. The configured number of descriptors
|
||||
* will determine the organization and the size of the descriptor and status tables.
|
||||
* There is a complex interaction between the maximum packet size (CONFIG_NET_BUFSIZE)
|
||||
* There is a complex interaction between the maximum packet size (CONFIG_NET_ETH_MTU)
|
||||
* and the number of Rx and Tx descriptors that can be suppored (CONFIG_NET_NRXDESC
|
||||
* and CONFIG_NET_NTXDESC): Small buffers -> more packets. This is something that
|
||||
* needs to be tuned for you system.
|
||||
@@ -137,7 +137,7 @@
|
||||
*
|
||||
* An example with all of the details:
|
||||
*
|
||||
* NTXDESC=18 NRXDESC=18 CONFIG_NET_EMACRAM_SIZE=16Kb CONFIG_NET_BUFSIZE=420:
|
||||
* NTXDESC=18 NRXDESC=18 CONFIG_NET_EMACRAM_SIZE=16Kb CONFIG_NET_ETH_MTU=420:
|
||||
* LPC17_TXDESCTAB_SIZE = 18*8 = 144
|
||||
* LPC17_TXSTATTAB_SIZE = 18*4 = 72
|
||||
* LPC17_TXTAB_SIZE = 216
|
||||
@@ -209,7 +209,7 @@
|
||||
#define LPC17_PKTMEM_SIZE (LPC17_EMACRAM_SIZE-LPC17_DESCTAB_SIZE)
|
||||
#define LPC17_PKTMEM_END (LPC17_EMACRAM_BASE+LPC17_PKTMEM_SIZE)
|
||||
|
||||
#define LPC17_MAXPACKET_SIZE ((CONFIG_NET_BUFSIZE + CONFIG_NET_GUARDSIZE + 3) & ~3)
|
||||
#define LPC17_MAXPACKET_SIZE ((CONFIG_NET_ETH_MTU + CONFIG_NET_GUARDSIZE + 3) & ~3)
|
||||
#define LPC17_NTXPKTS CONFIG_NET_NTXDESC
|
||||
#define LPC17_NRXPKTS CONFIG_NET_NRXDESC
|
||||
|
||||
|
||||
@@ -822,7 +822,7 @@ static void lpc17_rxdone(struct lpc17_driver_s *priv)
|
||||
* imply that the packet is too big.
|
||||
*/
|
||||
|
||||
/* else */ if (pktlen > CONFIG_NET_BUFSIZE + CONFIG_NET_GUARDSIZE)
|
||||
/* else */ if (pktlen > CONFIG_NET_ETH_MTU + CONFIG_NET_GUARDSIZE)
|
||||
{
|
||||
nlldbg("Too big. considx: %08x prodidx: %08x pktlen: %d rxstat: %08x\n",
|
||||
considx, prodidx, pktlen, *rxstat);
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
#endif
|
||||
|
||||
#define EMAC_RX_UNITSIZE 128 /* Fixed size for RX buffer */
|
||||
#define EMAC_TX_UNITSIZE CONFIG_NET_BUFSIZE /* MAX size for Ethernet packet */
|
||||
#define EMAC_TX_UNITSIZE CONFIG_NET_ETH_MTU /* MAX size for Ethernet packet */
|
||||
|
||||
/* We need at least one more free buffer than transmit buffers */
|
||||
|
||||
@@ -1010,9 +1010,9 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
||||
/* Get the number of bytes to copy from the buffer */
|
||||
|
||||
copylen = EMAC_RX_UNITSIZE;
|
||||
if ((pktlen + copylen) > CONFIG_NET_BUFSIZE)
|
||||
if ((pktlen + copylen) > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
copylen = CONFIG_NET_BUFSIZE - pktlen;
|
||||
copylen = CONFIG_NET_ETH_MTU - pktlen;
|
||||
}
|
||||
|
||||
/* Get the data source. Invalidate the source memory region to
|
||||
@@ -1133,7 +1133,7 @@ static void sam_receive(struct sam_emac_s *priv)
|
||||
* (this should not happen)
|
||||
*/
|
||||
|
||||
if (dev->d_len > CONFIG_NET_BUFSIZE)
|
||||
if (dev->d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
#endif
|
||||
|
||||
#define EMAC_RX_UNITSIZE 128 /* Fixed size for RX buffer */
|
||||
#define EMAC_TX_UNITSIZE CONFIG_NET_BUFSIZE /* MAX size for Ethernet packet */
|
||||
#define EMAC_TX_UNITSIZE CONFIG_NET_ETH_MTU /* MAX size for Ethernet packet */
|
||||
|
||||
/* We need at least one more free buffer than transmit buffers */
|
||||
|
||||
@@ -1033,9 +1033,9 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
||||
/* Get the number of bytes to copy from the buffer */
|
||||
|
||||
copylen = EMAC_RX_UNITSIZE;
|
||||
if ((pktlen + copylen) > CONFIG_NET_BUFSIZE)
|
||||
if ((pktlen + copylen) > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
copylen = CONFIG_NET_BUFSIZE - pktlen;
|
||||
copylen = CONFIG_NET_ETH_MTU - pktlen;
|
||||
}
|
||||
|
||||
/* Get the data source. Invalidate the source memory region to
|
||||
@@ -1173,7 +1173,7 @@ static void sam_receive(struct sam_emac_s *priv)
|
||||
* (this should not happen)
|
||||
*/
|
||||
|
||||
if (dev->d_len > CONFIG_NET_BUFSIZE)
|
||||
if (dev->d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@
|
||||
#endif
|
||||
|
||||
#define EMAC_RX_UNITSIZE 128 /* Fixed size for RX buffer */
|
||||
#define EMAC_TX_UNITSIZE CONFIG_NET_BUFSIZE /* MAX size for Ethernet packet */
|
||||
#define EMAC_TX_UNITSIZE CONFIG_NET_ETH_MTU /* MAX size for Ethernet packet */
|
||||
|
||||
/* Timing *******************************************************************/
|
||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per
|
||||
@@ -1359,9 +1359,9 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
||||
/* Get the number of bytes to copy from the buffer */
|
||||
|
||||
copylen = EMAC_RX_UNITSIZE;
|
||||
if ((pktlen + copylen) > CONFIG_NET_BUFSIZE)
|
||||
if ((pktlen + copylen) > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
copylen = CONFIG_NET_BUFSIZE - pktlen;
|
||||
copylen = CONFIG_NET_ETH_MTU - pktlen;
|
||||
}
|
||||
|
||||
/* Get the data source. Invalidate the source memory region to
|
||||
@@ -1499,7 +1499,7 @@ static void sam_receive(struct sam_emac_s *priv)
|
||||
* (this should not happen)
|
||||
*/
|
||||
|
||||
if (dev->d_len > CONFIG_NET_BUFSIZE)
|
||||
if (dev->d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||
}
|
||||
|
||||
@@ -128,13 +128,13 @@
|
||||
#endif
|
||||
|
||||
#define GMAC_RX_UNITSIZE 128 /* Fixed size for RX buffer */
|
||||
#define GMAC_TX_UNITSIZE CONFIG_NET_BUFSIZE /* MAX size for Ethernet packet */
|
||||
#define GMAC_TX_UNITSIZE CONFIG_NET_ETH_MTU /* MAX size for Ethernet packet */
|
||||
|
||||
/* The MAC can support frame lengths up to 1536 bytes */
|
||||
|
||||
#define GMAC_MAX_FRAMELEN 1536
|
||||
#if CONFIG_NET_BUFSIZE >GMAC_MAX_FRAMELEN
|
||||
# error CONFIG_NET_BUFSIZE is too large
|
||||
#if CONFIG_NET_ETH_MTU >GMAC_MAX_FRAMELEN
|
||||
# error CONFIG_NET_ETH_MTU is too large
|
||||
#endif
|
||||
|
||||
/* We need at least one more free buffer than transmit buffers */
|
||||
@@ -965,9 +965,9 @@ static int sam_recvframe(struct sam_gmac_s *priv)
|
||||
/* Get the number of bytes to copy from the buffer */
|
||||
|
||||
copylen = GMAC_RX_UNITSIZE;
|
||||
if ((pktlen + copylen) > CONFIG_NET_BUFSIZE)
|
||||
if ((pktlen + copylen) > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
copylen = CONFIG_NET_BUFSIZE - pktlen;
|
||||
copylen = CONFIG_NET_ETH_MTU - pktlen;
|
||||
}
|
||||
|
||||
/* Get the data source. Invalidate the source memory region to
|
||||
@@ -1103,7 +1103,7 @@ static void sam_receive(struct sam_gmac_s *priv)
|
||||
* (this should not happen)
|
||||
*/
|
||||
|
||||
if (dev->d_len > CONFIG_NET_BUFSIZE)
|
||||
if (dev->d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
* will use the 16-byte alignment in all cases.
|
||||
*/
|
||||
|
||||
#define OPTIMAL_ETH_BUFSIZE ((CONFIG_NET_BUFSIZE + 4 + 15) & ~15)
|
||||
#define OPTIMAL_ETH_BUFSIZE ((CONFIG_NET_ETH_MTU + 4 + 15) & ~15)
|
||||
|
||||
#ifndef CONFIG_STM32_ETH_BUFSIZE
|
||||
# define CONFIG_STM32_ETH_BUFSIZE OPTIMAL_ETH_BUFSIZE
|
||||
@@ -1060,7 +1060,7 @@ static int stm32_transmit(FAR struct stm32_ethmac_s *priv)
|
||||
|
||||
/* Set frame size */
|
||||
|
||||
DEBUGASSERT(priv->dev.d_len <= CONFIG_NET_BUFSIZE);
|
||||
DEBUGASSERT(priv->dev.d_len <= CONFIG_NET_ETH_MTU);
|
||||
txdesc->tdes1 = priv->dev.d_len;
|
||||
|
||||
/* Set the Buffer1 address pointer */
|
||||
@@ -1609,7 +1609,7 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
|
||||
* (this should not happen)
|
||||
*/
|
||||
|
||||
if (dev->d_len > CONFIG_NET_BUFSIZE)
|
||||
if (dev->d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
|
||||
}
|
||||
|
||||
@@ -677,7 +677,7 @@ static void tiva_receive(struct tiva_driver_s *priv)
|
||||
* and 4 byte FCS that are not copied into the uIP packet.
|
||||
*/
|
||||
|
||||
if (pktlen > (CONFIG_NET_BUFSIZE + 6) || pktlen <= (ETH_HDRLEN + 6))
|
||||
if (pktlen > (CONFIG_NET_ETH_MTU + 6) || pktlen <= (ETH_HDRLEN + 6))
|
||||
{
|
||||
int wordlen;
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
* type).
|
||||
*/
|
||||
|
||||
#define PIC32MX_ALIGNED_BUFSIZE ((CONFIG_NET_BUFSIZE + 3) & ~3)
|
||||
#define PIC32MX_ALIGNED_BUFSIZE ((CONFIG_NET_ETH_MTU + 3) & ~3)
|
||||
|
||||
/* The number of buffers will, then, be one for each descriptor plus one extra */
|
||||
|
||||
@@ -1038,7 +1038,7 @@ static int pic32mx_transmit(struct pic32mx_driver_s *priv)
|
||||
*/
|
||||
|
||||
DEBUGASSERT(priv->pd_dev.d_buf != NULL &&
|
||||
priv->pd_dev.d_len < CONFIG_NET_BUFSIZE);
|
||||
priv->pd_dev.d_len < CONFIG_NET_ETH_MTU);
|
||||
|
||||
/* Increment statistics and dump the packet (if so configured) */
|
||||
|
||||
@@ -1388,7 +1388,7 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
|
||||
* imply that the packet is too big.
|
||||
*/
|
||||
|
||||
else if (priv->pd_dev.d_len > CONFIG_NET_BUFSIZE)
|
||||
else if (priv->pd_dev.d_len > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nlldbg("Too big. packet length: %d rxdesc: %08x\n", priv->pd_dev.d_len, rxdesc->status);
|
||||
EMAC_STAT(priv, rx_pktsize);
|
||||
@@ -2005,7 +2005,7 @@ static int pic32mx_ifup(struct net_driver_s *dev)
|
||||
* length restriction is desired, program this 16-bit field.
|
||||
*/
|
||||
|
||||
pic32mx_putreg(CONFIG_NET_BUFSIZE, PIC32MX_EMAC1_MAXF);
|
||||
pic32mx_putreg(CONFIG_NET_ETH_MTU, PIC32MX_EMAC1_MAXF);
|
||||
|
||||
/* Configure the MAC station address in the EMAC1SA0, EMAC1SA1 and
|
||||
* EMAC1SA2 registers (these registers are loaded at reset from the
|
||||
@@ -2070,7 +2070,7 @@ static int pic32mx_ifup(struct net_driver_s *dev)
|
||||
* noticeable impact on the performance.
|
||||
*/
|
||||
|
||||
pic32mx_putreg(ETH_CON2_RXBUFSZ(CONFIG_NET_BUFSIZE), PIC32MX_ETH_CON2);
|
||||
pic32mx_putreg(ETH_CON2_RXBUFSZ(CONFIG_NET_ETH_MTU), PIC32MX_ETH_CON2);
|
||||
|
||||
/* Reset state varialbes */
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += up_netdriver.c
|
||||
HOSTCFLAGS += -DNETDEV_BUFSIZE=$(CONFIG_NET_BUFSIZE)
|
||||
HOSTCFLAGS += -DNETDEV_BUFSIZE=$(CONFIG_NET_ETH_MTU)
|
||||
ifneq ($(HOSTOS),Cygwin)
|
||||
HOSTSRCS += up_tapdev.c up_netdev.c
|
||||
else
|
||||
|
||||
@@ -141,7 +141,7 @@ void netdriver_loop(void)
|
||||
{
|
||||
/* netdev_read will return 0 on a timeout event and >0 on a data received event */
|
||||
|
||||
g_sim_dev.d_len = netdev_read((unsigned char*)g_sim_dev.d_buf, CONFIG_NET_BUFSIZE);
|
||||
g_sim_dev.d_len = netdev_read((unsigned char*)g_sim_dev.d_buf, CONFIG_NET_ETH_MTU);
|
||||
|
||||
/* Disable preemption through to the following so that it behaves a little more
|
||||
* like an interrupt (otherwise, the following logic gets pre-empted an behaves
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
# define CONFIG_EZ80_RAMADDR EZ80_EMACSRAM
|
||||
#endif
|
||||
|
||||
#if CONFIG_NET_BUFSIZE > 1518
|
||||
#if CONFIG_NET_ETH_MTU > 1518
|
||||
# error "MAXF size too big for this device"
|
||||
#endif
|
||||
|
||||
@@ -1202,10 +1202,10 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
|
||||
* for the uIP buffer configuration (I routinely see
|
||||
*/
|
||||
|
||||
if (rxdesc->pktsize > CONFIG_NET_BUFSIZE)
|
||||
if (rxdesc->pktsize > CONFIG_NET_ETH_MTU)
|
||||
{
|
||||
nvdbg("Truncated oversize RX pkt: %d->%d\n", rxdesc->pktsize, CONFIG_NET_BUFSIZE);
|
||||
pktlen = CONFIG_NET_BUFSIZE;
|
||||
nvdbg("Truncated oversize RX pkt: %d->%d\n", rxdesc->pktsize, CONFIG_NET_ETH_MTU);
|
||||
pktlen = CONFIG_NET_ETH_MTU;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user