net: network drver now retains Ethernet MAC address in a union so that other link layer addresses may be used in a MULTILINK environment.

This commit is contained in:
Gregory Nutt
2017-04-22 11:10:30 -06:00
parent 1d4aee87a0
commit 79256573e1
40 changed files with 196 additions and 189 deletions
+1 -1
View File
@@ -2364,7 +2364,7 @@ static void c5471_reset(struct c5471_driver_s *priv)
static void c5471_macassign(struct c5471_driver_s *priv) static void c5471_macassign(struct c5471_driver_s *priv)
{ {
struct net_driver_s *dev = &priv->c_dev; struct net_driver_s *dev = &priv->c_dev;
uint8_t *mptr = dev->d_mac.ether_addr_octet; uint8_t *mptr = dev->d_mac.ether.ether_addr_octet;
register uint32_t tmp; register uint32_t tmp;
ninfo("MAC: %0x:%0x:%0x:%0x:%0x:%0x\n", ninfo("MAC: %0x:%0x:%0x:%0x:%0x:%0x\n",
+2 -2
View File
@@ -1125,7 +1125,7 @@ static int kinetis_ifup(struct net_driver_s *dev)
{ {
FAR struct kinetis_driver_s *priv = FAR struct kinetis_driver_s *priv =
(FAR struct kinetis_driver_s *)dev->d_private; (FAR struct kinetis_driver_s *)dev->d_private;
uint8_t *mac = dev->d_mac.ether_addr_octet; uint8_t *mac = dev->d_mac.ether.ether_addr_octet;
uint32_t regval; uint32_t regval;
int ret; int ret;
@@ -2144,7 +2144,7 @@ int kinetis_netinitialize(int intf)
uidl = getreg32(KINETIS_SIM_UIDL); uidl = getreg32(KINETIS_SIM_UIDL);
uidml = getreg32(KINETIS_SIM_UIDML); uidml = getreg32(KINETIS_SIM_UIDML);
mac = priv->dev.d_mac.ether_addr_octet; mac = priv->dev.d_mac.ether.ether_addr_octet;
uidml |= 0x00000200; uidml |= 0x00000200;
uidml &= 0x0000FEFF; uidml &= 0x0000FEFF;
+6 -6
View File
@@ -1591,16 +1591,16 @@ static int lpc17_ifup(struct net_driver_s *dev)
/* Configure the MAC station address */ /* Configure the MAC station address */
regval = (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[5] << 8 | regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[5] << 8 |
(uint32_t)priv->lp_dev.d_mac.ether_addr_octet[4]; (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[4];
lpc17_putreg(regval, LPC17_ETH_SA0); lpc17_putreg(regval, LPC17_ETH_SA0);
regval = (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[3] << 8 | regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[3] << 8 |
(uint32_t)priv->lp_dev.d_mac.ether_addr_octet[2]; (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[2];
lpc17_putreg(regval, LPC17_ETH_SA1); lpc17_putreg(regval, LPC17_ETH_SA1);
regval = (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[1] << 8 | regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)priv->lp_dev.d_mac.ether_addr_octet[0]; (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[0];
lpc17_putreg(regval, LPC17_ETH_SA2); lpc17_putreg(regval, LPC17_ETH_SA2);
#ifdef CONFIG_NET_ICMPv6 #ifdef CONFIG_NET_ICMPv6
+9 -9
View File
@@ -3535,22 +3535,22 @@ static void lpc43_macaddress(FAR struct lpc43_ethmac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address high register */ /* Set the MAC address high register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[4]; (uint32_t)dev->d_mac.ether.ether_addr_octet[4];
lpc43_putreg(regval, LPC43_ETH_MACA0HI); lpc43_putreg(regval, LPC43_ETH_MACA0HI);
/* Set the MAC address low register */ /* Set the MAC address low register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) |
((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) |
((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[0]; (uint32_t)dev->d_mac.ether.ether_addr_octet[0];
lpc43_putreg(regval, LPC43_ETH_MACA0LO); lpc43_putreg(regval, LPC43_ETH_MACA0LO);
} }
+9 -9
View File
@@ -3416,20 +3416,20 @@ static void sam_macaddress(struct sam_emac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address */ /* Set the MAC address */
regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] |
(uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 |
(uint32_t)dev->d_mac.ether_addr_octet[3] << 24; (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24;
sam_putreg(priv, SAM_EMAC_SAB1, regval); sam_putreg(priv, SAM_EMAC_SAB1, regval);
regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] |
(uint32_t)dev->d_mac.ether_addr_octet[5] << 8; (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8;
sam_putreg(priv, SAM_EMAC_SAT1, regval); sam_putreg(priv, SAM_EMAC_SAT1, regval);
} }
+9 -9
View File
@@ -3458,20 +3458,20 @@ static void sam_macaddress(struct sam_emac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address */ /* Set the MAC address */
regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] |
(uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 |
(uint32_t)dev->d_mac.ether_addr_octet[3] << 24; (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24;
sam_putreg(priv, SAM_EMAC_SA1B, regval); sam_putreg(priv, SAM_EMAC_SA1B, regval);
regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] |
(uint32_t)dev->d_mac.ether_addr_octet[5] << 8; (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8;
sam_putreg(priv, SAM_EMAC_SA1T, regval); sam_putreg(priv, SAM_EMAC_SA1T, regval);
} }
+9 -9
View File
@@ -4106,20 +4106,20 @@ static void sam_macaddress(struct sam_emac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address */ /* Set the MAC address */
regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] |
(uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 |
(uint32_t)dev->d_mac.ether_addr_octet[3] << 24; (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24;
sam_putreg(priv, SAM_EMAC_SAB1_OFFSET, regval); sam_putreg(priv, SAM_EMAC_SAB1_OFFSET, regval);
regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] |
(uint32_t)dev->d_mac.ether_addr_octet[5] << 8; (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8;
sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval); sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval);
} }
+9 -9
View File
@@ -3506,20 +3506,20 @@ static void sam_macaddress(struct sam_gmac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address */ /* Set the MAC address */
regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] |
(uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 |
(uint32_t)dev->d_mac.ether_addr_octet[3] << 24; (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24;
sam_putreg(priv, SAM_GMAC_SAB1, regval); sam_putreg(priv, SAM_GMAC_SAB1, regval);
regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] |
(uint32_t)dev->d_mac.ether_addr_octet[5] << 8; (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8;
sam_putreg(priv, SAM_GMAC_SAT1, regval); sam_putreg(priv, SAM_GMAC_SAT1, regval);
} }
+13 -13
View File
@@ -4668,20 +4668,20 @@ static void sam_macaddress(struct sam_emac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address */ /* Set the MAC address */
regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] |
(uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 |
(uint32_t)dev->d_mac.ether_addr_octet[3] << 24; (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24;
sam_putreg(priv, SAM_EMAC_SAB1_OFFSET, regval); sam_putreg(priv, SAM_EMAC_SAB1_OFFSET, regval);
regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] |
(uint32_t)dev->d_mac.ether_addr_octet[5] << 8; (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8;
sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval); sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval);
} }
@@ -5160,13 +5160,13 @@ int sam_emac_setmacaddr(int intf, uint8_t mac[6])
/* Copy the MAC address into the device structure */ /* Copy the MAC address into the device structure */
dev = &priv->dev; dev = &priv->dev;
memcpy(dev->d_mac.ether_addr_octet, mac, 6); memcpy(dev->d_mac.ether.ether_addr_octet, mac, 6);
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
return OK; return OK;
} }
+9 -9
View File
@@ -3674,22 +3674,22 @@ static void stm32_macaddress(FAR struct stm32_ethmac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address high register */ /* Set the MAC address high register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[4]; (uint32_t)dev->d_mac.ether.ether_addr_octet[4];
stm32_putreg(regval, STM32_ETH_MACA0HR); stm32_putreg(regval, STM32_ETH_MACA0HR);
/* Set the MAC address low register */ /* Set the MAC address low register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) |
((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) |
((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[0]; (uint32_t)dev->d_mac.ether.ether_addr_octet[0];
stm32_putreg(regval, STM32_ETH_MACA0LR); stm32_putreg(regval, STM32_ETH_MACA0LR);
} }
+9 -9
View File
@@ -3780,22 +3780,22 @@ static void stm32_macaddress(struct stm32_ethmac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address high register */ /* Set the MAC address high register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[4]; (uint32_t)dev->d_mac.ether.ether_addr_octet[4];
stm32_putreg(regval, STM32_ETH_MACA0HR); stm32_putreg(regval, STM32_ETH_MACA0HR);
/* Set the MAC address low register */ /* Set the MAC address low register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) |
((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) |
((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[0]; (uint32_t)dev->d_mac.ether.ether_addr_octet[0];
stm32_putreg(regval, STM32_ETH_MACA0LR); stm32_putreg(regval, STM32_ETH_MACA0LR);
} }
+8 -8
View File
@@ -1389,14 +1389,14 @@ static int tiva_ifup(struct net_driver_s *dev)
/* Program the hardware with it's MAC address (for filtering) */ /* Program the hardware with it's MAC address (for filtering) */
regval = (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[3] << 24 | regval = (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[3] << 24 |
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[2] << 16 | (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[2] << 16 |
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[1] << 8 | (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[0]; (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[0];
tiva_ethout(priv, TIVA_MAC_IA0_OFFSET, regval); tiva_ethout(priv, TIVA_MAC_IA0_OFFSET, regval);
regval = (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[5] << 8 | regval = (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[5] << 8 |
(uint32_t)priv->ld_dev.d_mac.ether_addr_octet[4]; (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[4];
tiva_ethout(priv, TIVA_MAC_IA1_OFFSET, regval); tiva_ethout(priv, TIVA_MAC_IA1_OFFSET, regval);
/* Set and activate a timer process */ /* Set and activate a timer process */
@@ -1696,13 +1696,13 @@ static inline int tiva_ethinitialize(int intf)
priv->ld_txpoll = wd_create(); /* Create periodic poll timer */ priv->ld_txpoll = wd_create(); /* Create periodic poll timer */
priv->ld_txtimeout = wd_create(); /* Create TX timeout timer */ priv->ld_txtimeout = wd_create(); /* Create TX timeout timer */
#ifdef CONFIG_TIVA_BOARDMAC
/* If the board can provide us with a MAC address, get the address /* If the board can provide us with a MAC address, get the address
* from the board now. The MAC will not be applied until tiva_ifup() * from the board now. The MAC will not be applied until tiva_ifup()
* is called (and the MAC can be overwritten with a netdev ioctl call). * is called (and the MAC can be overwritten with a netdev ioctl call).
*/ */
#ifdef CONFIG_TIVA_BOARDMAC tiva_ethernetmac(&priv->ld_dev.d_mac.ether);
tiva_ethernetmac(&priv->ld_dev.d_mac);
#endif #endif
/* Perform minimal, one-time initialization -- just reset the controller and /* Perform minimal, one-time initialization -- just reset the controller and
+10 -10
View File
@@ -3755,22 +3755,22 @@ static void tiva_macaddress(FAR struct tiva_ethmac_s *priv)
ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_ifname, dev->d_ifname,
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
/* Set the MAC address high register */ /* Set the MAC address high register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[4]; (uint32_t)dev->d_mac.ether.ether_addr_octet[4];
tiva_putreg(regval, TIVA_EMAC_ADDR0H); tiva_putreg(regval, TIVA_EMAC_ADDR0H);
/* Set the MAC address low register */ /* Set the MAC address low register */
regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) |
((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) |
((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) |
(uint32_t)dev->d_mac.ether_addr_octet[0]; (uint32_t)dev->d_mac.ether.ether_addr_octet[0];
tiva_putreg(regval, TIVA_EMAC_ADDR0L); tiva_putreg(regval, TIVA_EMAC_ADDR0L);
} }
@@ -4056,7 +4056,7 @@ int tiva_ethinitialize(int intf)
* is called (and the MAC can be overwritten with a netdev ioctl call). * is called (and the MAC can be overwritten with a netdev ioctl call).
*/ */
tiva_ethernetmac(&priv->dev.d_mac); tiva_ethernetmac(&priv->dev.d_mac.ether);
#endif #endif
/* Enable power and clocking to the Ethernet MAC /* Enable power and clocking to the Ethernet MAC
+1 -1
View File
@@ -781,7 +781,7 @@ int emac_initialize(int intf)
* the device and/or calling emac_ifdown(). * the device and/or calling emac_ifdown().
*/ */
/* Read the MAC address from the hardware into priv->d_dev.d_mac.ether_addr_octet */ /* Read the MAC address from the hardware into priv->d_dev.d_mac.ether.ether_addr_octet */
/* Register the device with the OS so that socket IOCTLs can be performed */ /* Register the device with the OS so that socket IOCTLs can be performed */
+12 -12
View File
@@ -2216,29 +2216,29 @@ static int pic32mx_ifup(struct net_driver_s *dev)
*/ */
#if 0 #if 0
regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[5] << 8 | regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[5] << 8 |
(uint32_t)priv->pd_dev.d_mac.ether_addr_octet[4]; (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[4];
pic32mx_putreg(regval, PIC32MX_EMAC1_SA0); pic32mx_putreg(regval, PIC32MX_EMAC1_SA0);
regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[3] << 8 | regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[3] << 8 |
(uint32_t)priv->pd_dev.d_mac.ether_addr_octet[2]; (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[2];
pic32mx_putreg(regval, PIC32MX_EMAC1_SA1); pic32mx_putreg(regval, PIC32MX_EMAC1_SA1);
regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[1] << 8 | regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)priv->pd_dev.d_mac.ether_addr_octet[0]; (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[0];
pic32mx_putreg(regval, PIC32MX_EMAC1_SA2); pic32mx_putreg(regval, PIC32MX_EMAC1_SA2);
#else #else
regval = pic32mx_getreg(PIC32MX_EMAC1_SA0); regval = pic32mx_getreg(PIC32MX_EMAC1_SA0);
priv->pd_dev.d_mac.ether_addr_octet[4] = (uint32_t)(regval & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[4] = (uint32_t)(regval & 0xff);
priv->pd_dev.d_mac.ether_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff);
regval = pic32mx_getreg(PIC32MX_EMAC1_SA1); regval = pic32mx_getreg(PIC32MX_EMAC1_SA1);
priv->pd_dev.d_mac.ether_addr_octet[2] = (uint32_t)(regval & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[2] = (uint32_t)(regval & 0xff);
priv->pd_dev.d_mac.ether_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff);
regval = pic32mx_getreg(PIC32MX_EMAC1_SA2); regval = pic32mx_getreg(PIC32MX_EMAC1_SA2);
priv->pd_dev.d_mac.ether_addr_octet[0] = (uint32_t)(regval & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[0] = (uint32_t)(regval & 0xff);
priv->pd_dev.d_mac.ether_addr_octet[1] = (uint32_t)((regval >> 8) & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[1] = (uint32_t)((regval >> 8) & 0xff);
#endif #endif
/* Continue Ethernet Controller Initialization ****************************/ /* Continue Ethernet Controller Initialization ****************************/
+15 -15
View File
@@ -2243,34 +2243,34 @@ static int pic32mz_ifup(struct net_driver_s *dev)
*/ */
#if 0 #if 0
regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[5] << 8 | regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[5] << 8 |
(uint32_t)priv->pd_dev.d_mac.ether_addr_octet[4]; (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[4];
pic32mz_putreg(regval, PIC32MZ_EMAC1_SA0); pic32mz_putreg(regval, PIC32MZ_EMAC1_SA0);
regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[3] << 8 | regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[3] << 8 |
(uint32_t)priv->pd_dev.d_mac.ether_addr_octet[2]; (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[2];
pic32mz_putreg(regval, PIC32MZ_EMAC1_SA1); pic32mz_putreg(regval, PIC32MZ_EMAC1_SA1);
regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[1] << 8 | regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)priv->pd_dev.d_mac.ether_addr_octet[0]; (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[0];
pic32mz_putreg(regval, PIC32MZ_EMAC1_SA2); pic32mz_putreg(regval, PIC32MZ_EMAC1_SA2);
#else #else
regval = pic32mz_getreg(PIC32MZ_EMAC1_SA0); regval = pic32mz_getreg(PIC32MZ_EMAC1_SA0);
priv->pd_dev.d_mac.ether_addr_octet[4] = (uint32_t)(regval & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[4] = (uint32_t)(regval & 0xff);
priv->pd_dev.d_mac.ether_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff);
regval = pic32mz_getreg(PIC32MZ_EMAC1_SA1); regval = pic32mz_getreg(PIC32MZ_EMAC1_SA1);
priv->pd_dev.d_mac.ether_addr_octet[2] = (uint32_t)(regval & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[2] = (uint32_t)(regval & 0xff);
priv->pd_dev.d_mac.ether_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff);
regval = pic32mz_getreg(PIC32MZ_EMAC1_SA2); regval = pic32mz_getreg(PIC32MZ_EMAC1_SA2);
priv->pd_dev.d_mac.ether_addr_octet[0] = (uint32_t)(regval & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[0] = (uint32_t)(regval & 0xff);
priv->pd_dev.d_mac.ether_addr_octet[1] = (uint32_t)((regval >> 8) & 0xff); priv->pd_dev.d_mac.ether.ether_addr_octet[1] = (uint32_t)((regval >> 8) & 0xff);
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
#endif #endif
/* Continue Ethernet Controller Initialization ****************************/ /* Continue Ethernet Controller Initialization ****************************/
+2 -2
View File
@@ -833,7 +833,7 @@ static int misoc_net_ifup(FAR struct net_driver_s *dev)
/* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */ /* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */
/* Instantiate the MAC address from priv->misoc_net_dev.d_mac.ether_addr_octet */ /* Instantiate the MAC address from priv->misoc_net_dev.d_mac.ether.ether_addr_octet */
#ifdef CONFIG_NET_ICMPv6 #ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */ /* Set up IPv6 multicast address filtering */
@@ -1182,7 +1182,7 @@ int misoc_net_initialize(int intf)
*/ */
/* Read the MAC address from the hardware into /* Read the MAC address from the hardware into
* priv->misoc_net_dev.d_mac.ether_addr_octet * priv->misoc_net_dev.d_mac.ether.ether_addr_octet
*/ */
/* Register the device with the OS so that socket IOCTLs can be performed */ /* Register the device with the OS so that socket IOCTLs can be performed */
+2 -2
View File
@@ -198,7 +198,7 @@ void netdriver_loop(void)
* up_comparemac will always return 0. * up_comparemac will always return 0.
*/ */
is_ours = (up_comparemac(eth->dest, &g_sim_dev.d_mac) == 0); is_ours = (up_comparemac(eth->dest, &g_sim_dev.d_mac.ether) == 0);
#ifdef CONFIG_NET_PKT #ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet /* When packet sockets are enabled, feed the frame into the packet
@@ -359,7 +359,7 @@ int netdriver_init(void)
int netdriver_setmacaddr(unsigned char *macaddr) int netdriver_setmacaddr(unsigned char *macaddr)
{ {
(void)memcpy(g_sim_dev.d_mac.ether_addr_octet, macaddr, IFHWADDRLEN); (void)memcpy(g_sim_dev.d_mac.ether.ether_addr_octet, macaddr, IFHWADDRLEN);
return 0; return 0;
} }
+10 -10
View File
@@ -1999,9 +1999,9 @@ static int ez80emac_ifup(FAR struct net_driver_s *dev)
int ret; int ret;
ninfo("Bringing up: MAC %02x:%02x:%02x:%02x:%02x:%02x\n", ninfo("Bringing up: MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5]); dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]);
ninfo(" IP %d.%d.%d.%d\n", ninfo(" IP %d.%d.%d.%d\n",
dev->d_ipaddr >> 24, (dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24, (dev->d_ipaddr >> 16) & 0xff,
(dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff); (dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff);
@@ -2028,12 +2028,12 @@ static int ez80emac_ifup(FAR struct net_driver_s *dev)
/* Set the MAC address */ /* Set the MAC address */
outp(EZ80_EMAC_STAD_0, priv->dev.d_mac.ether_addr_octet[0]); outp(EZ80_EMAC_STAD_0, priv->dev.d_mac.ether.ether_addr_octet[0]);
outp(EZ80_EMAC_STAD_1, priv->dev.d_mac.ether_addr_octet[1]); outp(EZ80_EMAC_STAD_1, priv->dev.d_mac.ether.ether_addr_octet[1]);
outp(EZ80_EMAC_STAD_2, priv->dev.d_mac.ether_addr_octet[2]); outp(EZ80_EMAC_STAD_2, priv->dev.d_mac.ether.ether_addr_octet[2]);
outp(EZ80_EMAC_STAD_3, priv->dev.d_mac.ether_addr_octet[3]); outp(EZ80_EMAC_STAD_3, priv->dev.d_mac.ether.ether_addr_octet[3]);
outp(EZ80_EMAC_STAD_4, priv->dev.d_mac.ether_addr_octet[4]); outp(EZ80_EMAC_STAD_4, priv->dev.d_mac.ether.ether_addr_octet[4]);
outp(EZ80_EMAC_STAD_5, priv->dev.d_mac.ether_addr_octet[5]); outp(EZ80_EMAC_STAD_5, priv->dev.d_mac.ether.ether_addr_octet[5]);
/* Enable/disable promiscuous mode */ /* Enable/disable promiscuous mode */
@@ -2542,7 +2542,7 @@ int up_netinitialize(void)
priv->txpoll = wd_create(); /* Create periodic poll timer */ priv->txpoll = wd_create(); /* Create periodic poll timer */
priv->txtimeout = wd_create(); /* Create TX timeout timer */ priv->txtimeout = wd_create(); /* Create TX timeout timer */
/* Read the MAC address from the hardware into priv->dev.d_mac.ether_addr_octet */ /* Read the MAC address from the hardware into priv->dev.d_mac.ether.ether_addr_octet */
/* Register the device with the OS so that socket IOCTLs can be performed */ /* Register the device with the OS so that socket IOCTLs can be performed */
+1 -1
View File
@@ -1006,7 +1006,7 @@ int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno)
cs89x0->cs_txpoll = wd_create(); /* Create periodic poll timer */ cs89x0->cs_txpoll = wd_create(); /* Create periodic poll timer */
cs89x0->cs_txtimeout = wd_create(); /* Create TX timeout timer */ cs89x0->cs_txtimeout = wd_create(); /* Create TX timeout timer */
/* Read the MAC address from the hardware into cs89x0->cs_dev.d_mac.ether_addr_octet */ /* Read the MAC address from the hardware into cs89x0->cs_dev.d_mac.ether.ether_addr_octet */
/* Register the device with the OS so that socket IOCTLs can be performed */ /* Register the device with the OS so that socket IOCTLs can be performed */
+1 -1
View File
@@ -1955,7 +1955,7 @@ int dm9x_initialize(void)
/* Read the MAC address */ /* Read the MAC address */
mptr = g_dm9x[0].dm_dev.d_mac.ether_addr_octet; mptr = g_dm9x[0].dm_dev.d_mac.ether.ether_addr_octet;
for (i = 0, j = DM9X_PAB0; i < ETHER_ADDR_LEN; i++, j++) for (i = 0, j = DM9X_PAB0; i < ETHER_ADDR_LEN; i++, j++)
{ {
mptr[i] = getreg(j); mptr[i] = getreg(j);
+6 -6
View File
@@ -2440,12 +2440,12 @@ static void enc_setmacaddr(FAR struct enc_driver_s *priv)
* MAADR6 MAC Address Byte 6 (MAADR<7:0>) * MAADR6 MAC Address Byte 6 (MAADR<7:0>)
*/ */
enc_wrbreg(priv, ENC_MAADR1, priv->dev.d_mac.ether_addr_octet[0]); enc_wrbreg(priv, ENC_MAADR1, priv->dev.d_mac.ether.ether_addr_octet[0]);
enc_wrbreg(priv, ENC_MAADR2, priv->dev.d_mac.ether_addr_octet[1]); enc_wrbreg(priv, ENC_MAADR2, priv->dev.d_mac.ether.ether_addr_octet[1]);
enc_wrbreg(priv, ENC_MAADR3, priv->dev.d_mac.ether_addr_octet[2]); enc_wrbreg(priv, ENC_MAADR3, priv->dev.d_mac.ether.ether_addr_octet[2]);
enc_wrbreg(priv, ENC_MAADR4, priv->dev.d_mac.ether_addr_octet[3]); enc_wrbreg(priv, ENC_MAADR4, priv->dev.d_mac.ether.ether_addr_octet[3]);
enc_wrbreg(priv, ENC_MAADR5, priv->dev.d_mac.ether_addr_octet[4]); enc_wrbreg(priv, ENC_MAADR5, priv->dev.d_mac.ether.ether_addr_octet[4]);
enc_wrbreg(priv, ENC_MAADR6, priv->dev.d_mac.ether_addr_octet[5]); enc_wrbreg(priv, ENC_MAADR6, priv->dev.d_mac.ether.ether_addr_octet[5]);
} }
/**************************************************************************** /****************************************************************************
+3 -3
View File
@@ -2591,7 +2591,7 @@ static void enc_pwrsave(FAR struct enc_driver_s *priv)
static void enc_ldmacaddr(FAR struct enc_driver_s *priv) static void enc_ldmacaddr(FAR struct enc_driver_s *priv)
{ {
uint16_t regval; uint16_t regval;
uint8_t *mac = priv->dev.d_mac.ether_addr_octet; uint8_t *mac = priv->dev.d_mac.ether.ether_addr_octet;
ninfo("Using ENCX24J600's built in MAC address\n"); ninfo("Using ENCX24J600's built in MAC address\n");
@@ -2629,12 +2629,12 @@ static void enc_ldmacaddr(FAR struct enc_driver_s *priv)
static void enc_setmacaddr(FAR struct enc_driver_s *priv) static void enc_setmacaddr(FAR struct enc_driver_s *priv)
{ {
uint8_t *mac = priv->dev.d_mac.ether_addr_octet; uint8_t *mac = priv->dev.d_mac.ether.ether_addr_octet;
struct ether_addr zmac; struct ether_addr zmac;
memset(&zmac, 0, sizeof(zmac)); memset(&zmac, 0, sizeof(zmac));
if (memcmp(&priv->dev.d_mac, &zmac, sizeof(zmac)) == 0) if (memcmp(&priv->dev.d_mac.ether, &zmac, sizeof(zmac)) == 0)
{ {
/* No user defined MAC address. Read it from the device. */ /* No user defined MAC address. Read it from the device. */
+4 -4
View File
@@ -1185,9 +1185,9 @@ static int ftmac100_ifup(struct net_driver_s *dev)
ftmac100_init(priv); ftmac100_init(priv);
/* Instantiate the MAC address from priv->ft_dev.d_mac.ether_addr_octet */ /* Instantiate the MAC address from priv->ft_dev.d_mac.ether.ether_addr_octet */
ftmac100_set_mac(priv, priv->ft_dev.d_mac.ether_addr_octet); ftmac100_set_mac(priv, priv->ft_dev.d_mac.ether.ether_addr_octet);
#ifdef CONFIG_NET_ICMPv6 #ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */ /* Set up IPv6 multicast address filtering */
@@ -1566,9 +1566,9 @@ int ftmac100_initialize(int intf)
*/ */
ftmac100_reset(priv); ftmac100_reset(priv);
/* Read the MAC address from the hardware into priv->ft_dev.d_mac.ether_addr_octet */ /* Read the MAC address from the hardware into priv->ft_dev.d_mac.ether.ether_addr_octet */
memcpy(priv->ft_dev.d_mac.ether_addr_octet, (void *)(CONFIG_FTMAC100_MAC0_ENV_ADDR), 6); memcpy(priv->ft_dev.d_mac.ether.ether_addr_octet, (void *)(CONFIG_FTMAC100_MAC0_ENV_ADDR), 6);
/* Register the device with the OS so that socket IOCTLs can be performed */ /* Register the device with the OS so that socket IOCTLs can be performed */
+2 -2
View File
@@ -803,7 +803,7 @@ static int skel_ifup(FAR struct net_driver_s *dev)
/* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */ /* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */
/* Instantiate the MAC address from priv->sk_dev.d_mac.ether_addr_octet */ /* Instantiate the MAC address from priv->sk_dev.d_mac.ether.ether_addr_octet */
#ifdef CONFIG_NET_ICMPv6 #ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */ /* Set up IPv6 multicast address filtering */
@@ -1187,7 +1187,7 @@ int skel_initialize(int intf)
* the device and/or calling skel_ifdown(). * the device and/or calling skel_ifdown().
*/ */
/* Read the MAC address from the hardware into priv->sk_dev.d_mac.ether_addr_octet */ /* Read the MAC address from the hardware into priv->sk_dev.d_mac.ether.ether_addr_octet */
/* Register the device with the OS so that socket IOCTLs can be performed */ /* Register the device with the OS so that socket IOCTLs can be performed */
+1 -1
View File
@@ -631,7 +631,7 @@ static int tun_ifup(struct net_driver_s *dev)
/* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */ /* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */
/* Instantiate the MAC address from priv->dev.d_mac.ether_addr_octet */ /* Instantiate the MAC address from priv->dev.d_mac.ether.ether_addr_octet */
#ifdef CONFIG_NET_ICMPv6 #ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */ /* Set up IPv6 multicast address filtering */
+10 -3
View File
@@ -207,10 +207,17 @@ struct net_driver_s
#endif #endif
#endif #endif
#ifdef CONFIG_NET_ETHERNET #if defined(CONFIG_NET_ETHERNET)
/* Ethernet device identity */ /* Link layer address */
struct ether_addr d_mac; /* Device MAC address */ union
{
#ifdef CONFIG_NET_ETHERNET
/* Ethernet device identity */
struct ether_addr ether; /* Device Ethernet MAC address */
#endif
} d_mac;
#endif #endif
/* Network identity */ /* Network identity */
+2 -2
View File
@@ -124,8 +124,8 @@ void arp_arpin(FAR struct net_driver_s *dev)
arp->ah_opcode = HTONS(ARP_REPLY); arp->ah_opcode = HTONS(ARP_REPLY);
memcpy(arp->ah_dhwaddr, arp->ah_shwaddr, ETHER_ADDR_LEN); memcpy(arp->ah_dhwaddr, arp->ah_shwaddr, ETHER_ADDR_LEN);
memcpy(arp->ah_shwaddr, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(arp->ah_shwaddr, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
memcpy(eth->dest, arp->ah_dhwaddr, ETHER_ADDR_LEN); memcpy(eth->dest, arp->ah_dhwaddr, ETHER_ADDR_LEN);
arp->ah_dipaddr[0] = arp->ah_sipaddr[0]; arp->ah_dipaddr[0] = arp->ah_sipaddr[0];
+2 -2
View File
@@ -90,8 +90,8 @@ void arp_format(FAR struct net_driver_s *dev, in_addr_t ipaddr)
memset(eth->dest, 0xff, ETHER_ADDR_LEN); memset(eth->dest, 0xff, ETHER_ADDR_LEN);
memset(arp->ah_dhwaddr, 0x00, ETHER_ADDR_LEN); memset(arp->ah_dhwaddr, 0x00, ETHER_ADDR_LEN);
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
memcpy(arp->ah_shwaddr, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(arp->ah_shwaddr, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
net_ipv4addr_hdrcopy(arp->ah_dipaddr, &ipaddr); net_ipv4addr_hdrcopy(arp->ah_dipaddr, &ipaddr);
net_ipv4addr_hdrcopy(arp->ah_sipaddr, &dev->d_ipaddr); net_ipv4addr_hdrcopy(arp->ah_sipaddr, &dev->d_ipaddr);
+1 -1
View File
@@ -249,7 +249,7 @@ void arp_out(FAR struct net_driver_s *dev)
/* Finish populating the Ethernet header */ /* Finish populating the Ethernet header */
memcpy(peth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(peth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
peth->type = HTONS(ETHTYPE_IP); peth->type = HTONS(ETHTYPE_IP);
dev->d_len += ETH_HDRLEN; dev->d_len += ETH_HDRLEN;
} }
+2 -2
View File
@@ -139,7 +139,7 @@ void icmpv6_advertise(FAR struct net_driver_s *dev,
* REVISIT: What if the link layer is not Ethernet? * REVISIT: What if the link layer is not Ethernet?
*/ */
memcpy(adv->tgtlladdr, &dev->d_mac, IFHWADDRLEN); memcpy(adv->tgtlladdr, &dev->d_mac.ether, IFHWADDRLEN);
/* Calculate the checksum over both the ICMP header and payload */ /* Calculate the checksum over both the ICMP header and payload */
@@ -166,7 +166,7 @@ void icmpv6_advertise(FAR struct net_driver_s *dev,
FAR struct eth_hdr_s *eth = ETHBUF; FAR struct eth_hdr_s *eth = ETHBUF;
memcpy(eth->dest, eth->src, ETHER_ADDR_LEN); memcpy(eth->dest, eth->src, ETHER_ADDR_LEN);
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
/* Set the IPv6 Ethernet type */ /* Set the IPv6 Ethernet type */
+1 -1
View File
@@ -402,7 +402,7 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev)
lladdr[0] = HTONS(0xfe80); /* 10-bit address + 6 zeroes */ lladdr[0] = HTONS(0xfe80); /* 10-bit address + 6 zeroes */
memset(&lladdr[1], 0, 4 * sizeof(uint16_t)); /* 64 more zeroes */ memset(&lladdr[1], 0, 4 * sizeof(uint16_t)); /* 64 more zeroes */
memcpy(&lladdr[5], dev->d_mac.ether_addr_octet, memcpy(&lladdr[5], dev->d_mac.ether.ether_addr_octet,
sizeof(struct ether_addr)); /* 48-bit Ethernet address */ sizeof(struct ether_addr)); /* 48-bit Ethernet address */
ninfo("lladdr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", ninfo("lladdr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
+2 -2
View File
@@ -176,7 +176,7 @@ void icmpv6_radvertise(FAR struct net_driver_s *dev)
srcaddr = &adv->srcaddr; srcaddr = &adv->srcaddr;
srcaddr->opttype = ICMPv6_OPT_SRCLLADDR; srcaddr->opttype = ICMPv6_OPT_SRCLLADDR;
srcaddr->optlen = 1; srcaddr->optlen = 1;
memcpy(srcaddr->srclladdr, &dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(srcaddr->srclladdr, &dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
/* Set up the MTU option */ /* Set up the MTU option */
@@ -228,7 +228,7 @@ void icmpv6_radvertise(FAR struct net_driver_s *dev)
FAR struct eth_hdr_s *eth = ETHBUF; FAR struct eth_hdr_s *eth = ETHBUF;
memcpy(eth->dest, g_ipv6_ethallnodes.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->dest, g_ipv6_ethallnodes.ether_addr_octet, ETHER_ADDR_LEN);
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
/* Set the IPv6 Ethernet type */ /* Set the IPv6 Ethernet type */
+2 -2
View File
@@ -137,7 +137,7 @@ void icmpv6_rsolicit(FAR struct net_driver_s *dev)
* REVISIT: What if the link layer is not Ethernet? * REVISIT: What if the link layer is not Ethernet?
*/ */
memcpy(sol->srclladdr, dev->d_mac.ether_addr_octet, sizeof(net_ipv6addr_t)); memcpy(sol->srclladdr, dev->d_mac.ether.ether_addr_octet, sizeof(net_ipv6addr_t));
/* Calculate the checksum over both the ICMP header and payload */ /* Calculate the checksum over both the ICMP header and payload */
@@ -162,7 +162,7 @@ void icmpv6_rsolicit(FAR struct net_driver_s *dev)
/* Move our source Ethernet addresses into the Ethernet header */ /* Move our source Ethernet addresses into the Ethernet header */
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
/* Set the IPv6 Ethernet type */ /* Set the IPv6 Ethernet type */
+2 -2
View File
@@ -152,7 +152,7 @@ void icmpv6_solicit(FAR struct net_driver_s *dev,
* REVISIT: What if the link layer is not Ethernet? * REVISIT: What if the link layer is not Ethernet?
*/ */
memcpy(sol->srclladdr, &dev->d_mac, IFHWADDRLEN); memcpy(sol->srclladdr, &dev->d_mac.ether, IFHWADDRLEN);
/* Calculate the checksum over both the ICMP header and payload */ /* Calculate the checksum over both the ICMP header and payload */
@@ -190,7 +190,7 @@ void icmpv6_solicit(FAR struct net_driver_s *dev,
/* Move our source Ethernet addresses into the Ethernet header */ /* Move our source Ethernet addresses into the Ethernet header */
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
/* Set the IPv6 Ethernet type */ /* Set the IPv6 Ethernet type */
+1 -1
View File
@@ -245,7 +245,7 @@ void neighbor_out(FAR struct net_driver_s *dev)
/* Finish populating the Ethernet header */ /* Finish populating the Ethernet header */
memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->src, dev->d_mac.ether.ether_addr_octet, ETHER_ADDR_LEN);
eth->type = HTONS(ETHTYPE_IP6); eth->type = HTONS(ETHTYPE_IP6);
/* Add the size of the layer layer header to the total size of the /* Add the size of the layer layer header to the total size of the
+2 -2
View File
@@ -694,7 +694,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
{ {
req->ifr_hwaddr.sa_family = AF_INETX; req->ifr_hwaddr.sa_family = AF_INETX;
memcpy(req->ifr_hwaddr.sa_data, memcpy(req->ifr_hwaddr.sa_data,
dev->d_mac.ether_addr_octet, IFHWADDRLEN); dev->d_mac.ether.ether_addr_octet, IFHWADDRLEN);
ret = OK; ret = OK;
} }
else else
@@ -736,7 +736,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
if (true) if (true)
#endif #endif
{ {
memcpy(dev->d_mac.ether_addr_octet, memcpy(dev->d_mac.ether.ether_addr_octet,
req->ifr_hwaddr.sa_data, IFHWADDRLEN); req->ifr_hwaddr.sa_data, IFHWADDRLEN);
ret = OK; ret = OK;
} }
+3 -3
View File
@@ -334,9 +334,9 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
#ifdef CONFIG_NET_ETHERNET #ifdef CONFIG_NET_ETHERNET
ninfo("Registered MAC: %02x:%02x:%02x:%02x:%02x:%02x as dev: %s\n", ninfo("Registered MAC: %02x:%02x:%02x:%02x:%02x:%02x as dev: %s\n",
dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], dev->d_mac.ether.ether_addr_octet[0], dev->d_mac.ether.ether_addr_octet[1],
dev->d_mac.ether_addr_octet[2], dev->d_mac.ether_addr_octet[3], dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3],
dev->d_mac.ether_addr_octet[4], dev->d_mac.ether_addr_octet[5], dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5],
dev->d_ifname); dev->d_ifname);
#else #else
ninfo("Registered dev: %s\n", dev->d_ifname); ninfo("Registered dev: %s\n", dev->d_ifname);
+2 -2
View File
@@ -147,7 +147,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
case NET_LL_ETHERNET: case NET_LL_ETHERNET:
len += snprintf(&netfile->line[len], NET_LINELEN - len, len += snprintf(&netfile->line[len], NET_LINELEN - len,
"%s\tLink encap:Ethernet HWaddr %s", "%s\tLink encap:Ethernet HWaddr %s",
dev->d_ifname, ether_ntoa(&dev->d_mac)); dev->d_ifname, ether_ntoa(&dev->d_mac.ether));
break; break;
#endif #endif
@@ -215,7 +215,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
#elif defined(CONFIG_NET_ETHERNET) #elif defined(CONFIG_NET_ETHERNET)
len += snprintf(&netfile->line[len], NET_LINELEN - len, len += snprintf(&netfile->line[len], NET_LINELEN - len,
"%s\tLink encap:Ethernet HWaddr %s at %s\n", "%s\tLink encap:Ethernet HWaddr %s at %s\n",
dev->d_ifname, ether_ntoa(&dev->d_mac), status); dev->d_ifname, ether_ntoa(&dev->d_mac.ether), status);
#elif defined(CONFIG_NET_6LOWPAN) #elif defined(CONFIG_NET_6LOWPAN)
ieee = (FAR struct ieee802154_driver_s *)dev; ieee = (FAR struct ieee802154_driver_s *)dev;
+1 -1
View File
@@ -105,7 +105,7 @@ static int pkt_bind(FAR struct pkt_conn_s *conn,
#if 0 #if 0
/* Get the MAC address of that interface */ /* Get the MAC address of that interface */
memcpy(hwaddr, g_netdevices->d_mac, 6); memcpy(hwaddr, g_netdevices->d_mac.ether, 6);
#endif #endif
/* Put ifindex and mac address into connection */ /* Put ifindex and mac address into connection */