Skip to content

Commit

Permalink
net/ip: print ip addresses using ip4_addrN macro
Browse files Browse the repository at this point in the history
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
  • Loading branch information
pkarashchenko committed Aug 18, 2023
1 parent 26c9f47 commit b9d4f9e
Show file tree
Hide file tree
Showing 49 changed files with 231 additions and 244 deletions.
9 changes: 4 additions & 5 deletions arch/arm/src/c5471/c5471_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -1721,11 +1722,9 @@ static int c5471_ifup(struct net_driver_s *dev)
struct c5471_driver_s *priv = (struct c5471_driver_s *)dev->d_private;
volatile uint32_t clearbits;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Initialize Ethernet interface */

Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/gd32f4/gd32f4xx_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/net/phy.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#if defined(CONFIG_NET_PKT)
Expand Down Expand Up @@ -2242,11 +2243,9 @@ static int gd32_ifup(struct net_driver_s *dev)
int ret;

#ifdef CONFIG_NET_IPv4
ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));
#endif

/* Configure the Ethernet interface for DMA operation. */
Expand Down
17 changes: 7 additions & 10 deletions arch/arm/src/imx6/imx_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <nuttx/signal.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/phy.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -1276,11 +1277,9 @@ static int imx_ifup_action(struct net_driver_s *dev, bool resetphy)
uint32_t regval;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Initialize ENET buffers */

Expand Down Expand Up @@ -1422,11 +1421,9 @@ static int imx_ifdown(struct net_driver_s *dev)
(struct imx_driver_s *)dev->d_private;
irqstate_t flags;

ninfo("Taking down: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Taking down: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Flush and disable the Ethernet interrupts at the NVIC */

Expand Down
17 changes: 7 additions & 10 deletions arch/arm/src/imxrt/imxrt_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <nuttx/signal.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/phy.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -1313,11 +1314,9 @@ static int imxrt_ifup_action(struct net_driver_s *dev, bool resetphy)
uint32_t regval;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Initialize ENET buffers */

Expand Down Expand Up @@ -1454,11 +1453,9 @@ static int imxrt_ifdown(struct net_driver_s *dev)
(struct imxrt_driver_s *)dev->d_private;
irqstate_t flags;

ninfo("Taking down: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Taking down: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Flush and disable the Ethernet interrupts at the NVIC */

Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/kinetis/kinetis_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/signal.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -995,11 +996,9 @@ static int kinetis_ifup(struct net_driver_s *dev)
uint32_t regval;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

#if defined(PIN_ENET_PHY_EN)
kinetis_gpiowrite(PIN_ENET_PHY_EN, true);
Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <nuttx/signal.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/netconfig.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -1454,11 +1455,9 @@ static int lpc17_40_ifup(struct net_driver_s *dev)
uint32_t regval;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Reset the Ethernet controller (again) */

Expand Down
10 changes: 5 additions & 5 deletions arch/arm/src/lpc43xx/lpc43_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
#include <nuttx/wdog.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#if defined(CONFIG_NET_PKT)
# include <nuttx/net/pkt.h>
#endif
Expand Down Expand Up @@ -2071,11 +2073,9 @@ static int lpc43_ifup(struct net_driver_s *dev)
int ret;

#ifdef CONFIG_NET_IPv4
ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));
#endif
#ifdef CONFIG_NET_IPv6
ninfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/lpc54xx/lpc54_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/clock.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -1722,11 +1723,9 @@ static int lpc54_eth_ifup(struct net_driver_s *dev)
int i;

#ifdef CONFIG_NET_IPv4
ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));
#endif
#ifdef CONFIG_NET_IPv6
ninfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
Expand Down
13 changes: 7 additions & 6 deletions arch/arm/src/s32k1xx/s32k1xx_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <nuttx/signal.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/phy.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -1150,9 +1151,9 @@ static int s32k1xx_ifup_action(struct net_driver_s *dev, bool resetphy)
uint32_t regval;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff), (int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff), (int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Initialize ENET buffers */

Expand Down Expand Up @@ -1290,9 +1291,9 @@ static int s32k1xx_ifdown(struct net_driver_s *dev)
(struct s32k1xx_driver_s *)dev->d_private;
irqstate_t flags;

ninfo("Taking down: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff), (int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff), (int)(dev->d_ipaddr >> 24));
ninfo("Taking down: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Flush and disable the Ethernet interrupts at the NVIC */

Expand Down
13 changes: 7 additions & 6 deletions arch/arm/src/s32k3xx/s32k3xx_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <nuttx/signal.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/phy.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>

#ifdef CONFIG_NET_PKT
Expand Down Expand Up @@ -1947,9 +1948,9 @@ static int s32k3xx_ifup_action(struct net_driver_s *dev, bool resetphy)
uint32_t regval;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff), (int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff), (int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Initialize the free buffer list */

Expand Down Expand Up @@ -2059,9 +2060,9 @@ static int s32k3xx_ifdown(struct net_driver_s *dev)
struct s32k3xx_driver_s *priv = (struct s32k3xx_driver_s *)dev->d_private;
irqstate_t flags;

ninfo("Taking down: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff), (int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff), (int)(dev->d_ipaddr >> 24));
ninfo("Taking down: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Flush and disable the Ethernet interrupts at the NVIC */

Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/sam34/sam_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>

Expand Down Expand Up @@ -1676,11 +1677,9 @@ static int sam_ifup(struct net_driver_s *dev)
struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Configure the EMAC interface for normal operation. */

Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/sama5/sam_emaca.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>

Expand Down Expand Up @@ -1737,11 +1738,9 @@ static int sam_ifup(struct net_driver_s *dev)
struct sam_emac_s *priv = (struct sam_emac_s *)dev->d_private;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Configure the EMAC interface for normal operation. */

Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/sama5/sam_emacb.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/mii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>

Expand Down Expand Up @@ -2075,11 +2076,9 @@ static int sam_ifup(struct net_driver_s *dev)
int ret;

#ifdef CONFIG_NET_IPv4
ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));
#endif
#ifdef CONFIG_NET_IPv6
ninfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/sama5/sam_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/gmii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>

Expand Down Expand Up @@ -1721,11 +1722,9 @@ static int sam_ifup(struct net_driver_s *dev)
struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff),
(int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff),
(int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Configure the GMAC interface for normal operation. */

Expand Down
7 changes: 4 additions & 3 deletions arch/arm/src/samd5e5/sam_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/wqueue.h>
#include <nuttx/net/gmii.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>

Expand Down Expand Up @@ -1686,9 +1687,9 @@ static int sam_ifup(struct net_driver_s *dev)
struct sam_gmac_s *priv = (struct sam_gmac_s *)dev->d_private;
int ret;

ninfo("Bringing up: %d.%d.%d.%d\n",
(int)(dev->d_ipaddr & 0xff), (int)((dev->d_ipaddr >> 8) & 0xff),
(int)((dev->d_ipaddr >> 16) & 0xff), (int)(dev->d_ipaddr >> 24));
ninfo("Bringing up: %u.%u.%u.%u\n",
ip4_addr1(dev->d_ipaddr), ip4_addr2(dev->d_ipaddr),
ip4_addr3(dev->d_ipaddr), ip4_addr4(dev->d_ipaddr));

/* Configure the GMAC interface for normal operation. */

Expand Down
Loading

0 comments on commit b9d4f9e

Please sign in to comment.