diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index 03ddbe3383..b98fd6ecac 100644 --- a/arch/arm/src/c5471/c5471_ethernet.c +++ b/arch/arm/src/c5471/c5471_ethernet.c @@ -2364,7 +2364,7 @@ static void c5471_reset(struct c5471_driver_s *priv) static void c5471_macassign(struct c5471_driver_s *priv) { 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; ninfo("MAC: %0x:%0x:%0x:%0x:%0x:%0x\n", diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index 37910fc9b9..1a13ab856a 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -1125,7 +1125,7 @@ static int kinetis_ifup(struct net_driver_s *dev) { FAR struct kinetis_driver_s *priv = (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; int ret; @@ -2144,7 +2144,7 @@ int kinetis_netinitialize(int intf) uidl = getreg32(KINETIS_SIM_UIDL); 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 &= 0x0000FEFF; diff --git a/arch/arm/src/lpc17xx/lpc17_ethernet.c b/arch/arm/src/lpc17xx/lpc17_ethernet.c index 42e046aea1..dd1c05d0d1 100644 --- a/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -1591,16 +1591,16 @@ static int lpc17_ifup(struct net_driver_s *dev) /* Configure the MAC station address */ - regval = (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[5] << 8 | - (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[4]; + regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[5] << 8 | + (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[4]; lpc17_putreg(regval, LPC17_ETH_SA0); - regval = (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[3] << 8 | - (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[2]; + regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[3] << 8 | + (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[2]; lpc17_putreg(regval, LPC17_ETH_SA1); - regval = (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[1] << 8 | - (uint32_t)priv->lp_dev.d_mac.ether_addr_octet[0]; + regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[0]; lpc17_putreg(regval, LPC17_ETH_SA2); #ifdef CONFIG_NET_ICMPv6 diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c index 171f20ee74..2c564aa5ff 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.c +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c @@ -3535,22 +3535,22 @@ static void lpc43_macaddress(FAR struct lpc43_ethmac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address high register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[4]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[4]; lpc43_putreg(regval, LPC43_ETH_MACA0HI); /* Set the MAC address low register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | - ((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | - ((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[0]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[0]; lpc43_putreg(regval, LPC43_ETH_MACA0LO); } diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index f1db43f0ca..7e5839cc19 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -3416,20 +3416,20 @@ static void sam_macaddress(struct sam_emac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address */ - regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | - (uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | - (uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | - (uint32_t)dev->d_mac.ether_addr_octet[3] << 24; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24; sam_putreg(priv, SAM_EMAC_SAB1, regval); - regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | - (uint32_t)dev->d_mac.ether_addr_octet[5] << 8; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8; sam_putreg(priv, SAM_EMAC_SAT1, regval); } diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c index 09cba2280f..494fb7a6e5 100644 --- a/arch/arm/src/sama5/sam_emaca.c +++ b/arch/arm/src/sama5/sam_emaca.c @@ -3458,20 +3458,20 @@ static void sam_macaddress(struct sam_emac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address */ - regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | - (uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | - (uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | - (uint32_t)dev->d_mac.ether_addr_octet[3] << 24; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24; sam_putreg(priv, SAM_EMAC_SA1B, regval); - regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | - (uint32_t)dev->d_mac.ether_addr_octet[5] << 8; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8; sam_putreg(priv, SAM_EMAC_SA1T, regval); } diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index 10c120cc47..2f4fcbf693 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -4106,20 +4106,20 @@ static void sam_macaddress(struct sam_emac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address */ - regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | - (uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | - (uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | - (uint32_t)dev->d_mac.ether_addr_octet[3] << 24; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24; sam_putreg(priv, SAM_EMAC_SAB1_OFFSET, regval); - regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | - (uint32_t)dev->d_mac.ether_addr_octet[5] << 8; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8; sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval); } diff --git a/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c index 0988f8aedb..29d42258de 100644 --- a/arch/arm/src/sama5/sam_gmac.c +++ b/arch/arm/src/sama5/sam_gmac.c @@ -3506,20 +3506,20 @@ static void sam_macaddress(struct sam_gmac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address */ - regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | - (uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | - (uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | - (uint32_t)dev->d_mac.ether_addr_octet[3] << 24; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24; sam_putreg(priv, SAM_GMAC_SAB1, regval); - regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | - (uint32_t)dev->d_mac.ether_addr_octet[5] << 8; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8; sam_putreg(priv, SAM_GMAC_SAT1, regval); } diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index 4760577b8b..5bfb2f4a58 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -4668,20 +4668,20 @@ static void sam_macaddress(struct sam_emac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address */ - regval = (uint32_t)dev->d_mac.ether_addr_octet[0] | - (uint32_t)dev->d_mac.ether_addr_octet[1] << 8 | - (uint32_t)dev->d_mac.ether_addr_octet[2] << 16 | - (uint32_t)dev->d_mac.ether_addr_octet[3] << 24; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[0] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16 | + (uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24; sam_putreg(priv, SAM_EMAC_SAB1_OFFSET, regval); - regval = (uint32_t)dev->d_mac.ether_addr_octet[4] | - (uint32_t)dev->d_mac.ether_addr_octet[5] << 8; + regval = (uint32_t)dev->d_mac.ether.ether_addr_octet[4] | + (uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8; 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 */ 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", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); return OK; } diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index 0b1bbd247c..8b38985f15 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -3674,22 +3674,22 @@ static void stm32_macaddress(FAR struct stm32_ethmac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address high register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[4]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[4]; stm32_putreg(regval, STM32_ETH_MACA0HR); /* Set the MAC address low register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | - ((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | - ((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[0]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[0]; stm32_putreg(regval, STM32_ETH_MACA0LR); } diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c b/arch/arm/src/stm32f7/stm32_ethernet.c index 0885c086cd..2ac01c649e 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.c +++ b/arch/arm/src/stm32f7/stm32_ethernet.c @@ -3780,22 +3780,22 @@ static void stm32_macaddress(struct stm32_ethmac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address high register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[4]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[4]; stm32_putreg(regval, STM32_ETH_MACA0HR); /* Set the MAC address low register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | - ((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | - ((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[0]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[0]; stm32_putreg(regval, STM32_ETH_MACA0LR); } diff --git a/arch/arm/src/tiva/lm3s_ethernet.c b/arch/arm/src/tiva/lm3s_ethernet.c index acfa6c7c2e..885f8cc4d6 100644 --- a/arch/arm/src/tiva/lm3s_ethernet.c +++ b/arch/arm/src/tiva/lm3s_ethernet.c @@ -1389,14 +1389,14 @@ static int tiva_ifup(struct net_driver_s *dev) /* Program the hardware with it's MAC address (for filtering) */ - regval = (uint32_t)priv->ld_dev.d_mac.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_addr_octet[1] << 8 | - (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[0]; + regval = (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[3] << 24 | + (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[2] << 16 | + (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[0]; tiva_ethout(priv, TIVA_MAC_IA0_OFFSET, regval); - regval = (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[5] << 8 | - (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[4]; + regval = (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[5] << 8 | + (uint32_t)priv->ld_dev.d_mac.ether.ether_addr_octet[4]; tiva_ethout(priv, TIVA_MAC_IA1_OFFSET, regval); /* 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_txtimeout = wd_create(); /* Create TX timeout timer */ +#ifdef CONFIG_TIVA_BOARDMAC /* 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() * is called (and the MAC can be overwritten with a netdev ioctl call). */ -#ifdef CONFIG_TIVA_BOARDMAC - tiva_ethernetmac(&priv->ld_dev.d_mac); + tiva_ethernetmac(&priv->ld_dev.d_mac.ether); #endif /* Perform minimal, one-time initialization -- just reset the controller and diff --git a/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index cf0661d36e..63cf22689c 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c_ethernet.c @@ -3755,22 +3755,22 @@ static void tiva_macaddress(FAR struct tiva_ethmac_s *priv) ninfo("%s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", dev->d_ifname, - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); /* Set the MAC address high register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[5] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[4]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[5] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[4]; tiva_putreg(regval, TIVA_EMAC_ADDR0H); /* Set the MAC address low register */ - regval = ((uint32_t)dev->d_mac.ether_addr_octet[3] << 24) | - ((uint32_t)dev->d_mac.ether_addr_octet[2] << 16) | - ((uint32_t)dev->d_mac.ether_addr_octet[1] << 8) | - (uint32_t)dev->d_mac.ether_addr_octet[0]; + regval = ((uint32_t)dev->d_mac.ether.ether_addr_octet[3] << 24) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[2] << 16) | + ((uint32_t)dev->d_mac.ether.ether_addr_octet[1] << 8) | + (uint32_t)dev->d_mac.ether.ether_addr_octet[0]; 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). */ - tiva_ethernetmac(&priv->dev.d_mac); + tiva_ethernetmac(&priv->dev.d_mac.ether); #endif /* Enable power and clocking to the Ethernet MAC diff --git a/arch/hc/src/m9s12/m9s12_ethernet.c b/arch/hc/src/m9s12/m9s12_ethernet.c index 2a2673ed5f..3b3fcf0d74 100644 --- a/arch/hc/src/m9s12/m9s12_ethernet.c +++ b/arch/hc/src/m9s12/m9s12_ethernet.c @@ -781,7 +781,7 @@ int emac_initialize(int intf) * 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 */ diff --git a/arch/mips/src/pic32mx/pic32mx-ethernet.c b/arch/mips/src/pic32mx/pic32mx-ethernet.c index 5a4b7654d1..f436b298b6 100644 --- a/arch/mips/src/pic32mx/pic32mx-ethernet.c +++ b/arch/mips/src/pic32mx/pic32mx-ethernet.c @@ -2216,29 +2216,29 @@ static int pic32mx_ifup(struct net_driver_s *dev) */ #if 0 - regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[5] << 8 | - (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[4]; + regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[5] << 8 | + (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[4]; pic32mx_putreg(regval, PIC32MX_EMAC1_SA0); - regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[3] << 8 | - (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[2]; + regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[3] << 8 | + (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[2]; pic32mx_putreg(regval, PIC32MX_EMAC1_SA1); - regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[1] << 8 | - (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[0]; + regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[0]; pic32mx_putreg(regval, PIC32MX_EMAC1_SA2); #else 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_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[4] = (uint32_t)(regval & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff); 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_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[2] = (uint32_t)(regval & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff); 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_addr_octet[1] = (uint32_t)((regval >> 8) & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[0] = (uint32_t)(regval & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[1] = (uint32_t)((regval >> 8) & 0xff); #endif /* Continue Ethernet Controller Initialization ****************************/ diff --git a/arch/mips/src/pic32mz/pic32mz-ethernet.c b/arch/mips/src/pic32mz/pic32mz-ethernet.c index f49da8530d..5e1b2f5e04 100644 --- a/arch/mips/src/pic32mz/pic32mz-ethernet.c +++ b/arch/mips/src/pic32mz/pic32mz-ethernet.c @@ -2243,34 +2243,34 @@ static int pic32mz_ifup(struct net_driver_s *dev) */ #if 0 - regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[5] << 8 | - (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[4]; + regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[5] << 8 | + (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[4]; pic32mz_putreg(regval, PIC32MZ_EMAC1_SA0); - regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[3] << 8 | - (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[2]; + regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[3] << 8 | + (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[2]; pic32mz_putreg(regval, PIC32MZ_EMAC1_SA1); - regval = (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[1] << 8 | - (uint32_t)priv->pd_dev.d_mac.ether_addr_octet[0]; + regval = (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[1] << 8 | + (uint32_t)priv->pd_dev.d_mac.ether.ether_addr_octet[0]; pic32mz_putreg(regval, PIC32MZ_EMAC1_SA2); #else 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_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[4] = (uint32_t)(regval & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[5] = (uint32_t)((regval >> 8) & 0xff); 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_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[2] = (uint32_t)(regval & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[3] = (uint32_t)((regval >> 8) & 0xff); 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_addr_octet[1] = (uint32_t)((regval >> 8) & 0xff); + priv->pd_dev.d_mac.ether.ether_addr_octet[0] = (uint32_t)(regval & 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", - dev->d_mac.ether_addr_octet[0], dev->d_mac.ether_addr_octet[1], - dev->d_mac.ether_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); #endif /* Continue Ethernet Controller Initialization ****************************/ diff --git a/arch/misoc/src/common/misoc_net.c b/arch/misoc/src/common/misoc_net.c index 6d7b64b62c..a7df365435 100644 --- a/arch/misoc/src/common/misoc_net.c +++ b/arch/misoc/src/common/misoc_net.c @@ -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 */ - /* 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 /* Set up IPv6 multicast address filtering */ @@ -1182,7 +1182,7 @@ int misoc_net_initialize(int intf) */ /* 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 */ diff --git a/arch/sim/src/up_netdriver.c b/arch/sim/src/up_netdriver.c index bb37ec9fcc..99eaf73dbe 100644 --- a/arch/sim/src/up_netdriver.c +++ b/arch/sim/src/up_netdriver.c @@ -198,7 +198,7 @@ void netdriver_loop(void) * 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 /* 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) { - (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; } diff --git a/arch/z80/src/ez80/ez80_emac.c b/arch/z80/src/ez80/ez80_emac.c index 5da9255416..55896c08ff 100644 --- a/arch/z80/src/ez80/ez80_emac.c +++ b/arch/z80/src/ez80/ez80_emac.c @@ -1999,9 +1999,9 @@ static int ez80emac_ifup(FAR struct net_driver_s *dev) int ret; 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_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5]); ninfo(" IP %d.%d.%d.%d\n", dev->d_ipaddr >> 24, (dev->d_ipaddr >> 16) & 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 */ - outp(EZ80_EMAC_STAD_0, priv->dev.d_mac.ether_addr_octet[0]); - outp(EZ80_EMAC_STAD_1, priv->dev.d_mac.ether_addr_octet[1]); - outp(EZ80_EMAC_STAD_2, priv->dev.d_mac.ether_addr_octet[2]); - outp(EZ80_EMAC_STAD_3, priv->dev.d_mac.ether_addr_octet[3]); - outp(EZ80_EMAC_STAD_4, priv->dev.d_mac.ether_addr_octet[4]); - outp(EZ80_EMAC_STAD_5, priv->dev.d_mac.ether_addr_octet[5]); + outp(EZ80_EMAC_STAD_0, priv->dev.d_mac.ether.ether_addr_octet[0]); + outp(EZ80_EMAC_STAD_1, priv->dev.d_mac.ether.ether_addr_octet[1]); + outp(EZ80_EMAC_STAD_2, priv->dev.d_mac.ether.ether_addr_octet[2]); + outp(EZ80_EMAC_STAD_3, priv->dev.d_mac.ether.ether_addr_octet[3]); + outp(EZ80_EMAC_STAD_4, priv->dev.d_mac.ether.ether_addr_octet[4]); + outp(EZ80_EMAC_STAD_5, priv->dev.d_mac.ether.ether_addr_octet[5]); /* Enable/disable promiscuous mode */ @@ -2542,7 +2542,7 @@ int up_netinitialize(void) priv->txpoll = wd_create(); /* Create periodic poll 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 */ diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index e64c2404e0..3dd1e7e0dd 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -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_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 */ diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index a812686e8a..b6cfa6dfb7 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -1955,7 +1955,7 @@ int dm9x_initialize(void) /* 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++) { mptr[i] = getreg(j); diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index d0034543a8..90aa996c0b 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -2440,12 +2440,12 @@ static void enc_setmacaddr(FAR struct enc_driver_s *priv) * 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_MAADR2, priv->dev.d_mac.ether_addr_octet[1]); - enc_wrbreg(priv, ENC_MAADR3, priv->dev.d_mac.ether_addr_octet[2]); - enc_wrbreg(priv, ENC_MAADR4, priv->dev.d_mac.ether_addr_octet[3]); - enc_wrbreg(priv, ENC_MAADR5, priv->dev.d_mac.ether_addr_octet[4]); - enc_wrbreg(priv, ENC_MAADR6, priv->dev.d_mac.ether_addr_octet[5]); + enc_wrbreg(priv, ENC_MAADR1, priv->dev.d_mac.ether.ether_addr_octet[0]); + enc_wrbreg(priv, ENC_MAADR2, priv->dev.d_mac.ether.ether_addr_octet[1]); + enc_wrbreg(priv, ENC_MAADR3, priv->dev.d_mac.ether.ether_addr_octet[2]); + enc_wrbreg(priv, ENC_MAADR4, priv->dev.d_mac.ether.ether_addr_octet[3]); + enc_wrbreg(priv, ENC_MAADR5, priv->dev.d_mac.ether.ether_addr_octet[4]); + enc_wrbreg(priv, ENC_MAADR6, priv->dev.d_mac.ether.ether_addr_octet[5]); } /**************************************************************************** diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c index e15cfe71dc..be66e56da5 100644 --- a/drivers/net/encx24j600.c +++ b/drivers/net/encx24j600.c @@ -2591,7 +2591,7 @@ static void enc_pwrsave(FAR struct enc_driver_s *priv) static void enc_ldmacaddr(FAR struct enc_driver_s *priv) { 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"); @@ -2629,12 +2629,12 @@ static void enc_ldmacaddr(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; 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. */ diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 7b02fa9e21..9acc93d643 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -1185,9 +1185,9 @@ static int ftmac100_ifup(struct net_driver_s *dev) 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 /* Set up IPv6 multicast address filtering */ @@ -1566,9 +1566,9 @@ int ftmac100_initialize(int intf) */ 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 */ diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index 77f1aea82d..5edeadc162 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -803,7 +803,7 @@ static int skel_ifup(FAR struct net_driver_s *dev) /* 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 /* Set up IPv6 multicast address filtering */ @@ -1187,7 +1187,7 @@ int skel_initialize(int intf) * 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 */ diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a942bebe13..4451d52b0a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -631,7 +631,7 @@ static int tun_ifup(struct net_driver_s *dev) /* 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 /* Set up IPv6 multicast address filtering */ diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h index 7caf247adc..85eed6a1e8 100644 --- a/include/nuttx/net/netdev.h +++ b/include/nuttx/net/netdev.h @@ -207,10 +207,17 @@ struct net_driver_s #endif #endif -#ifdef CONFIG_NET_ETHERNET - /* Ethernet device identity */ +#if defined(CONFIG_NET_ETHERNET) + /* 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 /* Network identity */ diff --git a/net/arp/arp_arpin.c b/net/arp/arp_arpin.c index fe8d47a63e..b3350554f5 100644 --- a/net/arp/arp_arpin.c +++ b/net/arp/arp_arpin.c @@ -124,8 +124,8 @@ void arp_arpin(FAR struct net_driver_s *dev) arp->ah_opcode = HTONS(ARP_REPLY); memcpy(arp->ah_dhwaddr, arp->ah_shwaddr, ETHER_ADDR_LEN); - memcpy(arp->ah_shwaddr, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); - memcpy(eth->src, 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.ether_addr_octet, ETHER_ADDR_LEN); memcpy(eth->dest, arp->ah_dhwaddr, ETHER_ADDR_LEN); arp->ah_dipaddr[0] = arp->ah_sipaddr[0]; diff --git a/net/arp/arp_format.c b/net/arp/arp_format.c index 4b0af255d5..c17b4fbdf1 100644 --- a/net/arp/arp_format.c +++ b/net/arp/arp_format.c @@ -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(arp->ah_dhwaddr, 0x00, ETHER_ADDR_LEN); - memcpy(eth->src, dev->d_mac.ether_addr_octet, ETHER_ADDR_LEN); - memcpy(arp->ah_shwaddr, 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.ether_addr_octet, ETHER_ADDR_LEN); net_ipv4addr_hdrcopy(arp->ah_dipaddr, &ipaddr); net_ipv4addr_hdrcopy(arp->ah_sipaddr, &dev->d_ipaddr); diff --git a/net/arp/arp_out.c b/net/arp/arp_out.c index b816197671..53853af7a2 100644 --- a/net/arp/arp_out.c +++ b/net/arp/arp_out.c @@ -249,7 +249,7 @@ void arp_out(FAR struct net_driver_s *dev) /* 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); dev->d_len += ETH_HDRLEN; } diff --git a/net/icmpv6/icmpv6_advertise.c b/net/icmpv6/icmpv6_advertise.c index 68d417873a..621b8d6c14 100644 --- a/net/icmpv6/icmpv6_advertise.c +++ b/net/icmpv6/icmpv6_advertise.c @@ -139,7 +139,7 @@ void icmpv6_advertise(FAR struct net_driver_s *dev, * 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 */ @@ -166,7 +166,7 @@ void icmpv6_advertise(FAR struct net_driver_s *dev, FAR struct eth_hdr_s *eth = ETHBUF; 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 */ diff --git a/net/icmpv6/icmpv6_autoconfig.c b/net/icmpv6/icmpv6_autoconfig.c index 05a9c44926..08ec223def 100644 --- a/net/icmpv6/icmpv6_autoconfig.c +++ b/net/icmpv6/icmpv6_autoconfig.c @@ -402,7 +402,7 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev) lladdr[0] = HTONS(0xfe80); /* 10-bit address + 6 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 */ ninfo("lladdr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", diff --git a/net/icmpv6/icmpv6_radvertise.c b/net/icmpv6/icmpv6_radvertise.c index 040d1e39f7..cec05c51a8 100644 --- a/net/icmpv6/icmpv6_radvertise.c +++ b/net/icmpv6/icmpv6_radvertise.c @@ -176,7 +176,7 @@ void icmpv6_radvertise(FAR struct net_driver_s *dev) srcaddr = &adv->srcaddr; srcaddr->opttype = ICMPv6_OPT_SRCLLADDR; 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 */ @@ -228,7 +228,7 @@ void icmpv6_radvertise(FAR struct net_driver_s *dev) FAR struct eth_hdr_s *eth = ETHBUF; 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 */ diff --git a/net/icmpv6/icmpv6_rsolicit.c b/net/icmpv6/icmpv6_rsolicit.c index db21f7f0a7..93a2631432 100644 --- a/net/icmpv6/icmpv6_rsolicit.c +++ b/net/icmpv6/icmpv6_rsolicit.c @@ -137,7 +137,7 @@ void icmpv6_rsolicit(FAR struct net_driver_s *dev) * 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 */ @@ -162,7 +162,7 @@ void icmpv6_rsolicit(FAR struct net_driver_s *dev) /* 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 */ diff --git a/net/icmpv6/icmpv6_solicit.c b/net/icmpv6/icmpv6_solicit.c index 5a9c6e868a..5eae392c52 100644 --- a/net/icmpv6/icmpv6_solicit.c +++ b/net/icmpv6/icmpv6_solicit.c @@ -152,7 +152,7 @@ void icmpv6_solicit(FAR struct net_driver_s *dev, * 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 */ @@ -190,7 +190,7 @@ void icmpv6_solicit(FAR struct net_driver_s *dev, /* 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 */ diff --git a/net/neighbor/neighbor_ethernet_out.c b/net/neighbor/neighbor_ethernet_out.c index ddd9a3a5ff..adfff98723 100644 --- a/net/neighbor/neighbor_ethernet_out.c +++ b/net/neighbor/neighbor_ethernet_out.c @@ -245,7 +245,7 @@ void neighbor_out(FAR struct net_driver_s *dev) /* 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); /* Add the size of the layer layer header to the total size of the diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index b9581f46d3..a40d526ecf 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -694,7 +694,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, { req->ifr_hwaddr.sa_family = AF_INETX; memcpy(req->ifr_hwaddr.sa_data, - dev->d_mac.ether_addr_octet, IFHWADDRLEN); + dev->d_mac.ether.ether_addr_octet, IFHWADDRLEN); ret = OK; } else @@ -736,7 +736,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, if (true) #endif { - memcpy(dev->d_mac.ether_addr_octet, + memcpy(dev->d_mac.ether.ether_addr_octet, req->ifr_hwaddr.sa_data, IFHWADDRLEN); ret = OK; } diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index 1aef9c3ed1..8da52f9151 100644 --- a/net/netdev/netdev_register.c +++ b/net/netdev/netdev_register.c @@ -334,9 +334,9 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype) #ifdef CONFIG_NET_ETHERNET 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_addr_octet[2], dev->d_mac.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[0], dev->d_mac.ether.ether_addr_octet[1], + dev->d_mac.ether.ether_addr_octet[2], dev->d_mac.ether.ether_addr_octet[3], + dev->d_mac.ether.ether_addr_octet[4], dev->d_mac.ether.ether_addr_octet[5], dev->d_ifname); #else ninfo("Registered dev: %s\n", dev->d_ifname); diff --git a/net/procfs/netdev_statistics.c b/net/procfs/netdev_statistics.c index f4927eab2f..b4c29f3bdf 100644 --- a/net/procfs/netdev_statistics.c +++ b/net/procfs/netdev_statistics.c @@ -147,7 +147,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile) case NET_LL_ETHERNET: len += snprintf(&netfile->line[len], NET_LINELEN - len, "%s\tLink encap:Ethernet HWaddr %s", - dev->d_ifname, ether_ntoa(&dev->d_mac)); + dev->d_ifname, ether_ntoa(&dev->d_mac.ether)); break; #endif @@ -215,7 +215,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile) #elif defined(CONFIG_NET_ETHERNET) len += snprintf(&netfile->line[len], NET_LINELEN - len, "%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) ieee = (FAR struct ieee802154_driver_s *)dev; diff --git a/net/socket/bind.c b/net/socket/bind.c index 544d1e0d53..a6671ec40d 100644 --- a/net/socket/bind.c +++ b/net/socket/bind.c @@ -105,7 +105,7 @@ static int pkt_bind(FAR struct pkt_conn_s *conn, #if 0 /* Get the MAC address of that interface */ - memcpy(hwaddr, g_netdevices->d_mac, 6); + memcpy(hwaddr, g_netdevices->d_mac.ether, 6); #endif /* Put ifindex and mac address into connection */