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:
parent
433e960892
commit
7dceb00a39
109
COPYING
109
COPYING
@ -1,51 +1,70 @@
|
|||||||
|
COPYING -- Describes the terms under which Nuttx is distributed. A
|
||||||
|
copy of the BSD-style licensing is included in this file. In my
|
||||||
|
words -- I believe that you should free to use NuttX in any
|
||||||
|
environment, private, private, commercial, open, closed, etc.
|
||||||
|
provided only that you repect the modest copyright notices as
|
||||||
|
described in license (below). Please feel free to contact me if you
|
||||||
|
have any licensing concerns.
|
||||||
|
|
||||||
|
License for NuttX in general (authorship of individual files may vary):
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
*
|
||||||
* COPYING -- Describes the terms under which Nuttx is distributed. A *
|
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||||
* copy of the BSD-style licensing is included in this file. In my *
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
* words -- I believe that you should free to use NuttX in any *
|
*
|
||||||
* environment, private, private, commercial, open, closed, etc. *
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* provided only that you repect the modest copyright notices as *
|
* modification, are permitted provided that the following conditions
|
||||||
* described in license (below). Please feel free to contact me if you *
|
* are met:
|
||||||
* have any licensing concerns. *
|
*
|
||||||
* *
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
*************************************************************************
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* *
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. *
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> *
|
* the documentation and/or other materials provided with the
|
||||||
* *
|
* distribution.
|
||||||
* Redistribution and use in source and binary forms, with or without *
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* modification, are permitted provided that the following conditions *
|
* used to endorse or promote products derived from this software
|
||||||
* are met: *
|
* without specific prior written permission.
|
||||||
* *
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright *
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* notice, this list of conditions and the following disclaimer. *
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright *
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
* notice, this list of conditions and the following disclaimer in *
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
* the documentation and/or other materials provided with the *
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* distribution. *
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be *
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
* used to endorse or promote products derived from this software *
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
* without specific prior written permission. *
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* *
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
|
*
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED *
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
|
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE. *
|
|
||||||
* *
|
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
If you enable floating point conversions with CONFIG_LIBC_FLOATINGPOINT,
|
Some networking components of NuttX derive from uIP which has a similar
|
||||||
then some files with an unmodified BSD license will be included. That
|
BSD style license:
|
||||||
license is similar to the above (modified) BSD license, but has an
|
|
||||||
additional requirement that I state the following:
|
Copyright (c) 2001-2003, Adam Dunkels.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
IGMP support, if enabled in uIP, adds additional logic by Steve Reynolds:
|
||||||
|
|
||||||
|
Copyright (c) 2002 CITEL Technologies Ltd.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Certain functions in the NuttX C-library derive from other BSD-compatible
|
||||||
|
sources:
|
||||||
|
|
||||||
|
strtod():
|
||||||
|
|
||||||
|
Copyright (C) 2002 Michael Ringgaard. All rights reserved.
|
||||||
|
Copyright (C) 2006-2007 H. Peter Anvin.
|
||||||
|
|
||||||
|
dtoa():
|
||||||
|
If you enable floating point conversions with CONFIG_LIBC_FLOATINGPOINT,
|
||||||
|
then some files with an unmodified BSD license will be included. That
|
||||||
|
license is similar to the above (modified) BSD license, but has an
|
||||||
|
additional requirement that I state the following:
|
||||||
|
|
||||||
"This product includes software developed by the University of
|
"This product includes software developed by the University of
|
||||||
California, Berkeley and its contributors."
|
California, Berkeley and its contributors."
|
||||||
|
13
TODO
13
TODO
@ -1,5 +1,5 @@
|
|||||||
NuttX TODO List (Last updated May 19, 2010)
|
NuttX TODO List (Last updated July 11, 2010)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
(5) Task/Scheduler (sched/)
|
(5) Task/Scheduler (sched/)
|
||||||
(2) Memory Managment (mm/)
|
(2) Memory Managment (mm/)
|
||||||
@ -7,7 +7,7 @@ NuttX TODO List (Last updated May 19, 2010)
|
|||||||
(1) pthreads (sched/)
|
(1) pthreads (sched/)
|
||||||
(1) C++ Support
|
(1) C++ Support
|
||||||
(5) Binary loaders (binfmt/)
|
(5) Binary loaders (binfmt/)
|
||||||
(15) Network (net/, drivers/net)
|
(16) Network (net/, drivers/net)
|
||||||
(5) Network Utilities (netutils/)
|
(5) Network Utilities (netutils/)
|
||||||
(1) USB (drivers/usbdev)
|
(1) USB (drivers/usbdev)
|
||||||
(5) Libraries (lib/)
|
(5) Libraries (lib/)
|
||||||
@ -256,6 +256,13 @@ o Network (net/, drivers/net)
|
|||||||
Status: Open
|
Status: Open
|
||||||
Priority: Low unless you need it.
|
Priority: Low unless you need it.
|
||||||
|
|
||||||
|
Description: Support for client-side IGMPv2 multicast has been added but not yet
|
||||||
|
tested (because I don't have a proper environment for multicast testing).
|
||||||
|
In addition, an ethernet driver that needs to work with the IGMP logic
|
||||||
|
will have to include additional support for multicast MAC address tables.
|
||||||
|
Status: Open
|
||||||
|
Priority: Low unless you need it.
|
||||||
|
|
||||||
o Network Utilities (netutils/)
|
o Network Utilities (netutils/)
|
||||||
|
|
||||||
Description: One critical part of netutils/ apps is untested: The uIP
|
Description: One critical part of netutils/ apps is untested: The uIP
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/c5471/c5471_ethernet.c
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Based one a C5471 Linux driver and released under this BSD license with
|
* 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_ifup(struct uip_driver_s *dev);
|
||||||
static int c5471_ifdown(struct uip_driver_s *dev);
|
static int c5471_ifdown(struct uip_driver_s *dev);
|
||||||
static int c5471_txavail(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 */
|
/* Initialization functions */
|
||||||
|
|
||||||
@ -1734,6 +1738,66 @@ static int c5471_txavail(struct uip_driver_s *dev)
|
|||||||
return OK;
|
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
|
* Name: c5471_eimreset
|
||||||
*
|
*
|
||||||
@ -2094,6 +2158,10 @@ void up_netinitialize(void)
|
|||||||
g_c5471[0].c_dev.d_ifup = c5471_ifup; /* I/F down callback */
|
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_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_txavail = c5471_txavail; /* New TX data callback */
|
||||||
|
#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 */
|
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 */
|
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||||
|
@ -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_ifup(struct uip_driver_s *dev);
|
||||||
static int lm3s_ifdown(struct uip_driver_s *dev);
|
static int lm3s_ifdown(struct uip_driver_s *dev);
|
||||||
static int lm3s_txavail(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
|
* Private Functions
|
||||||
@ -1281,6 +1285,66 @@ static int lm3s_txavail(struct uip_driver_s *dev)
|
|||||||
return OK;
|
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
|
* 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_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_ifdown = lm3s_ifdown; /* I/F up (new IP address) callback */
|
||||||
priv->ld_dev.d_txavail = lm3s_txavail; /* New TX data 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 */
|
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 */
|
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/net/ez80_emac.c
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* References:
|
* 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_ifup(struct uip_driver_s *dev);
|
||||||
static int ez80emac_ifdown(struct uip_driver_s *dev);
|
static int ez80emac_ifdown(struct uip_driver_s *dev);
|
||||||
static int ez80emac_txavail(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 */
|
/* Initialization */
|
||||||
|
|
||||||
@ -1794,6 +1798,66 @@ static int ez80emac_txavail(struct uip_driver_s *dev)
|
|||||||
return OK;
|
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
|
* Function: ez80emac_initialize
|
||||||
*
|
*
|
||||||
@ -2069,6 +2133,10 @@ int up_netinitialize(void)
|
|||||||
priv->dev.d_ifup = ez80emac_ifup; /* I/F down callback */
|
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_ifdown = ez80emac_ifdown; /* I/F up (new IP address) callback */
|
||||||
priv->dev.d_txavail = ez80emac_txavail; /* New TX data 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 */
|
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 */
|
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||||
|
@ -137,6 +137,10 @@ static void cs89x0_txtimeout(int argc, uint32_t arg, ...);
|
|||||||
static int cs89x0_ifup(struct uip_driver_s *dev);
|
static int cs89x0_ifup(struct uip_driver_s *dev);
|
||||||
static int cs89x0_ifdown(struct uip_driver_s *dev);
|
static int cs89x0_ifdown(struct uip_driver_s *dev);
|
||||||
static int cs89x0_txavail(struct uip_driver_s *dev);
|
static int cs89x0_txavail(struct uip_driver_s *dev);
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
static int cs89x0_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
static int cs89x0_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@ -814,6 +818,66 @@ static int cs89x0_txavail(struct uip_driver_s *dev)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: cs89x0_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 cs89x0_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct cs89x0_driver_s *priv = (FAR struct cs89x0_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: cs89x0_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 cs89x0_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct cs89x0_driver_s *priv = (FAR struct cs89x0_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
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -872,6 +936,10 @@ int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno)
|
|||||||
cs89x0->cs_dev.d_ifup = cs89x0_ifup; /* I/F down callback */
|
cs89x0->cs_dev.d_ifup = cs89x0_ifup; /* I/F down callback */
|
||||||
cs89x0->cs_dev.d_ifdown = cs89x0_ifdown; /* I/F up (new IP address) callback */
|
cs89x0->cs_dev.d_ifdown = cs89x0_ifdown; /* I/F up (new IP address) callback */
|
||||||
cs89x0->cs_dev.d_txavail = cs89x0_txavail; /* New TX data callback */
|
cs89x0->cs_dev.d_txavail = cs89x0_txavail; /* New TX data callback */
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
cs89x0->cs_dev.d_addmac = cs89x0_addmac; /* Add multicast MAC address */
|
||||||
|
cs89x0->cs_dev.d_rmmac = cs89x0_rmmac; /* Remove multicast MAC address */
|
||||||
|
#endif
|
||||||
cs89x0->cs_dev.d_private = (void*)cs89x0; /* Used to recover private state from dev */
|
cs89x0->cs_dev.d_private = (void*)cs89x0; /* Used to recover private state from dev */
|
||||||
|
|
||||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/net/dm9x.c
|
* drivers/net/dm9x.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* References: Davicom data sheets (DM9000-DS-F03-041906.pdf,
|
* References: Davicom data sheets (DM9000-DS-F03-041906.pdf,
|
||||||
@ -398,6 +398,10 @@ static void dm9x_txtimeout(int argc, uint32_t arg, ...);
|
|||||||
static int dm9x_ifup(struct uip_driver_s *dev);
|
static int dm9x_ifup(struct uip_driver_s *dev);
|
||||||
static int dm9x_ifdown(struct uip_driver_s *dev);
|
static int dm9x_ifdown(struct uip_driver_s *dev);
|
||||||
static int dm9x_txavail(struct uip_driver_s *dev);
|
static int dm9x_txavail(struct uip_driver_s *dev);
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
static int dm9x_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
static int dm9x_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialization functions */
|
/* Initialization functions */
|
||||||
|
|
||||||
@ -1506,6 +1510,66 @@ static int dm9x_txavail(struct uip_driver_s *dev)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: dm9x_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 dm9x_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct dm9x_driver_s *priv = (FAR struct dm9x_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: dm9x_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 dm9x_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct dm9x_driver_s *priv = (FAR struct dm9x_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: dm9x_bringup
|
* Function: dm9x_bringup
|
||||||
*
|
*
|
||||||
@ -1719,6 +1783,10 @@ int dm9x_initialize(void)
|
|||||||
g_dm9x[0].dm_dev.d_ifup = dm9x_ifup; /* I/F down callback */
|
g_dm9x[0].dm_dev.d_ifup = dm9x_ifup; /* I/F down callback */
|
||||||
g_dm9x[0].dm_dev.d_ifdown = dm9x_ifdown; /* I/F up (new IP address) callback */
|
g_dm9x[0].dm_dev.d_ifdown = dm9x_ifdown; /* I/F up (new IP address) callback */
|
||||||
g_dm9x[0].dm_dev.d_txavail = dm9x_txavail; /* New TX data callback */
|
g_dm9x[0].dm_dev.d_txavail = dm9x_txavail; /* New TX data callback */
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
g_dm9x[0].dm_dev.d_addmac = dm9x_addmac; /* Add multicast MAC address */
|
||||||
|
g_dm9x[0].dm_dev.d_rmmac = dm9x_rmmac; /* Remove multicast MAC address */
|
||||||
|
#endif
|
||||||
g_dm9x[0].dm_dev.d_private = (void*)g_dm9x; /* Used to recover private state from dev */
|
g_dm9x[0].dm_dev.d_private = (void*)g_dm9x; /* Used to recover private state from dev */
|
||||||
|
|
||||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||||
|
@ -278,6 +278,10 @@ static void enc_txtimeout(int argc, uint32_t arg, ...);
|
|||||||
static int enc_ifup(struct uip_driver_s *dev);
|
static int enc_ifup(struct uip_driver_s *dev);
|
||||||
static int enc_ifdown(struct uip_driver_s *dev);
|
static int enc_ifdown(struct uip_driver_s *dev);
|
||||||
static int enc_txavail(struct uip_driver_s *dev);
|
static int enc_txavail(struct uip_driver_s *dev);
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
static int enc_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
static int enc_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialization */
|
/* Initialization */
|
||||||
|
|
||||||
@ -1754,6 +1758,66 @@ static int enc_txavail(struct uip_driver_s *dev)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: enc_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 enc_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct enc_driver_s *priv = (FAR struct enc_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: enc_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 enc_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct enc_driver_s *priv = (FAR struct enc_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: enc_pwrsave
|
* Function: enc_pwrsave
|
||||||
*
|
*
|
||||||
@ -2079,6 +2143,10 @@ int enc_initialize(FAR struct spi_dev_s *spi, unsigned int devno, unsigned int i
|
|||||||
priv->dev.d_ifup = enc_ifup; /* I/F down callback */
|
priv->dev.d_ifup = enc_ifup; /* I/F down callback */
|
||||||
priv->dev.d_ifdown = enc_ifdown; /* I/F up (new IP address) callback */
|
priv->dev.d_ifdown = enc_ifdown; /* I/F up (new IP address) callback */
|
||||||
priv->dev.d_txavail = enc_txavail; /* New TX data callback */
|
priv->dev.d_txavail = enc_txavail; /* New TX data callback */
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
priv->dev.d_addmac = enc_addmac; /* Add multicast MAC address */
|
||||||
|
priv->dev.d_rmmac = enc_rmmac; /* Remove multicast MAC address */
|
||||||
|
#endif
|
||||||
priv->dev.d_private = priv; /* Used to recover private state from dev */
|
priv->dev.d_private = priv; /* Used to recover private state from dev */
|
||||||
|
|
||||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||||
|
@ -130,6 +130,10 @@ static void skel_txtimeout(int argc, uint32_t arg, ...);
|
|||||||
static int skel_ifup(struct uip_driver_s *dev);
|
static int skel_ifup(struct uip_driver_s *dev);
|
||||||
static int skel_ifdown(struct uip_driver_s *dev);
|
static int skel_ifdown(struct uip_driver_s *dev);
|
||||||
static int skel_txavail(struct uip_driver_s *dev);
|
static int skel_txavail(struct uip_driver_s *dev);
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
static int skel_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
static int skel_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@ -542,6 +546,64 @@ static int skel_txavail(struct uip_driver_s *dev)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: skel_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 skel_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct skel_driver_s *skel = (FAR struct skel_driver_s *)dev->d_private;
|
||||||
|
|
||||||
|
/* Add the MAC address to the hardware multicast routing table */
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: skel_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 skel_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||||
|
{
|
||||||
|
FAR struct skel_driver_s *skel = (FAR struct skel_driver_s *)dev->d_private;
|
||||||
|
|
||||||
|
/* Add the MAC address to the hardware multicast routing table */
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -583,6 +645,10 @@ int skel_initialize(void)
|
|||||||
g_skel[0].sk_dev.d_ifup = skel_ifup; /* I/F down callback */
|
g_skel[0].sk_dev.d_ifup = skel_ifup; /* I/F down callback */
|
||||||
g_skel[0].sk_dev.d_ifdown = skel_ifdown; /* I/F up (new IP address) callback */
|
g_skel[0].sk_dev.d_ifdown = skel_ifdown; /* I/F up (new IP address) callback */
|
||||||
g_skel[0].sk_dev.d_txavail = skel_txavail; /* New TX data callback */
|
g_skel[0].sk_dev.d_txavail = skel_txavail; /* New TX data callback */
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
g_skel[0].sk_dev.d_addmac = skel_addmac; /* Add multicast MAC address */
|
||||||
|
g_skel[0].sk_dev.d_rmmac = skel_rmmac; /* Remove multicast MAC address */
|
||||||
|
#endif
|
||||||
g_skel[0].sk_dev.d_private = (void*)g_skel; /* Used to recover private state from dev */
|
g_skel[0].sk_dev.d_private = (void*)g_skel; /* Used to recover private state from dev */
|
||||||
|
|
||||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||||
|
@ -184,6 +184,10 @@ struct uip_driver_s
|
|||||||
int (*d_ifup)(struct uip_driver_s *dev);
|
int (*d_ifup)(struct uip_driver_s *dev);
|
||||||
int (*d_ifdown)(struct uip_driver_s *dev);
|
int (*d_ifdown)(struct uip_driver_s *dev);
|
||||||
int (*d_txavail)(struct uip_driver_s *dev);
|
int (*d_txavail)(struct uip_driver_s *dev);
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
int (*d_addmac)(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
int (*d_rmmac)(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Drivers may attached device-specific, private information */
|
/* Drivers may attached device-specific, private information */
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* are used by uIP programs as well as internal uIP structures and function
|
* are used by uIP programs as well as internal uIP structures and function
|
||||||
* declarations.
|
* declarations.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* This logic was leveraged from uIP which also has a BSD-style license:
|
* This logic was leveraged from uIP which also has a BSD-style license:
|
||||||
@ -370,6 +370,24 @@ extern void uip_send(struct uip_driver_s *dev, const void *buf, int len);
|
|||||||
# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16_t*)addr)[1] << 16) | (in_addr_t)((uint16_t*)addr)[0])
|
# define uip_ip4addr_conv(addr) (((in_addr_t)((uint16_t*)addr)[1] << 16) | (in_addr_t)((uint16_t*)addr)[0])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Extract individual bytes from a 32-bit IPv4 IP address that is in network byte order */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENDIAN_BIG
|
||||||
|
/* Big-endian byte order: 11223344 */
|
||||||
|
|
||||||
|
# define ip4_addr1(ipaddr) (((ipaddr) >> 24) & 0xff)
|
||||||
|
# define ip4_addr2(ipaddr) (((ipaddr) >> 16) & 0xff)
|
||||||
|
# define ip4_addr3(ipaddr) (((ipaddr) >> 8) & 0xff)
|
||||||
|
# define ip4_addr4(ipaddr) ((ipaddr) & 0xff)
|
||||||
|
#else
|
||||||
|
/* Little endian byte order: 44223311 */
|
||||||
|
|
||||||
|
# define ip4_addr1(ipaddr) ((ipaddr) & 0xff)
|
||||||
|
# define ip4_addr2(ipaddr) (((ipaddr) >> 8) & 0xff)
|
||||||
|
# define ip4_addr3(ipaddr) (((ipaddr) >> 16) & 0xff)
|
||||||
|
# define ip4_addr4(ipaddr) (((ipaddr) >> 24) & 0xff)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Construct an IPv6 address from eight 16-bit words.
|
/* Construct an IPv6 address from eight 16-bit words.
|
||||||
*
|
*
|
||||||
* This function constructs an IPv6 address.
|
* This function constructs an IPv6 address.
|
||||||
|
@ -82,7 +82,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CONFIG_NET_IGMP),y)
|
ifeq ($(CONFIG_NET_IGMP),y)
|
||||||
UIP_CSRCS += uip_igmpinit.c uip_igmpgroup.c uip_igmpinput.c uip_igmpjoin.c \
|
UIP_CSRCS += uip_igmpinit.c uip_igmpgroup.c uip_igmpinput.c uip_igmpjoin.c \
|
||||||
uip_igmpleave.c uip_igmpmsg.c uip_igmptimer.c
|
uip_igmpleave.c uip_igmpmsg.c uip_igmptimer.c uip_mcastmac.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -140,7 +140,7 @@ static const uint16_t g_broadcast_ipaddr[2] = {0xffff, 0xffff};
|
|||||||
* The following is the first three octects of the IGMP address:
|
* The following is the first three octects of the IGMP address:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_MULTICAST) && !defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_IGMP) && !defined(CONFIG_NET_IPv6)
|
||||||
static const uint8_t g_multicast_ethaddr[3] = {0x01, 0x00, 0x5e};
|
static const uint8_t g_multicast_ethaddr[3] = {0x01, 0x00, 0x5e};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ void uip_arp_out(struct uip_driver_s *dev)
|
|||||||
{
|
{
|
||||||
memcpy(peth->dest, g_broadcast_ethaddr.ether_addr_octet, ETHER_ADDR_LEN);
|
memcpy(peth->dest, g_broadcast_ethaddr.ether_addr_octet, ETHER_ADDR_LEN);
|
||||||
}
|
}
|
||||||
#if defined(CONFIG_NET_MULTICAST) && !defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_IGMP) && !defined(CONFIG_NET_IPv6)
|
||||||
/* Check if the destination address is a multicast address
|
/* Check if the destination address is a multicast address
|
||||||
*
|
*
|
||||||
* - IPv4: multicast addresses lie in the class D group -- The address range
|
* - IPv4: multicast addresses lie in the class D group -- The address range
|
||||||
|
@ -119,8 +119,8 @@ void uip_igmpdevinit(struct uip_driver_s *dev)
|
|||||||
|
|
||||||
/* Allow the IGMP messages at the MAC level */
|
/* Allow the IGMP messages at the MAC level */
|
||||||
|
|
||||||
uip_igmpmac(dev, &g_allrouters, true);
|
uip_addmcastmac(dev, &g_allrouters);
|
||||||
uip_igmpmac(dev, &g_allsystems, true);
|
uip_addmcastmac(dev, &g_allsystems);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NET_IGMP */
|
#endif /* CONFIG_NET_IGMP */
|
||||||
|
@ -146,7 +146,7 @@ void igmp_joingroup(struct uip_driver_s *dev, uip_ipaddr_t *grpaddr)
|
|||||||
|
|
||||||
/* Add the group (MAC) address to the ether drivers MAC filter list */
|
/* Add the group (MAC) address to the ether drivers MAC filter list */
|
||||||
|
|
||||||
uip_igmpmac(dev, grpaddr, true);
|
uip_addmcastmac(dev, grpaddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void igmp_leavegroup(struct uip_driver_s *dev, uip_ipaddr_t *grpaddr)
|
|||||||
|
|
||||||
/* And remove the group address from the ethernet drivers MAC filter set */
|
/* And remove the group address from the ethernet drivers MAC filter set */
|
||||||
|
|
||||||
uip_igmpmac(dev, grpaddr, false);
|
uip_removemcastmac(dev, grpaddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ void uip_input(struct uip_driver_s *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the pack is destined for out IP address */
|
/* Check if the packet is destined for out IP address */
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -250,9 +250,10 @@ EXTERN void uip_igmpstartticks(FAR struct igmp_group_s *group, int ticks);
|
|||||||
EXTERN void uip_igmpstarttimer(FAR struct igmp_group_s *group, uint8_t decisecs);
|
EXTERN void uip_igmpstarttimer(FAR struct igmp_group_s *group, uint8_t decisecs);
|
||||||
EXTERN bool uip_igmpcmptimer(FAR struct igmp_group_s *group, int maxticks);
|
EXTERN bool uip_igmpcmptimer(FAR struct igmp_group_s *group, int maxticks);
|
||||||
|
|
||||||
/* Defined in TBD ************************************************************/
|
/* Defined in uip_mcastmac ***************************************************/
|
||||||
|
|
||||||
EXTERN void uip_igmpmac(struct uip_driver_s *dev, uip_ipaddr_t *ip, bool on);
|
EXTERN void uip_addmcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip);
|
||||||
|
EXTERN void uip_removemcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip);
|
||||||
|
|
||||||
#endif /* CONFIG_NET_IGMP */
|
#endif /* CONFIG_NET_IGMP */
|
||||||
|
|
||||||
|
132
net/uip/uip_mcastmac.c
Executable file
132
net/uip/uip_mcastmac.c
Executable file
@ -0,0 +1,132 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* net/uip/uip_mcastmac.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
*
|
||||||
|
* The NuttX implementation of IGMP was inspired by the IGMP add-on for the
|
||||||
|
* lwIP TCP/IP stack by Steve Reynolds:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002 CITEL Technologies Ltd.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <net/uip/uipopt.h>
|
||||||
|
#include <net/uip/uip.h>
|
||||||
|
|
||||||
|
#include "uip_internal.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IGMP
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: uip_mcastmac
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Given an IP address (in network order), create a IGMP multicast MAC
|
||||||
|
* address.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void uip_mcastmac(uip_ipaddr_t *ip, FAR uint8_t *mac)
|
||||||
|
{
|
||||||
|
/* This mapping is from the IETF IN RFC 1700 */
|
||||||
|
|
||||||
|
mac[0] = 0x01;
|
||||||
|
mac[1] = 0x00;
|
||||||
|
mac[2] = 0x5e;
|
||||||
|
mac[3] = ip4_addr2(*ip) & 0x7f;
|
||||||
|
mac[4] = ip4_addr3(*ip);
|
||||||
|
mac[5] = ip4_addr4(*ip);
|
||||||
|
|
||||||
|
nvdbg("IP: %04x -> MAC: %02%02%02%02%02%02\n",
|
||||||
|
*ip, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: uip_addmcastmac
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Add an IGMP MAC address to the device's MAC filter table.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void uip_addmcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip)
|
||||||
|
{
|
||||||
|
uint8_t mcastmac[6];
|
||||||
|
|
||||||
|
nvdbg("Adding: IP %04x\n");
|
||||||
|
if (dev->d_addmac)
|
||||||
|
{
|
||||||
|
uip_mcastmac(ip, mcastmac);
|
||||||
|
dev->d_addmac(dev, mcastmac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: uip_removemcastmac
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Remove an IGMP MAC address from the device's MAC filter table.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void uip_removemcastmac(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *ip)
|
||||||
|
{
|
||||||
|
uint8_t mcastmac[6];
|
||||||
|
|
||||||
|
nvdbg("Removing: IP %04x\n");
|
||||||
|
if (dev->d_rmmac)
|
||||||
|
{
|
||||||
|
uip_mcastmac(ip, mcastmac);
|
||||||
|
dev->d_rmmac(dev, mcastmac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_NET_IGMP */
|
Loading…
x
Reference in New Issue
Block a user