diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index 03ddbe33837..b98fd6ecac9 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 37910fc9b9f..1a13ab856a1 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 42e046aea1c..dd1c05d0d14 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 171f20ee74a..2c564aa5ff9 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 f1db43f0caa..7e5839cc197 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 09cba2280f3..494fb7a6e5f 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 10c120cc477..2f4fcbf6934 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 0988f8aedb2..29d42258ded 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 4760577b8b2..5bfb2f4a587 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 0b1bbd247c9..8b38985f15f 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 0885c086cd4..2ac01c649e5 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 acfa6c7c2e4..885f8cc4d65 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 cf0661d36ed..63cf22689c8 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 2a2673ed5f8..3b3fcf0d741 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 5a4b7654d17..f436b298b6a 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 f49da8530dd..5e1b2f5e046 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 6d7b64b62c0..a7df3654352 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 bb37ec9fcc7..99eaf73dbe3 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 5da9255416a..55896c08ff6 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 e64c2404e07..3dd1e7e0ddb 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 a812686e8a5..b6cfa6dfb74 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 d0034543a8e..90aa996c0bc 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 e15cfe71dc8..be66e56da5f 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 7b02fa9e21a..9acc93d643b 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 77f1aea82d7..5edeadc162b 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 a942bebe13b..4451d52b0a0 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/ieee802154.h b/include/nuttx/net/ieee802154.h new file mode 100644 index 00000000000..6132d3d02bc --- /dev/null +++ b/include/nuttx/net/ieee802154.h @@ -0,0 +1,138 @@ +/**************************************************************************** + * include/nuttx/net/ieee802154.h + * + * Copyright (C) 2017, Gregory Nutt, all rights reserved + * Author: Gregory Nutt + * + * Derives from Contiki: + * + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * Authors: Adam Dunkels + * Nicolas Tsiftes + * Niclas Finne + * Mathilde Durvy + * Julien Abeille + * + * 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 the Institute 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 THE INSTITUTE 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 THE INSTITUTE 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. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_NET_IEEE802154_H +#define __INCLUDE_NUTTX_NET_IEEE802154_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#ifdef CONFIG_NET_6LOWPAN + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* By default, a 2-byte Rime address is used for the IEEE802.15.4 MAC + * device's link layer address. If CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED + * is selected, then an 8-byte Rime address will be used. + */ + +#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED +# define NET_6LOWPAN_RIMEADDR_SIZE 8 +#else +# define NET_6LOWPAN_RIMEADDR_SIZE 2 +#endif + +/* Frame format definitions *************************************************/ +/* These are some definitions of element values used in the FCF. See the + * IEEE802.15.4 spec for details. + */ + +#define FRAME802154_FRAMETYPE_SHIFT (0) /* Bits 0-2: Frame type */ +#define FRAME802154_FRAMETYPE_MASK (7 << FRAME802154_FRAMETYPE_SHIFT) +#define FRAME802154_SECENABLED_SHIFT (3) /* Bit 3: Security enabled */ +#define FRAME802154_FRAMEPENDING_SHIFT (4) /* Bit 4: Frame pending */ +#define FRAME802154_ACKREQUEST_SHIFT (5) /* Bit 5: ACK request */ +#define FRAME802154_PANIDCOMP_SHIFT (6) /* Bit 6: PANID compression */ + /* Bits 7-9: Reserved */ +#define FRAME802154_DSTADDR_SHIFT (2) /* Bits 10-11: Dest address mode */ +#define FRAME802154_DSTADDR_MASK (3 << FRAME802154_DSTADDR_SHIFT) +#define FRAME802154_VERSION_SHIFT (4) /* Bit 12-13: Frame version */ +#define FRAME802154_VERSION_MASK (3 << FRAME802154_VERSION_SHIFT) +#define FRAME802154_SRCADDR_SHIFT (6) /* Bits 14-15: Source address mode */ +#define FRAME802154_SRCADDR_MASK (3 << FRAME802154_SRCADDR_SHIFT) + +/* Unshifted values for use in struct frame802154_fcf_s */ + +#define FRAME802154_BEACONFRAME (0) +#define FRAME802154_DATAFRAME (1) +#define FRAME802154_ACKFRAME (2) +#define FRAME802154_CMDFRAME (3) + +#define FRAME802154_BEACONREQ (7) + +#define FRAME802154_IEEERESERVED (0) +#define FRAME802154_NOADDR (0) /* Only valid for ACK or Beacon frames */ +#define FRAME802154_SHORTADDRMODE (2) +#define FRAME802154_LONGADDRMODE (3) + +#define FRAME802154_NOBEACONS 0x0f + +#define FRAME802154_BROADCASTADDR 0xffff +#define FRAME802154_BROADCASTPANDID 0xffff + +#define FRAME802154_IEEE802154_2003 (0) +#define FRAME802154_IEEE802154_2006 (1) + +#define FRAME802154_SECURITY_LEVEL_NONE (0) +#define FRAME802154_SECURITY_LEVEL_128 (3) + +/* This maximum size of an IEEE802.15.4 frame. Certain, non-standard + * devices may exceed this value, however. + */ + +#define SIXLOWPAN_MAC_STDFRAME 127 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* Rime address representation */ + +struct rimeaddr_s +{ + uint8_t u8[NET_6LOWPAN_RIMEADDR_SIZE]; +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* CONFIG_NET_6LOWPAN */ +#endif /* __INCLUDE_NUTTX_NET_IEEE802154_H */ diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h index 7caf247adca..eb84a7774fd 100644 --- a/include/nuttx/net/netdev.h +++ b/include/nuttx/net/netdev.h @@ -56,12 +56,16 @@ #include #include +#include +#include + #ifdef CONFIG_NET_IGMP # include #endif -#include -#include +#ifdef CONFIG_NET_6LOWPAN +# include +#endif /**************************************************************************** * Pre-processor Definitions @@ -207,10 +211,22 @@ struct net_driver_s #endif #endif -#ifdef CONFIG_NET_ETHERNET - /* Ethernet device identity */ +#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN) + /* 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 +#ifdef CONFIG_NET_6LOWPAN + /* The address assigned to an IEEE 802.15.4 radio. */ + + struct rimeaddr_s ieee802154; /* IEEE 802.15.4 Radio address */ +#endif + } d_mac; #endif /* Network identity */ diff --git a/include/nuttx/net/sixlowpan.h b/include/nuttx/net/sixlowpan.h index fd2301632d8..f67ac0d98e3 100644 --- a/include/nuttx/net/sixlowpan.h +++ b/include/nuttx/net/sixlowpan.h @@ -56,6 +56,7 @@ #include #include #include +#include #ifdef CONFIG_NET_6LOWPAN @@ -63,17 +64,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* By default, a 2-byte Rime address is used for the IEEE802.15.4 MAC - * device's link layer address. If CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED - * is selected, then an 8-byte Rime address will be used. - */ - -#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED -# define NET_6LOWPAN_RIMEADDR_SIZE 8 -#else -# define NET_6LOWPAN_RIMEADDR_SIZE 2 -#endif - /* Frame format definitions *************************************************/ /* Fragment header. * @@ -108,49 +98,6 @@ #define RIME_HC1_HC_UDP_PORTS 4 /* 8 bit */ #define RIME_HC1_HC_UDP_CHKSUM 5 /* 16 bit */ -/* These are some definitions of element values used in the FCF. See the - * IEEE802.15.4 spec for details. - */ - -#define FRAME802154_FRAMETYPE_SHIFT (0) /* Bits 0-2: Frame type */ -#define FRAME802154_FRAMETYPE_MASK (7 << FRAME802154_FRAMETYPE_SHIFT) -#define FRAME802154_SECENABLED_SHIFT (3) /* Bit 3: Security enabled */ -#define FRAME802154_FRAMEPENDING_SHIFT (4) /* Bit 4: Frame pending */ -#define FRAME802154_ACKREQUEST_SHIFT (5) /* Bit 5: ACK request */ -#define FRAME802154_PANIDCOMP_SHIFT (6) /* Bit 6: PANID compression */ - /* Bits 7-9: Reserved */ -#define FRAME802154_DSTADDR_SHIFT (2) /* Bits 10-11: Dest address mode */ -#define FRAME802154_DSTADDR_MASK (3 << FRAME802154_DSTADDR_SHIFT) -#define FRAME802154_VERSION_SHIFT (4) /* Bit 12-13: Frame version */ -#define FRAME802154_VERSION_MASK (3 << FRAME802154_VERSION_SHIFT) -#define FRAME802154_SRCADDR_SHIFT (6) /* Bits 14-15: Source address mode */ -#define FRAME802154_SRCADDR_MASK (3 << FRAME802154_SRCADDR_SHIFT) - -/* Unshifted values for use in struct frame802154_fcf_s */ - -#define FRAME802154_BEACONFRAME (0) -#define FRAME802154_DATAFRAME (1) -#define FRAME802154_ACKFRAME (2) -#define FRAME802154_CMDFRAME (3) - -#define FRAME802154_BEACONREQ (7) - -#define FRAME802154_IEEERESERVED (0) -#define FRAME802154_NOADDR (0) /* Only valid for ACK or Beacon frames */ -#define FRAME802154_SHORTADDRMODE (2) -#define FRAME802154_LONGADDRMODE (3) - -#define FRAME802154_NOBEACONS 0x0f - -#define FRAME802154_BROADCASTADDR 0xffff -#define FRAME802154_BROADCASTPANDID 0xffff - -#define FRAME802154_IEEE802154_2003 (0) -#define FRAME802154_IEEE802154_2006 (1) - -#define FRAME802154_SECURITY_LEVEL_NONE (0) -#define FRAME802154_SECURITY_LEVEL_128 (3) - /* Min and Max compressible UDP ports - HC06 */ #define SIXLOWPAN_UDP_4_BIT_PORT_MIN 0xf0b0 @@ -261,12 +208,6 @@ #define SIXLOWPAN_FRAG1_HDR_LEN 4 #define SIXLOWPAN_FRAGN_HDR_LEN 5 -/* This maximum size of an IEEE802.15.4 frame. Certain, non-standard - * devices may exceed this value, however. - */ - -#define SIXLOWPAN_MAC_STDFRAME 127 - /* Address compressibility test macros **************************************/ /* Check whether we can compress the IID in address 'a' to 16 bits. This is @@ -389,13 +330,6 @@ * Public Types ****************************************************************************/ -/* Rime address representation */ - -struct rimeaddr_s -{ - uint8_t u8[NET_6LOWPAN_RIMEADDR_SIZE]; -}; - /* The device structure for IEEE802.15.4 MAC network device differs from the * standard Ethernet MAC device structure. The main reason for this * difference is that fragmentation must be supported. @@ -429,9 +363,7 @@ struct rimeaddr_s * 1. i_dsn must be set to a random value. After that, it will be managed * by the network. * - * 2. i_nodeaddr must be set after the MAC is assigned an address. - * - * 3. On a TX poll, the IEEE802.15.4 MAC driver should provide its driver + * 2. On a TX poll, the IEEE802.15.4 MAC driver should provide its driver * structure with i_framelist set to NULL. At the conclusion of the * poll, if there are frames to be sent, they will have been added to * the i_framelist. The non-empty frame list at the conclusion of the @@ -446,7 +378,7 @@ struct rimeaddr_s * After sending each frame, the driver must return the IOB to the pool * of free IOBs using the FROM_IOB_FREE() macro. * - * 4. When receiving data both buffers must be provided: + * 3. When receiving data both buffers must be provided: * * The IEEE802.15.4 MAC driver should receive the frame data directly * into the payload area of an IOB structure. That IOB structure may be @@ -497,10 +429,6 @@ struct ieee802154_driver_s FAR struct iob_s *i_framelist; /* Driver Configuration ***************************************************/ - /* i_node_addr. The address assigned to this node. */ - - struct rimeaddr_s i_nodeaddr; - /* i_dsn. The sequence number in the range 0x00-0xff added to the * transmitted data or MAC command frame. The default is a random value * within that range. diff --git a/net/arp/arp_arpin.c b/net/arp/arp_arpin.c index fe8d47a63ef..b3350554f58 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 4b0af255d59..c17b4fbdf1a 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 b8161976718..53853af7a2d 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 68d417873af..621b8d6c146 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 05a9c449265..08ec223def6 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 040d1e39f7a..cec05c51a8b 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 db21f7f0a72..93a26314329 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 5a9c6e868a7..5eae392c522 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 ddd9a3a5ffd..adfff98723a 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 e74731175a9..5350183f05c 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -775,7 +775,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 @@ -788,13 +788,9 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, if (true) #endif { - FAR struct ieee802154_driver_s *ieee = - (FAR struct ieee802154_driver_s *)dev; - req->ifr_hwaddr.sa_family = AF_INETX; - memcpy(req->ifr_hwaddr.sa_data, ieee->i_nodeaddr.u8, - NET_6LOWPAN_RIMEADDR_SIZE); - ret = OK; + memcpy(req->ifr_hwaddr.sa_data, + dev->d_mac.ieee802154.u8, NET_6LOWPAN_RIMEADDR_SIZE); } else #endif @@ -817,7 +813,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; } @@ -831,13 +827,9 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, if (true) #endif { - FAR struct ieee802154_driver_s *ieee = - (FAR struct ieee802154_driver_s *)dev; - - req->ifr_hwaddr.sa_family = AF_INETX; - memcpy(ieee->i_nodeaddr.u8, req->ifr_hwaddr.sa_data, - NET_6LOWPAN_RIMEADDR_SIZE); - ret = OK; + memcpy(dev->d_mac.ieee802154.u8, + req->ifr_hwaddr.sa_data, NET_6LOWPAN_RIMEADDR_SIZE); + ret = OK; } else #endif diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index 1aef9c3ed10..8da52f91510 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 f4927eab2fe..5383adfc6a4 100644 --- a/net/procfs/netdev_statistics.c +++ b/net/procfs/netdev_statistics.c @@ -112,9 +112,6 @@ static const linegen_t g_linegen[] = static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile) { FAR struct net_driver_s *dev; -#ifdef CONFIG_NET_6LOWPAN - FAR struct ieee802154_driver_s *ieee; -#endif FAR const char *status; int len = 0; @@ -147,29 +144,27 @@ 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 #ifdef CONFIG_NET_6LOWPAN case NET_LL_IEEE802154: { - ieee = (FAR struct ieee802154_driver_s *)dev; - #ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED len += snprintf(&netfile->line[len], NET_LINELEN - len, "%s\tLink encap:6loWPAN HWaddr " "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", dev->d_ifname, - ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1], - ieee->i_nodeaddr.u8[2], ieee->i_nodeaddr.u8[3], - ieee->i_nodeaddr.u8[4], ieee->i_nodeaddr.u8[5], - ieee->i_nodeaddr.u8[6], ieee->i_nodeaddr.u8[7]); + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1], + dev->d_mac.ieee802154.u8[2], dev->d_mac.ieee802154.u8[3], + dev->d_mac.ieee802154.u8[4], dev->d_mac.ieee802154.u8[5], + dev->d_mac.ieee802154.u8[6], dev->d_mac.ieee802154.u8[7]); #else len += snprintf(&netfile->line[len], NET_LINELEN - len, "%s\tLink encap:6loWPAN HWaddr %02x:%02x", dev->d_ifname, - ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1]); + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1]); #endif } break; @@ -215,26 +210,24 @@ 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; - #ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED len += snprintf(&netfile->line[len], NET_LINELEN - len, "%s\tLink encap:6loWPAN HWaddr " "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x at %s\n", dev->d_ifname, - ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1], - ieee->i_nodeaddr.u8[2], ieee->i_nodeaddr.u8[3], - ieee->i_nodeaddr.u8[4], ieee->i_nodeaddr.u8[5], - ieee->i_nodeaddr.u8[6], ieee->i_nodeaddr.u8[7], + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1], + dev->d_mac.ieee802154.u8[2], dev->d_mac.ieee802154.u8[3], + dev->d_mac.ieee802154.u8[4], dev->d_mac.ieee802154.u8[5], + dev->d_mac.ieee802154.u8[6], dev->d_mac.ieee802154.u8[7], status); #else len += snprintf(&netfile->line[len], NET_LINELEN - len, "%s\tLink encap:6loWPAN HWaddr %02x:%02x at %s\n", dev->d_ifname, - ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1], + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1], status); #endif #elif defined(CONFIG_NET_LOOPBACK) diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index e392c022988..962aa8b7864 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -284,7 +284,8 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, /* Set the source and destinatino address */ - rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_SENDER], &ieee->i_nodeaddr); + rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_SENDER], + &ieee->i_dev.d_mac.ieee802154); rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER], destmac); /* Get the destination PAN ID. diff --git a/net/sixlowpan/sixlowpan_framer.c b/net/sixlowpan/sixlowpan_framer.c index 4ec877d2d5c..0304485c4f7 100644 --- a/net/sixlowpan/sixlowpan_framer.c +++ b/net/sixlowpan/sixlowpan_framer.c @@ -372,7 +372,8 @@ static void sixlowpan_setup_params(FAR struct ieee802154_driver_s *ieee, /* Set the source address to the node address assigned to the device */ - rimeaddr_copy((struct rimeaddr_s *)¶ms->src_addr, &ieee->i_nodeaddr); + rimeaddr_copy((struct rimeaddr_s *)¶ms->src_addr, + &ieee->i_dev.d_mac.ieee802154); /* Use short soruce address mode if so configured */ diff --git a/net/sixlowpan/sixlowpan_hc06.c b/net/sixlowpan/sixlowpan_hc06.c index 8a4999579e6..a2ceb53cb65 100644 --- a/net/sixlowpan/sixlowpan_hc06.c +++ b/net/sixlowpan/sixlowpan_hc06.c @@ -614,7 +614,8 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee, /* Compression compare with this nodes address (source) */ - iphc1 |= compress_addr_64(ipv6->srcipaddr, &ieee->i_nodeaddr, + iphc1 |= compress_addr_64(ipv6->srcipaddr, + &ieee->i_dev.d_mac.ieee802154, SIXLOWPAN_IPHC_SAM_BIT); } @@ -624,7 +625,8 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee, ipv6->destipaddr[1] == 0 && ipv6->destipaddr[2] == 0 && ipv6->destipaddr[3] == 0) { - iphc1 |= compress_addr_64(ipv6->srcipaddr, &ieee->i_nodeaddr, + iphc1 |= compress_addr_64(ipv6->srcipaddr, + &ieee->i_dev.d_mac.ieee802154, SIXLOWPAN_IPHC_SAM_BIT); } else diff --git a/net/sixlowpan/sixlowpan_hc1.c b/net/sixlowpan/sixlowpan_hc1.c index 313fc388ab3..3696c4a34f7 100644 --- a/net/sixlowpan/sixlowpan_hc1.c +++ b/net/sixlowpan/sixlowpan_hc1.c @@ -129,7 +129,7 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee, if (ipv6->vtc != 0x60 || ipv6->tcf != 0 || ipv6->flow != 0 || !sixlowpan_islinklocal(ipv6->srcipaddr) || - !sixlowpan_ismacbased(ipv6->srcipaddr, &ieee->i_nodeaddr) || + !sixlowpan_ismacbased(ipv6->srcipaddr, &ieee->i_dev.d_mac.ieee802154) || !sixlowpan_islinklocal(ipv6->destipaddr) || !sixlowpan_ismacbased(ipv6->destipaddr, destmac) || (ipv6->proto != IP_PROTO_ICMP6 && ipv6->proto != IP_PROTO_UDP && diff --git a/net/socket/bind.c b/net/socket/bind.c index 544d1e0d53c..a6671ec40d2 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 */ diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c index 107ba3d3320..fbc06d4d322 100644 --- a/wireless/ieee802154/mac802154_loopback.c +++ b/wireless/ieee802154/mac802154_loopback.c @@ -373,14 +373,14 @@ static int lo_ifup(FAR struct net_driver_s *dev) #ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%04x\n", - priv->lo_ieee.i_nodeaddr.u8[0], priv->lo_ieee.i_nodeaddr.u8[1], - priv->lo_ieee.i_nodeaddr.u8[2], priv->lo_ieee.i_nodeaddr.u8[3], - priv->lo_ieee.i_nodeaddr.u8[4], priv->lo_ieee.i_nodeaddr.u8[5], - priv->lo_ieee.i_nodeaddr.u8[6], priv->lo_ieee.i_nodeaddr.u8[7], + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1], + dev->d_mac.ieee802154.u8[2], dev->d_mac.ieee802154.u8[3], + dev->d_mac.ieee802154.u8[4], dev->d_mac.ieee802154.u8[5], + dev->d_mac.ieee802154.u8[6], dev->d_mac.ieee802154.u8[7], priv->lo_panid); #else ninfo(" Node: %02x:%02x PANID=%04x\n", - priv->lo_ieee.i_nodeaddr.u8[0], priv->lo_ieee.i_nodeaddr.u8[1], + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1], priv->lo_panid); #endif