Add support for multicast MAC addresses

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2784 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2010-07-11 15:17:11 +00:00
parent 075346ef24
commit 3151dcf725
3 changed files with 207 additions and 3 deletions
+70 -2
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/c5471/c5471_ethernet.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Based one a C5471 Linux driver and released under this BSD license with
@@ -394,6 +394,10 @@ static void c5471_txtimeout(int argc, uint32_t arg, ...);
static int c5471_ifup(struct uip_driver_s *dev);
static int c5471_ifdown(struct uip_driver_s *dev);
static int c5471_txavail(struct uip_driver_s *dev);
#ifdef CONFIG_NET_IGMP
static int c5471_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
static int c5471_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
#endif
/* Initialization functions */
@@ -1734,6 +1738,66 @@ static int c5471_txavail(struct uip_driver_s *dev)
return OK;
}
/****************************************************************************
* Function: c5471_addmac
*
* Description:
* NuttX Callback: Add the specified MAC address to the hardware multicast
* address filtering
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be added
*
* Returned Value:
* None
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_IGMP
static int c5471_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
{
FAR struct c5471_driver_s *priv = (FAR struct c5471_driver_s *)dev->d_private;
/* Add the MAC address to the hardware multicast routing table */
#warning "Multicast MAC support not implemented"
return OK;
}
#endif
/****************************************************************************
* Function: c5471_rmmac
*
* Description:
* NuttX Callback: Remove the specified MAC address from the hardware multicast
* address filtering
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be removed
*
* Returned Value:
* None
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_IGMP
static int c5471_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
{
FAR struct c5471_driver_s *priv = (FAR struct c5471_driver_s *)dev->d_private;
/* Add the MAC address to the hardware multicast routing table */
#warning "Multicast MAC support not implemented"
return OK;
}
#endif
/****************************************************************************
* Name: c5471_eimreset
*
@@ -2094,7 +2158,11 @@ void up_netinitialize(void)
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 */
g_c5471[0].c_dev.d_private = (void*)g_c5471; /* Used to recover private state from dev */
#ifdef CONFIG_NET_IGMP
g_c5471[0].c_dev.d_addmac = c5471_addmac; /* Add multicast MAC address */
g_c5471[0].c_dev.d_rmmac = c5471_rmmac; /* Remove multicast MAC address */
#endif
g_c5471[0].c_dev.d_private = (void*)g_c5471; /* Used to recover private state from dev */
/* Create a watchdog for timing polling for and timing of transmisstions */
+68
View File
@@ -254,6 +254,10 @@ static void lm3s_txtimeout(int argc, uint32_t arg, ...);
static int lm3s_ifup(struct uip_driver_s *dev);
static int lm3s_ifdown(struct uip_driver_s *dev);
static int lm3s_txavail(struct uip_driver_s *dev);
#ifdef CONFIG_NET_IGMP
static int lm3s_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
#endif
/****************************************************************************
* Private Functions
@@ -1281,6 +1285,66 @@ static int lm3s_txavail(struct uip_driver_s *dev)
return OK;
}
/****************************************************************************
* Function: lm3s_addmac
*
* Description:
* NuttX Callback: Add the specified MAC address to the hardware multicast
* address filtering
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be added
*
* Returned Value:
* None
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_IGMP
static int lm3s_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
{
FAR struct lm3s_driver_s *priv = (FAR struct lm3s_driver_s *)dev->d_private;
/* Add the MAC address to the hardware multicast routing table */
#warning "Multicast MAC support not implemented"
return OK;
}
#endif
/****************************************************************************
* Function: lm3s_rmmac
*
* Description:
* NuttX Callback: Remove the specified MAC address from the hardware multicast
* address filtering
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be removed
*
* Returned Value:
* None
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_IGMP
static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
{
FAR struct lm3s_driver_s *priv = (FAR struct lm3s_driver_s *)dev->d_private;
/* Add the MAC address to the hardware multicast routing table */
#warning "Multicast MAC support not implemented"
return OK;
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -1327,6 +1391,10 @@ static inline int lm3s_ethinitialize(int intf)
priv->ld_dev.d_ifup = lm3s_ifup; /* I/F down callback */
priv->ld_dev.d_ifdown = lm3s_ifdown; /* I/F up (new IP address) callback */
priv->ld_dev.d_txavail = lm3s_txavail; /* New TX data callback */
#ifdef CONFIG_NET_IGMP
priv->ld_dev.d_addmac = lm3s_addmac; /* Add multicast MAC address */
priv->ld_dev.d_rmmac = lm3s_rmmac; /* Remove multicast MAC address */
#endif
priv->ld_dev.d_private = (void*)priv; /* Used to recover private state from dev */
/* Create a watchdog for timing polling for and timing of transmisstions */
+69 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* drivers/net/ez80_emac.c
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* References:
@@ -377,6 +377,10 @@ static void ez80emac_txtimeout(int argc, uint32_t arg, ...);
static int ez80emac_ifup(struct uip_driver_s *dev);
static int ez80emac_ifdown(struct uip_driver_s *dev);
static int ez80emac_txavail(struct uip_driver_s *dev);
#ifdef CONFIG_NET_IGMP
static int ez80emac_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
static int ez80emac_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
#endif
/* Initialization */
@@ -1794,6 +1798,66 @@ static int ez80emac_txavail(struct uip_driver_s *dev)
return OK;
}
/****************************************************************************
* Function: ez80emac_addmac
*
* Description:
* NuttX Callback: Add the specified MAC address to the hardware multicast
* address filtering
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be added
*
* Returned Value:
* None
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_IGMP
static int ez80emac_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
{
FAR struct ez80emac_driver_s *priv = (FAR struct ez80emac_driver_s *)dev->d_private;
/* Add the MAC address to the hardware multicast routing table */
#warning "Multicast MAC support not implemented"
return OK;
}
#endif
/****************************************************************************
* Function: ez80emac_rmmac
*
* Description:
* NuttX Callback: Remove the specified MAC address from the hardware multicast
* address filtering
*
* Parameters:
* dev - Reference to the NuttX driver state structure
* mac - The MAC address to be removed
*
* Returned Value:
* None
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_IGMP
static int ez80emac_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
{
FAR struct ez80emac_driver_s *priv = (FAR struct ez80emac_driver_s *)dev->d_private;
/* Add the MAC address to the hardware multicast routing table */
#warning "Multicast MAC support not implemented"
return OK;
}
#endif
/****************************************************************************
* Function: ez80emac_initialize
*
@@ -2069,6 +2133,10 @@ int up_netinitialize(void)
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 */
#ifdef CONFIG_NET_IGMP
priv->dev.d_addmac = ez80emac_addmac; /* Add multicast MAC address */
priv->dev.d_rmmac = ez80emac_rmmac; /* Remove multicast MAC address */
#endif
priv->dev.d_private = (FAR void*)&g_emac; /* Used to recover private state from dev */
/* Create a watchdog for timing polling for and timing of transmisstions */