arch/: Adapt all Ethernet drivers to work as though CONFIG_NET_MULTIBUFFER were set. Remove all references to CONFIG_NET_MULTIBUFFER

This commit is contained in:
Gregory Nutt 2016-11-29 16:06:48 -06:00
parent 44e747ebf1
commit 934aded293
20 changed files with 50 additions and 92 deletions

View File

@ -279,6 +279,10 @@
* Private Types
****************************************************************************/
/* A single packet buffer is used */
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
/* The c5471_driver_s encapsulates all state information for a single c5471
* hardware interface
*/
@ -2248,6 +2252,7 @@ void up_netinitialize(void)
/* Initialize the driver structure */
memset(g_c5471, 0, CONFIG_C5471_NET_NINTERFACES*sizeof(struct c5471_driver_s));
g_c5471[0].c_dev.d_buf = g_pktbuf; /* Single packet buffer */
g_c5471[0].c_dev.d_ifup = c5471_ifup; /* I/F down callback */
g_c5471[0].c_dev.d_ifdown = c5471_ifdown; /* I/F up (new IP address) callback */
g_c5471[0].c_dev.d_txavail = c5471_txavail; /* New TX data callback */

View File

@ -254,7 +254,6 @@ config KINETIS_ENET
select ARCH_HAVE_NETDEV_STATISTICS
select NET
select NETDEVICES
select NET_MULTIBUFFER
---help---
Support Ethernet (K6x only)

View File

@ -119,10 +119,6 @@
#define NENET_NBUFFERS \
(CONFIG_KINETIS_ENETNTXBUFFERS+CONFIG_KINETIS_ENETNRXBUFFERS)
#ifndef CONFIG_NET_MULTIBUFFER
# error "CONFIG_NET_MULTIBUFFER is required in the configuration"
#endif
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per
* second.
*/

View File

@ -138,6 +138,8 @@
# define CONFIG_NET_PRIORITY NVIC_SYSH_PRIORITY_DEFAULT
#endif
#define PKTBUF_SIZE (MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE)
/* Debug Configuration *****************************************************/
/* Register debug -- can only happen of CONFIG_DEBUG_NET_INFO is selected */
@ -290,6 +292,10 @@ struct lpc17_driver_s
* Private Data
****************************************************************************/
/* A single packet buffer per interface is used */
static uint8_t g_pktbuf[PKTBUF_SIZE * CONFIG_LPC17_NINTERFACES];
/* Array of ethernet driver status structures */
static struct lpc17_driver_s g_ethdrvr[CONFIG_LPC17_NINTERFACES];
@ -3206,6 +3212,7 @@ static inline int lpc17_ethinitialize(int intf)
#endif
{
struct lpc17_driver_s *priv;
uint8_t *pktbuf;
uint32_t regval;
int ret;
int i;
@ -3225,11 +3232,17 @@ static inline int lpc17_ethinitialize(int intf)
{
(void)lpc17_configgpio(g_enetpins[i]);
}
lpc17_showpins();
/* Select the packet buffer */
pktbuf = &g_pktbuf[PKTBUF_SIZE * intf];
/* Initialize the driver structure */
memset(priv, 0, sizeof(struct lpc17_driver_s));
priv->lp_dev.d_buf = pktbuf; /* Single packet buffer */
priv->lp_dev.d_ifup = lpc17_ifup; /* I/F down callback */
priv->lp_dev.d_ifdown = lpc17_ifdown; /* I/F up (new IP address) callback */
priv->lp_dev.d_txavail = lpc17_txavail; /* New TX data callback */
@ -3237,7 +3250,7 @@ static inline int lpc17_ethinitialize(int intf)
priv->lp_dev.d_addmac = lpc17_addmac; /* Add multicast MAC address */
priv->lp_dev.d_rmmac = lpc17_rmmac; /* Remove multicast MAC address */
#endif
priv->lp_dev.d_private = (void *)priv; /* Used to recover private state from dev */
priv->lp_dev.d_private = (void *)priv; /* Used to recover private state from dev */
#if CONFIG_LPC17_NINTERFACES > 1
# error "A mechanism to associate base address an IRQ with an interface is needed"

View File

@ -164,12 +164,6 @@
#undef CONFIG_LPC43_ETH_ENHANCEDDESC
#undef CONFIG_LPC43_ETH_HWCHECKSUM
/* Ethernet buffer sizes, number of buffers, and number of descriptors */
#ifndef CONFIG_NET_MULTIBUFFER
# error "CONFIG_NET_MULTIBUFFER is required"
#endif
/* Add 4 to the configured buffer size to account for the 2 byte checksum
* memory needed at the end of the maximum size packet. Buffer sizes must
* be an even multiple of 4, 8, or 16 bytes (depending on buswidth). We

View File

@ -313,7 +313,6 @@ struct sam_emac_s
static struct sam_emac_s g_emac;
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used
*
* REVISIT: It might be possible to use this option to send and receive
@ -324,7 +323,6 @@ static struct sam_emac_s g_emac;
*/
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
#ifdef CONFIG_SAM34_EMAC_PREALLOCATE
/* Preallocated data */
@ -3820,9 +3818,7 @@ void up_netinitialize(void)
/* Initialize the driver structure */
memset(priv, 0, sizeof(struct sam_emac_s));
#ifdef CONFIG_NET_MULTIBUFFER
priv->dev.d_buf = g_pktbuf; /* Single packet buffer */
#endif
priv->dev.d_ifup = sam_ifup; /* I/F up (new IP address) callback */
priv->dev.d_ifdown = sam_ifdown; /* I/F down callback */
priv->dev.d_txavail = sam_txavail; /* New TX data callback */

View File

@ -290,7 +290,6 @@ struct sam_emac_s
static struct sam_emac_s g_emac;
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used
*
* REVISIT: It might be possible to use this option to send and receive
@ -301,7 +300,6 @@ static struct sam_emac_s g_emac;
*/
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
#ifdef CONFIG_SAMA5_EMACA_PREALLOCATE
/* Preallocated data */
@ -3486,9 +3484,7 @@ int sam_emac_initialize(void)
/* Initialize the driver structure */
memset(priv, 0, sizeof(struct sam_emac_s));
#ifdef CONFIG_NET_MULTIBUFFER
priv->dev.d_buf = g_pktbuf; /* Single packet buffer */
#endif
priv->dev.d_ifup = sam_ifup; /* I/F up (new IP address) callback */
priv->dev.d_ifdown = sam_ifdown; /* I/F down callback */
priv->dev.d_txavail = sam_txavail; /* New TX data callback */

View File

@ -710,7 +710,6 @@ static const struct sam_emacattr_s g_emac0_attr =
#endif
};
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used
*
* REVISIT: It might be possible to use this option to send and receive
@ -721,7 +720,6 @@ static const struct sam_emacattr_s g_emac0_attr =
*/
static uint8_t g_pktbuf0[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
/* EMAC0 peripheral state */
@ -793,7 +791,6 @@ static const struct sam_emacattr_s g_emac1_attr =
#endif
};
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used
*
* REVISIT: It might be possible to use this option to send and receive
@ -804,7 +801,6 @@ static const struct sam_emacattr_s g_emac1_attr =
*/
static uint8_t g_pktbuf1[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
/* EMAC1 peripheral state */
@ -4546,9 +4542,7 @@ int sam_emac_initialize(int intf)
{
struct sam_emac_s *priv;
const struct sam_emacattr_s *attr;
#ifdef CONFIG_NET_MULTIBUFFER
uint8_t *pktbuf;
#endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
uint8_t phytype;
#endif
@ -4559,10 +4553,7 @@ int sam_emac_initialize(int intf)
{
priv = &g_emac0;
attr = &g_emac0_attr;
#ifdef CONFIG_NET_MULTIBUFFER
pktbuf = g_pktbuf0;
#endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
phytype = SAMA5_EMAC0_PHY_TYPE;
@ -4575,10 +4566,7 @@ int sam_emac_initialize(int intf)
{
priv = &g_emac1;
attr = &g_emac1_attr;
#ifdef CONFIG_NET_MULTIBUFFER
pktbuf = g_pktbuf1;
#endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
phytype = SAMA5_EMAC1_PHY_TYPE;
@ -4595,9 +4583,7 @@ int sam_emac_initialize(int intf)
memset(priv, 0, sizeof(struct sam_emac_s));
priv->attr = attr; /* Save the constant attributes */
#ifdef CONFIG_NET_MULTIBUFFER
priv->dev.d_buf = pktbuf; /* Single packet buffer */
#endif
priv->dev.d_ifup = sam_ifup; /* I/F up (new IP address) callback */
priv->dev.d_ifdown = sam_ifdown; /* I/F down callback */
priv->dev.d_txavail = sam_txavail; /* New TX data callback */

View File

@ -216,7 +216,6 @@ struct sam_gmac_s
static struct sam_gmac_s g_gmac;
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used
*
* REVISIT: It might be possible to use this option to send and receive
@ -227,7 +226,6 @@ static struct sam_gmac_s g_gmac;
*/
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
#ifdef CONFIG_SAMA5_GMAC_PREALLOCATE
/* Preallocated data */
@ -3558,9 +3556,7 @@ int sam_gmac_initialize(void)
/* Initialize the driver structure */
memset(priv, 0, sizeof(struct sam_gmac_s));
#ifdef CONFIG_NET_MULTIBUFFER
priv->dev.d_buf = g_pktbuf; /* Single packet buffer */
#endif
priv->dev.d_ifup = sam_ifup; /* I/F up (new IP address) callback */
priv->dev.d_ifdown = sam_ifdown; /* I/F down callback */
priv->dev.d_txavail = sam_txavail; /* New TX data callback */

View File

@ -856,7 +856,6 @@ static const struct sam_emacattr_s g_emac0_attr =
#endif
};
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used
*
* REVISIT: It might be possible to use this option to send and receive
@ -867,7 +866,6 @@ static const struct sam_emacattr_s g_emac0_attr =
*/
static uint8_t g_pktbuf0[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
/* EMAC0 peripheral state */
@ -939,7 +937,6 @@ static const struct sam_emacattr_s g_emac1_attr =
#endif
};
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used
*
* REVISIT: It might be possible to use this option to send and receive
@ -950,7 +947,6 @@ static const struct sam_emacattr_s g_emac1_attr =
*/
static uint8_t g_pktbuf1[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
/* EMAC1 peripheral state */
@ -5112,9 +5108,7 @@ int sam_emac_initialize(int intf)
{
struct sam_emac_s *priv;
const struct sam_emacattr_s *attr;
#ifdef CONFIG_NET_MULTIBUFFER
uint8_t *pktbuf;
#endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
uint8_t phytype;
#endif
@ -5125,10 +5119,7 @@ int sam_emac_initialize(int intf)
{
priv = &g_emac0;
attr = &g_emac0_attr;
#ifdef CONFIG_NET_MULTIBUFFER
pktbuf = g_pktbuf0;
#endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
phytype = SAMV7_EMAC0_PHY_TYPE;
@ -5141,10 +5132,7 @@ int sam_emac_initialize(int intf)
{
priv = &g_emac1;
attr = &g_emac1_attr;
#ifdef CONFIG_NET_MULTIBUFFER
pktbuf = g_pktbuf1;
#endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
phytype = SAMV7_EMAC1_PHY_TYPE;
@ -5161,9 +5149,7 @@ int sam_emac_initialize(int intf)
memset(priv, 0, sizeof(struct sam_emac_s));
priv->attr = attr; /* Save the constant attributes */
#ifdef CONFIG_NET_MULTIBUFFER
priv->dev.d_buf = pktbuf; /* Single packet buffer */
#endif
priv->dev.d_ifup = sam_ifup; /* I/F up (new IP address) callback */
priv->dev.d_ifdown = sam_ifdown; /* I/F down callback */
priv->dev.d_txavail = sam_txavail; /* New TX data callback */

View File

@ -207,12 +207,6 @@
#undef CONFIG_STM32_ETH_ENHANCEDDESC
#undef CONFIG_STM32_ETH_HWCHECKSUM
/* Ethernet buffer sizes, number of buffers, and number of descriptors */
#ifndef CONFIG_NET_MULTIBUFFER
# error "CONFIG_NET_MULTIBUFFER is required"
#endif
/* Add 4 to the configured buffer size to account for the 2 byte checksum
* memory needed at the end of the maximum size packet. Buffer sizes must
* be an even multiple of 4, 8, or 16 bytes (depending on buswidth). We

View File

@ -194,12 +194,6 @@
#undef CONFIG_STM32F7_ETH_ENHANCEDDESC
#undef CONFIG_STM32F7_ETH_HWCHECKSUM
/* Ethernet buffer sizes, number of buffers, and number of descriptors */
#ifndef CONFIG_NET_MULTIBUFFER
# error "CONFIG_NET_MULTIBUFFER is required"
#endif
/* Add 4 to the configured buffer size to account for the 2 byte checksum
* memory needed at the end of the maximum size packet. Buffer sizes must
* be an even multiple of 4, 8, or 16 bytes (depending on buswidth). We

View File

@ -191,11 +191,9 @@ struct tiva_driver_s
* Private Data
****************************************************************************/
#ifdef CONFIG_NET_MULTIBUFFER
/* A single packet buffer is used */
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
#endif
/* Ethernet peripheral state */
@ -1472,9 +1470,7 @@ static inline int tiva_ethinitialize(int intf)
/* Initialize the driver structure */
memset(priv, 0, sizeof(struct tiva_driver_s));
#ifdef CONFIG_NET_MULTIBUFFER
priv->ld_dev.d_buf = g_pktbuf; /* Single packet buffer */
#endif
priv->ld_dev.d_ifup = tiva_ifup; /* I/F down callback */
priv->ld_dev.d_ifdown = tiva_ifdown; /* I/F up (new IP address) callback */
priv->ld_dev.d_txavail = tiva_txavail; /* New TX data callback */

View File

@ -219,10 +219,6 @@
/* Ethernet buffer sizes, number of buffers, and number of descriptors */
#ifndef CONFIG_NET_MULTIBUFFER
# error CONFIG_NET_MULTIBUFFER is required
#endif
#ifndef CONFIG_TIVA_EMAC_NRXDESC
# define CONFIG_TIVA_EMAC_NRXDESC 8
#endif

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/hc/src/m9s12/m9s12_ethernet.c
*
* Copyright (C) 2011, 2014-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -106,6 +106,12 @@ struct emac_driver_s
* Private Data
****************************************************************************/
/* A single packet buffer is used */
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
/* Driver state structure */
static struct emac_driver_s g_emac[CONFIG_HCS12_NINTERFACES];
/****************************************************************************
@ -756,6 +762,7 @@ int emac_initialize(int intf)
/* Initialize the driver structure */
memset(priv, 0, sizeof(struct emac_driver_s));
priv->d_dev.d_buf = g_pktbuf; /* Single packet buffer */
priv->d_dev.d_ifup = emac_ifup; /* I/F down callback */
priv->d_dev.d_ifdown = emac_ifdown; /* I/F up (new IP address) callback */
priv->d_dev.d_txavail = emac_txavail; /* New TX data callback */
@ -767,8 +774,8 @@ int emac_initialize(int intf)
/* Create a watchdog for timing polling for and timing of transmisstions */
priv->d_txpoll = wd_create(); /* Create periodic poll timer */
priv->d_txtimeout = wd_create(); /* Create TX timeout timer */
priv->d_txpoll = wd_create(); /* Create periodic poll timer */
priv->d_txtimeout = wd_create(); /* Create TX timeout timer */
/* Put the interface in the down state. This usually amounts to resetting
* the device and/or calling emac_ifdown().

View File

@ -102,12 +102,6 @@
# define CONFIG_PIC32MX_NINTERFACES 1
#endif
/* CONFIG_NET_MULTIBUFFER is required */
#ifndef CONFIG_NET_MULTIBUFFER
# error "CONFIG_NET_MULTIBUFFER=y is required"
#endif
/* If IGMP is enabled, then accept multi-cast frames. */
#if defined(CONFIG_NET_IGMP) && !defined(CONFIG_PIC32MX_MULTICAST)

View File

@ -102,12 +102,6 @@
# define CONFIG_PIC32MZ_NINTERFACES 1
#endif
/* CONFIG_NET_MULTIBUFFER is required */
#ifndef CONFIG_NET_MULTIBUFFER
# error "CONFIG_NET_MULTIBUFFER=y is required"
#endif
/* If IGMP is enabled, then accept multi-cast frames. */
#if defined(CONFIG_NET_IGMP) && !defined(CONFIG_PIC32MZ_MULTICAST)

View File

@ -140,6 +140,12 @@ struct misoc_net_driver_s
* Private Data
****************************************************************************/
/* A single packet buffer is used */
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
/* Driver state structur */
static struct misoc_net_driver_s g_misoc_net[CONFIG_MISOC_NET_NINTERFACES];
/****************************************************************************
@ -1333,6 +1339,7 @@ int misoc_net_initialize(int intf)
priv->tx_buf = priv->tx0_buf;
priv->tx_slot=0;
priv->misoc_net_dev.d_buf = g_pktbuf; /* Single packet buffer */
priv->misoc_net_dev.d_ifup = misoc_net_ifup; /* I/F up (new IP address) callback */
priv->misoc_net_dev.d_ifdown = misoc_net_ifdown; /* I/F down callback */
priv->misoc_net_dev.d_txavail = misoc_net_txavail; /* New TX data callback */

View File

@ -78,15 +78,18 @@ struct timer
uint32_t start;
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
static struct timer g_periodic_timer;
/* A single packet buffer is used */
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
/* Ethernet peripheral state */
static struct net_driver_s g_sim_dev;
/****************************************************************************
@ -340,6 +343,7 @@ int netdriver_init(void)
/* Set callbacks */
g_sim_dev.d_buf = g_pktbuf; /* Single packet buffer */
g_sim_dev.d_ifup = netdriver_ifup;
g_sim_dev.d_ifdown = netdriver_ifdown;

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/z80/src/ez80/ez80_emac.c
*
* Copyright (C) 2009-2010, 2012, 2014-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2010, 2012, 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
@ -334,6 +334,10 @@ struct ez80emac_driver_s
* Private Data
****************************************************************************/
/* A single packet buffer is used */
static uint8_t g_pktbuf[MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE];
/* There is only a single instance of driver private data (because there is
* only one EMAC interface.
*/
@ -2224,6 +2228,7 @@ int up_netinitialize(void)
/* Initialize the driver structure */
memset(&g_emac, 0, sizeof(struct ez80emac_driver_s));
priv->dev.d_buf = g_pktbuf; /* Single packet buffer */
priv->dev.d_ifup = ez80emac_ifup; /* I/F down callback */
priv->dev.d_ifdown = ez80emac_ifdown; /* I/F up (new IP address) callback */
priv->dev.d_txavail = ez80emac_txavail; /* New TX data callback */