Skip to content

Commit 6ffdcf2

Browse files
committed
Merge branch 'for-next/net' into next
2 parents caa30d7 + c9a2b7c commit 6ffdcf2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+267
-256
lines changed

commands/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,5 @@ obj-$(CONFIG_CMD_TUTORIAL) += tutorial.o
151151
obj-$(CONFIG_CMD_STACKSMASH) += stacksmash.o
152152
obj-$(CONFIG_CMD_PARTED) += parted.o
153153
obj-$(CONFIG_CMD_EFI_HANDLE_DUMP) += efi_handle_dump.o
154-
154+
obj-$(CONFIG_CMD_HOST) += host.o
155155
UBSAN_SANITIZE_ubsan.o := y

commands/host.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
3+
#include <common.h>
4+
#include <command.h>
5+
#include <net.h>
6+
7+
static int do_host(int argc, char *argv[])
8+
{
9+
IPaddr_t ip;
10+
int ret;
11+
char *hostname, *varname = NULL;
12+
13+
if (argc < 2)
14+
return COMMAND_ERROR_USAGE;
15+
16+
hostname = argv[1];
17+
18+
if (argc > 2)
19+
varname = argv[2];
20+
21+
ret = resolv(argv[1], &ip);
22+
if (ret) {
23+
printf("unknown host %s\n", hostname);
24+
return 1;
25+
}
26+
27+
if (varname)
28+
setenv_ip(varname, ip);
29+
else
30+
printf("%s is at %pI4\n", hostname, &ip);
31+
32+
return 0;
33+
}
34+
35+
BAREBOX_CMD_START(host)
36+
.cmd = do_host,
37+
BAREBOX_CMD_DESC("resolve a hostname")
38+
BAREBOX_CMD_OPTS("<HOSTNAME> [VARIABLE]")
39+
BAREBOX_CMD_GROUP(CMD_GRP_NET)
40+
BAREBOX_CMD_END

drivers/net/ag71xx.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static void ag71xx_ether_halt(struct eth_device *edev)
384384
}
385385
}
386386

387-
static int ag71xx_ether_rx(struct eth_device *edev)
387+
static void ag71xx_ether_rx(struct eth_device *edev)
388388
{
389389
struct ag71xx *priv = edev->priv;
390390
ag7240_desc_t *f;
@@ -418,8 +418,6 @@ static int ag71xx_ether_rx(struct eth_device *edev)
418418
ag71xx_wr(priv, AG71XX_REG_RX_DESC, virt_to_phys(f));
419419
ag71xx_wr(priv, AG71XX_REG_RX_CTRL, RX_CTRL_RXE);
420420
}
421-
422-
return work_done;
423421
}
424422

425423
static int ag71xx_ether_send(struct eth_device *edev, void *packet, int length)

drivers/net/ar231x.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int ar231x_eth_open(struct eth_device *edev)
193193
ar231x_adjust_link, 0, PHY_INTERFACE_MODE_MII);
194194
}
195195

196-
static int ar231x_eth_recv(struct eth_device *edev)
196+
static void ar231x_eth_recv(struct eth_device *edev)
197197
{
198198
struct ar231x_eth_priv *priv = edev->priv;
199199

@@ -221,7 +221,6 @@ static int ar231x_eth_recv(struct eth_device *edev)
221221
ar231x_flash_rxdsc(rxdsc);
222222
}
223223
priv->kill_rx_ring = 0;
224-
return 0;
225224
}
226225

227226
static int ar231x_eth_send(struct eth_device *edev, void *packet,

drivers/net/arc_emac.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static int arc_emac_send(struct eth_device *edev, void *data, int length)
264264
return 0;
265265
}
266266

267-
static int arc_emac_recv(struct eth_device *edev)
267+
static void arc_emac_recv(struct eth_device *edev)
268268
{
269269
struct arc_emac_priv *priv = edev->priv;
270270
unsigned int work_done;
@@ -307,8 +307,6 @@ static int arc_emac_recv(struct eth_device *edev)
307307

308308
rxbd->info = cpu_to_le32(FOR_EMAC | PKTSIZE);
309309
}
310-
311-
return work_done;
312310
}
313311

314312
static void arc_emac_halt(struct eth_device *edev)

drivers/net/at91_ether.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ static int at91_ether_send(struct eth_device *edev, void *packet, int length)
205205
return 0;
206206
}
207207

208-
static int at91_ether_rx(struct eth_device *edev)
208+
static void at91_ether_rx(struct eth_device *edev)
209209
{
210210
struct ether_device *etdev = to_ether(edev);
211211
int size;
212212
struct rbf_t *rbfp = etdev->rbfp;
213213

214214
if (!(rbfp->addr & RBF_OWNER))
215-
return 0;
215+
return;
216216

217217
size = rbfp->size & RBF_SIZE;
218218

@@ -230,8 +230,6 @@ static int at91_ether_rx(struct eth_device *edev)
230230

231231
at91_emac_write(AT91_EMAC_RSR,
232232
at91_emac_read(AT91_EMAC_RSR) | AT91_EMAC_RSR_REC);
233-
234-
return size;
235233
}
236234

237235
static void at91_ether_halt (struct eth_device *edev)

drivers/net/bcmgenet.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static int bcmgenet_gmac_eth_send(struct eth_device *edev, void *packet, int len
309309
return 0;
310310
}
311311

312-
static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
312+
static void bcmgenet_gmac_eth_recv(struct eth_device *edev)
313313
{
314314
struct bcmgenet_eth_priv *priv = edev->priv;
315315
void *desc_base = priv->mac_reg + GENET_RX_OFF + priv->rx_index * DMA_DESC_SIZE;
@@ -318,7 +318,7 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
318318
dma_addr_t addr;
319319

320320
if (prod_index == priv->c_index)
321-
return -EAGAIN;
321+
return;
322322

323323
length = readl(desc_base + DMA_DESC_LENGTH_STATUS);
324324
length = (length >> DMA_BUFLENGTH_SHIFT) & DMA_BUFLENGTH_MASK;
@@ -343,8 +343,6 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
343343
/* Forward our descriptor pointer, wrapping around if needed. */
344344
if (++priv->rx_index >= RX_DESCS)
345345
priv->rx_index = 0;
346-
347-
return 0;
348346
}
349347

350348
static void rx_descs_init(struct bcmgenet_eth_priv *priv)

drivers/net/cpsw.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ static int cpsw_send(struct eth_device *edev, void *packet, int length)
10481048
return ret;
10491049
}
10501050

1051-
static int cpsw_recv(struct eth_device *edev)
1051+
static void cpsw_recv(struct eth_device *edev)
10521052
{
10531053
struct cpsw_slave *slave = edev->priv;
10541054
struct cpsw_priv *priv = slave->cpsw;
@@ -1062,8 +1062,6 @@ static int cpsw_recv(struct eth_device *edev)
10621062
dma_sync_single_for_device(priv->dev, dma, len, DMA_FROM_DEVICE);
10631063
cpdma_submit(priv, &priv->rx_chan, buffer, dma, PKTSIZE, 0);
10641064
}
1065-
1066-
return 0;
10671065
}
10681066

10691067
static void cpsw_slave_init_data(struct cpsw_slave *slave, int slave_num,

drivers/net/cs8900.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ static int cs8900_send(struct eth_device *dev, void *eth_data,
278278
return 0;
279279
}
280280

281-
static int cs8900_recv(struct eth_device *dev)
281+
static void cs8900_recv(struct eth_device *dev)
282282
{
283283
struct cs8900_priv *priv = (struct cs8900_priv *)dev->priv;
284284
int len = 0;
@@ -289,21 +289,20 @@ static int cs8900_recv(struct eth_device *dev)
289289
status = cs8900_ior(priv, PP_REG_RXEVENT);
290290
if ((status & RXEVENT_RXOK) == 0) {
291291
/* No packet received. */
292-
return 0;
292+
return;
293293
}
294294

295295
status = readw(priv->regs + CS8900_RTDATA0);
296296
len = readw(priv->regs + CS8900_RTDATA0);
297297

298-
for (addr = (u16 *)priv->rx_buf, i = len >> 1; i > 0; i--) {
299-
*addr++ = readw(priv->regs + CS8900_RTDATA0);
298+
if (len <= PKTSIZE) {
299+
for (addr = (u16 *)priv->rx_buf, i = (len + 1) >> 1; i > 0; i--)
300+
*addr++ = readw(priv->regs + CS8900_RTDATA0);
301+
net_receive(dev, priv->rx_buf, len);
302+
} else {
303+
for (addr = (u16 *)priv->rx_buf, i = (len + 1) >> 1; i > 0; i--)
304+
(void)readw(priv->regs + CS8900_RTDATA0);
300305
}
301-
if (len & 1) {
302-
*addr++ = readw(priv->regs + CS8900_RTDATA0);
303-
}
304-
net_receive(dev, priv->rx_buf, len);
305-
306-
return len;
307306
}
308307

309308
static void cs8900_halt(struct eth_device *dev)

drivers/net/davinci_emac.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,21 +457,19 @@ static int davinci_emac_send(struct eth_device *edev, void *packet, int length)
457457
/*
458458
* This function handles receipt of a packet from the network
459459
*/
460-
static int davinci_emac_recv(struct eth_device *edev)
460+
static void davinci_emac_recv(struct eth_device *edev)
461461
{
462462
struct davinci_emac_priv *priv = edev->priv;
463463
void __iomem *rx_curr_desc, *curr_desc, *tail_desc;
464464
unsigned char *pkt;
465-
int status, len, ret = -1;
465+
int status, len;
466466

467467
dev_dbg(priv->dev, "+ emac_recv\n");
468468

469469
rx_curr_desc = priv->emac_rx_active_head;
470470
status = readl(rx_curr_desc + EMAC_DESC_PKT_FLAG_LEN);
471-
if (status & EMAC_CPPI_OWNERSHIP_BIT) {
472-
ret = 0;
471+
if (status & EMAC_CPPI_OWNERSHIP_BIT)
473472
goto out;
474-
}
475473

476474
if (status & EMAC_CPPI_RX_ERROR_FRAME) {
477475
/* Error in packet - discard it and requeue desc */
@@ -483,7 +481,6 @@ static int davinci_emac_recv(struct eth_device *edev)
483481
dma_sync_single_for_cpu(priv->dev, (unsigned long)pkt, len, DMA_FROM_DEVICE);
484482
net_receive(edev, pkt, len);
485483
dma_sync_single_for_device(priv->dev, (unsigned long)pkt, len, DMA_FROM_DEVICE);
486-
ret = len;
487484
}
488485

489486
/* Ack received packet descriptor */
@@ -529,8 +526,6 @@ static int davinci_emac_recv(struct eth_device *edev)
529526

530527
out:
531528
dev_dbg(priv->dev, "- emac_recv\n");
532-
533-
return ret;
534529
}
535530

536531
static int davinci_emac_probe(struct device *dev)

0 commit comments

Comments
 (0)