Skip to content

Commit e6daacf

Browse files
jukkarnashif
authored andcommitted
net: Convert Ethernet drivers to use renamed network APIs
Rename network symbols in Ethernet drivers to use the renamed network APIs. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent d67611a commit e6daacf

31 files changed

+47
-45
lines changed

drivers/ethernet/eth_adin2111.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ int eth_adin2111_oa_data_read(const struct device *dev, const uint16_t port_idx)
317317

318318
if (ftr & ADIN2111_OA_DATA_FTR_EV) {
319319
pkt = net_pkt_rx_alloc_with_buffer(iface, CONFIG_ETH_ADIN2111_BUFFER_SIZE,
320-
AF_UNSPEC, 0,
320+
NET_AF_UNSPEC, 0,
321321
K_MSEC(CONFIG_ETH_ADIN2111_TIMEOUT));
322322
if (!pkt) {
323323
LOG_ERR("OA RX: cannot allcate packet space, skipping.");
@@ -439,7 +439,7 @@ static int eth_adin2111_reg_read_generic(const struct device *dev,
439439
#endif /* CONFIG_ETH_ADIN2111_SPI_CFG0 */
440440

441441
/* spi header */
442-
*(uint16_t *)buf = htons((ADIN2111_READ_TXN_CTRL | reg));
442+
*(uint16_t *)buf = net_htons((ADIN2111_READ_TXN_CTRL | reg));
443443
#if CONFIG_ETH_ADIN2111_SPI_CFG0
444444
buf[2] = crc8_ccitt(0, buf, ADIN2111_SPI_HEADER_SIZE);
445445
/* TA */
@@ -471,7 +471,7 @@ static int eth_adin2111_reg_read_generic(const struct device *dev,
471471
}
472472
#endif /* CONFIG_ETH_ADIN2111_SPI_CFG0 */
473473

474-
*val = ntohl((*(uint32_t *)(&buf[header_len])));
474+
*val = net_ntohl((*(uint32_t *)(&buf[header_len])));
475475

476476
return ret;
477477
}
@@ -490,14 +490,14 @@ static int eth_adin2111_reg_write_generic(const struct device *dev,
490490
#endif /* CONFIG_ETH_ADIN2111_SPI_CFG0 */
491491

492492
/* spi header */
493-
*(uint16_t *)buf = htons((ADIN2111_WRITE_TXN_CTRL | reg));
493+
*(uint16_t *)buf = net_htons((ADIN2111_WRITE_TXN_CTRL | reg));
494494
#if CONFIG_ETH_ADIN2111_SPI_CFG0
495495
buf[2] = crc8_ccitt(0, buf, header_size);
496496
++header_size;
497497
#endif /* CONFIG_ETH_ADIN2111_SPI_CFG0 */
498498

499499
/* reg */
500-
*(uint32_t *)(buf + header_size) = htonl(val);
500+
*(uint32_t *)(buf + header_size) = net_htonl(val);
501501
#if CONFIG_ETH_ADIN2111_SPI_CFG0
502502
buf[header_size + data_size] = crc8_ccitt(0, &buf[header_size], data_size);
503503
++data_size;
@@ -576,7 +576,7 @@ static int adin2111_read_fifo(const struct device *dev, const uint16_t port_idx)
576576
fsize -= ADIN2111_FRAME_HEADER_SIZE;
577577

578578
/* spi header */
579-
*(uint16_t *)cmd_buf = htons((ADIN2111_READ_TXN_CTRL | rx_reg));
579+
*(uint16_t *)cmd_buf = net_htons((ADIN2111_READ_TXN_CTRL | rx_reg));
580580
#if CONFIG_ETH_ADIN2111_SPI_CFG0
581581
cmd_buf[2] = crc8_ccitt(0, cmd_buf, ADIN2111_SPI_HEADER_SIZE);
582582
/* TA */
@@ -608,7 +608,7 @@ static int adin2111_read_fifo(const struct device *dev, const uint16_t port_idx)
608608
/* remove CRC32 and pass to the stack */
609609
fsize_real = fsize - sizeof(uint32_t);
610610

611-
pkt = net_pkt_rx_alloc_with_buffer(iface, fsize_real, AF_UNSPEC, 0,
611+
pkt = net_pkt_rx_alloc_with_buffer(iface, fsize_real, NET_AF_UNSPEC, 0,
612612
K_MSEC(CONFIG_ETH_ADIN2111_TIMEOUT));
613613
if (!pkt) {
614614
eth_stats_update_errors_rx(iface);
@@ -838,7 +838,7 @@ static int adin2111_port_send(const struct device *dev, struct net_pkt *pkt)
838838
eth_adin2111_lock(adin, K_FOREVER);
839839
}
840840

841-
ret = eth_adin2111_send_oa_frame(cfg->adin, pkt, htons(cfg->port_idx));
841+
ret = eth_adin2111_send_oa_frame(cfg->adin, pkt, net_htons(cfg->port_idx));
842842

843843
goto end_check;
844844
}
@@ -887,14 +887,14 @@ static int adin2111_port_send(const struct device *dev, struct net_pkt *pkt)
887887
memset(ctx->buf, 0, burst_size + ADIN2111_WRITE_HEADER_SIZE);
888888

889889
/* spi header */
890-
*(uint16_t *)ctx->buf = htons(ADIN2111_TXN_CTRL_TX_REG);
890+
*(uint16_t *)ctx->buf = net_htons(ADIN2111_TXN_CTRL_TX_REG);
891891
#if CONFIG_ETH_ADIN2111_SPI_CFG0
892892
ctx->buf[2] = crc8_ccitt(0, ctx->buf, header_size);
893893
++header_size;
894894
#endif /* CONFIG_ETH_ADIN2111_SPI_CFG0 */
895895

896896
/* frame header */
897-
*(uint16_t *)(ctx->buf + header_size) = htons(cfg->port_idx);
897+
*(uint16_t *)(ctx->buf + header_size) = net_htons(cfg->port_idx);
898898

899899
/* read pkt into tx buffer */
900900
ret = net_pkt_read(pkt,

drivers/ethernet/eth_cyclonev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,8 @@ static void eth_cyclonev_receive(struct eth_cyclonev_priv *p)
680680
p->rx_current_desc_number = last_desc_index;
681681

682682
/* Allocate packet with buffer */
683-
pkt = net_pkt_rx_alloc_with_buffer(p->iface, frame_length, AF_UNSPEC, 0, K_NO_WAIT);
683+
pkt = net_pkt_rx_alloc_with_buffer(p->iface, frame_length,
684+
NET_AF_UNSPEC, 0, K_NO_WAIT);
684685
if (!pkt) {
685686
LOG_ERR("net_pkt_rx_alloc_with_buffer() failed");
686687
eth_stats_update_errors_rx(p->iface);

drivers/ethernet/eth_e1000.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static struct net_pkt *e1000_rx(struct e1000_dev *dev)
157157

158158
hexdump(buf, len, "%zd byte(s)", len);
159159

160-
pkt = net_pkt_rx_alloc_with_buffer(dev->iface, len, AF_UNSPEC, 0,
160+
pkt = net_pkt_rx_alloc_with_buffer(dev->iface, len, NET_AF_UNSPEC, 0,
161161
K_NO_WAIT);
162162
if (!pkt) {
163163
LOG_ERR("Out of buffers");

drivers/ethernet/eth_enc28j60.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ static void enc28j60_read_packet(const struct device *dev, uint16_t frm_len)
559559

560560
/* Get the frame from the buffer */
561561
pkt = net_pkt_rx_alloc_with_buffer(get_iface(context), frm_len,
562-
AF_UNSPEC, 0, K_MSEC(config->timeout));
562+
NET_AF_UNSPEC, 0, K_MSEC(config->timeout));
563563
if (!pkt) {
564564
LOG_ERR("%s: Could not allocate rx buffer", dev->name);
565565
eth_stats_update_errors_rx(get_iface(context));

drivers/ethernet/eth_enc424j600.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static int enc424j600_rx(const struct device *dev)
387387

388388
/* Get the frame from the buffer */
389389
pkt = net_pkt_rx_alloc_with_buffer(context->iface, frm_len,
390-
AF_UNSPEC, 0,
390+
NET_AF_UNSPEC, 0,
391391
K_MSEC(config->timeout));
392392
if (!pkt) {
393393
LOG_ERR("Could not allocate rx buffer");

drivers/ethernet/eth_esp32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static struct net_pkt *eth_esp32_rx(
111111
}
112112

113113
struct net_pkt *pkt = net_pkt_rx_alloc_with_buffer(
114-
dev_data->iface, receive_len, AF_UNSPEC, 0, K_MSEC(100));
114+
dev_data->iface, receive_len, NET_AF_UNSPEC, 0, K_MSEC(100));
115115
if (pkt == NULL) {
116116
eth_stats_update_errors_rx(dev_data->iface);
117117
LOG_ERR("Could not allocate rx buffer");

drivers/ethernet/eth_gecko.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static struct net_pkt *frame_get(const struct device *dev)
193193
if (eofIdx != UINT32_MAX) {
194194
/* Allocate room for full frame */
195195
rx_frame = net_pkt_rx_alloc_with_buffer(dev_data->iface,
196-
total_len, AF_UNSPEC, 0, K_NO_WAIT);
196+
total_len, NET_AF_UNSPEC, 0, K_NO_WAIT);
197197
if (!rx_frame) {
198198
LOG_ERR("Failed to obtain RX buffer");
199199
ETH_RX_DISABLE(eth);

drivers/ethernet/eth_ivshmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static struct net_pkt *eth_ivshmem_rx(const struct device *dev)
139139
}
140140

141141
struct net_pkt *pkt = net_pkt_rx_alloc_with_buffer(
142-
dev_data->iface, rx_len, AF_UNSPEC, 0, K_MSEC(100));
142+
dev_data->iface, rx_len, NET_AF_UNSPEC, 0, K_MSEC(100));
143143
if (pkt == NULL) {
144144
LOG_ERR("Failed to allocate rx buffer");
145145
eth_stats_update_errors_rx(dev_data->iface);

drivers/ethernet/eth_lan9250.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ static int lan9250_rx(const struct device *dev)
486486
}
487487

488488
/* Get the frame from the buffer */
489-
pkt = net_pkt_rx_alloc_with_buffer(ctx->iface, pkt_len, AF_UNSPEC, 0,
489+
pkt = net_pkt_rx_alloc_with_buffer(ctx->iface, pkt_len, NET_AF_UNSPEC, 0,
490490
K_MSEC(config->timeout));
491491
if (!pkt) {
492492
LOG_ERR("%s: Could not allocate rx buffer", dev->name);

drivers/ethernet/eth_litex_liteeth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static void eth_rx(const struct device *port)
136136
rxslot = litex_read8(config->rx_slot_addr);
137137

138138
/* obtain rx buffer */
139-
pkt = net_pkt_rx_alloc_with_buffer(context->iface, len, AF_UNSPEC, 0,
139+
pkt = net_pkt_rx_alloc_with_buffer(context->iface, len, NET_AF_UNSPEC, 0,
140140
K_NO_WAIT);
141141
if (pkt == NULL) {
142142
LOG_ERR("Failed to obtain RX buffer of length %u", len);

0 commit comments

Comments
 (0)