"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'net-20260209' of https://source.denx.de/u-boot/custodians/u-boot-net

Pull request net-20260209.

net:
- airoha: mdio support for the switch
- phy: mscc: allow RGMII with internal delay for the VSC8541
- dwc_eth_qos: Update tail pointer handling

net-legacy:
- Stop conflating return value with file size in net_loop()

net-lwip:
- wget: rework the '#' printing
- tftp: add support of tsize option to client

Tom Rini d395ea73 42b3ee7f

+185 -62
+5
arch/arm/dts/an7581-u-boot.dtsi
··· 57 57 switch: switch@1fb58000 { 58 58 compatible = "airoha,en7581-switch"; 59 59 reg = <0 0x1fb58000 0 0x8000>; 60 + 61 + mdio: mdio { 62 + #address-cells = <1>; 63 + #size-cells = <0>; 64 + }; 60 65 }; 61 66 62 67 snfi: spi@1fa10000 {
+5
arch/arm/dts/en7523-u-boot.dtsi
··· 42 42 switch: switch@1fb58000 { 43 43 compatible = "airoha,en7523-switch"; 44 44 reg = <0x1fb58000 0x8000>; 45 + 46 + mdio: mdio { 47 + #address-cells = <1>; 48 + #size-cells = <0>; 49 + }; 45 50 }; 46 51 47 52 snfi: spi@1fa10000 {
+1 -1
cmd/mvebu/bubt.c
··· 661 661 */ 662 662 image_load_addr = get_load_addr(); 663 663 ret = net_loop(TFTPGET); 664 - return ret > 0 ? ret : 0; 664 + return ret > 0 ? net_boot_file_size : 0; 665 665 } 666 666 667 667 static int is_tftp_active(void)
+5 -4
cmd/net.c
··· 354 354 char *const argv[]) 355 355 { 356 356 char *s; 357 - int rcode = 0; 358 - int size; 357 + int rcode; 358 + u32 size; 359 359 360 360 net_boot_file_name_explicit = false; 361 361 *net_boot_file_name = '\0'; ··· 396 396 } 397 397 } 398 398 399 - size = net_loop(proto); 400 - if (size < 0) { 399 + rcode = net_loop(proto); 400 + size = net_boot_file_size; 401 + if (rcode < 0) { 401 402 bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK); 402 403 return CMD_RET_FAILURE; 403 404 }
+5 -5
common/update.c
··· 32 32 #endif 33 33 static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr) 34 34 { 35 - int size, rv; 35 + int rv; 36 36 ulong saved_timeout_msecs; 37 37 int saved_timeout_count; 38 38 char *saved_netretry, *saved_bootfile; ··· 54 54 /* download the update file */ 55 55 image_load_addr = addr; 56 56 copy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name)); 57 - size = net_loop(TFTPGET); 57 + rv = net_loop(TFTPGET); 58 58 59 - if (size < 0) 59 + if (rv < 0) 60 60 rv = 1; 61 - else if (size > 0) 62 - flush_cache(addr, size); 61 + else 62 + flush_cache(addr, net_boot_file_size); 63 63 64 64 /* restore changed globals and env variable */ 65 65 tftp_timeout_ms = saved_timeout_msecs;
+3
configs/an7581_evb_defconfig
··· 66 66 CONFIG_SPI_FLASH_WINBOND=y 67 67 CONFIG_SPI_FLASH_MTD=y 68 68 CONFIG_AIROHA_ETH=y 69 + CONFIG_DM_MDIO=y 70 + CONFIG_CMD_MII=y 71 + CONFIG_CMD_MDIO=y 69 72 CONFIG_PHY=y 70 73 CONFIG_PINCTRL=y 71 74 CONFIG_PINCONF=y
+3
configs/en7523_evb_defconfig
··· 51 51 CONFIG_DM_MTD=y 52 52 CONFIG_MTD_SPI_NAND=y 53 53 CONFIG_AIROHA_ETH=y 54 + CONFIG_DM_MDIO=y 55 + CONFIG_CMD_MII=y 56 + CONFIG_CMD_MDIO=y 54 57 CONFIG_PHY=y 55 58 CONFIG_PINCTRL=y 56 59 CONFIG_PINCONF=y
+1 -1
drivers/net/Kconfig
··· 127 127 select PHYLIB 128 128 select DEVRES 129 129 select DM_RESET 130 - select MDIO_MT7531 130 + select MDIO_MT7531_MMIO 131 131 help 132 132 This Driver support Airoha Ethernet QDMA Driver 133 133 Say Y to enable support for the Airoha Ethernet QDMA.
+4 -3
drivers/net/airoha_eth.c
··· 985 985 986 986 static int airoha_eth_bind(struct udevice *dev) 987 987 { 988 + struct airoha_eth_soc_data *data = (void *)dev_get_driver_data(dev); 988 989 ofnode switch_node, mdio_node; 989 990 struct udevice *mdio_dev; 990 991 int ret = 0; 991 992 992 - if (!CONFIG_IS_ENABLED(MDIO_MT7531)) 993 + if (!CONFIG_IS_ENABLED(MDIO_MT7531_MMIO)) 993 994 return 0; 994 995 995 996 switch_node = ofnode_by_compatible(ofnode_null(), 996 - "airoha,en7581-switch"); 997 + data->switch_compatible); 997 998 if (!ofnode_valid(switch_node)) { 998 999 debug("Warning: missing switch node\n"); 999 1000 return 0; ··· 1005 1006 return 0; 1006 1007 } 1007 1008 1008 - ret = device_bind_driver_to_node(dev, "mt7531-mdio", "mdio", 1009 + ret = device_bind_driver_to_node(dev, "mt7531-mdio-mmio", "mdio", 1009 1010 mdio_node, &mdio_dev); 1010 1011 if (ret) 1011 1012 debug("Warning: failed to bind mdio controller\n");
+24 -19
drivers/net/dwc_eth_qos.c
··· 683 683 int ret, i; 684 684 ulong rate; 685 685 u32 val, tx_fifo_sz, rx_fifo_sz, tqs, rqs, pbl; 686 - ulong last_rx_desc; 687 686 ulong desc_pad; 688 687 ulong addr64; 689 688 ··· 891 890 EQOS_MAC_RXQ_CTRL0_RXQ0EN_SHIFT); 892 891 893 892 /* Multicast and Broadcast Queue Enable */ 894 - setbits_le32(&eqos->mac_regs->unused_0a4, 895 - 0x00100000); 896 - /* enable promise mode */ 897 - setbits_le32(&eqos->mac_regs->unused_004[1], 898 - 0x1); 893 + setbits_le32(&eqos->mac_regs->rxq_ctrl1, 894 + EQOS_MAC_RXQ_CTRL1_MCBCQEN); 895 + /* Promiscuous Mode Enable */ 896 + setbits_le32(&eqos->mac_regs->packet_filter, 897 + EQOS_MAC_PACKET_FILTER_PR); 899 898 900 899 /* Set TX flow control parameters */ 901 900 /* Set Pause Time */ ··· 1004 1003 writel(EQOS_DESCRIPTORS_RX - 1, 1005 1004 &eqos->dma_regs->ch0_rxdesc_ring_length); 1006 1005 1006 + /* 1007 + * Point TX tail pointer at the first descriptor, implying no descriptor 1008 + * are owned by the DMA. We advance the tail pointer when we need to TX 1009 + * a packet in eqos_send(). 1010 + */ 1011 + addr64 = (ulong)eqos_get_desc(eqos, 0, false); 1012 + writel(lower_32_bits(addr64), &eqos->dma_regs->ch0_txdesc_tail_pointer); 1013 + 1014 + /* 1015 + * Point RX tail pointer at the last descriptor, implying all 1016 + * descriptors are owned by the DMA. 1017 + */ 1018 + addr64 = (ulong)eqos_get_desc(eqos, EQOS_DESCRIPTORS_RX - 1, true); 1019 + writel(lower_32_bits(addr64), &eqos->dma_regs->ch0_rxdesc_tail_pointer); 1020 + 1007 1021 /* Enable everything */ 1008 1022 setbits_le32(&eqos->dma_regs->ch0_tx_control, 1009 1023 EQOS_DMA_CH0_TX_CONTROL_ST); ··· 1012 1026 setbits_le32(&eqos->mac_regs->configuration, 1013 1027 EQOS_MAC_CONFIGURATION_TE | EQOS_MAC_CONFIGURATION_RE); 1014 1028 1015 - /* TX tail pointer not written until we need to TX a packet */ 1016 - /* 1017 - * Point RX tail pointer at last descriptor. Ideally, we'd point at the 1018 - * first descriptor, implying all descriptors were available. However, 1019 - * that's not distinguishable from none of the descriptors being 1020 - * available. 1021 - */ 1022 - last_rx_desc = (ulong)eqos_get_desc(eqos, EQOS_DESCRIPTORS_RX - 1, true); 1023 - writel(last_rx_desc, &eqos->dma_regs->ch0_rxdesc_tail_pointer); 1024 - 1025 1029 eqos->started = true; 1026 1030 1027 1031 debug("%s: OK\n", __func__); ··· 1116 1120 tx_desc->des3 = EQOS_DESC3_OWN | EQOS_DESC3_FD | EQOS_DESC3_LD | length; 1117 1121 eqos->config->ops->eqos_flush_desc(tx_desc); 1118 1122 1119 - writel((ulong)eqos_get_desc(eqos, eqos->tx_desc_idx, false), 1120 - &eqos->dma_regs->ch0_txdesc_tail_pointer); 1123 + writel(lower_32_bits((ulong)eqos_get_desc(eqos, eqos->tx_desc_idx, false)), 1124 + &eqos->dma_regs->ch0_txdesc_tail_pointer); 1121 1125 1122 1126 for (i = 0; i < 1000000; i++) { 1123 1127 eqos->config->ops->eqos_inval_desc(tx_desc); ··· 1198 1202 rx_desc->des3 = EQOS_DESC3_OWN | EQOS_DESC3_BUF1V; 1199 1203 eqos->config->ops->eqos_flush_desc(rx_desc); 1200 1204 } 1201 - writel((ulong)rx_desc, &eqos->dma_regs->ch0_rxdesc_tail_pointer); 1205 + writel(lower_32_bits((ulong)rx_desc), 1206 + &eqos->dma_regs->ch0_rxdesc_tail_pointer); 1202 1207 } 1203 1208 1204 1209 eqos->rx_desc_idx++;
+20 -8
drivers/net/dwc_eth_qos.h
··· 14 14 #define EQOS_MAC_REGS_BASE 0x000 15 15 struct eqos_mac_regs { 16 16 u32 configuration; /* 0x000 */ 17 - u32 unused_004[(0x070 - 0x004) / 4]; /* 0x004 */ 17 + u32 ext_configuration; /* 0x004 */ 18 + u32 packet_filter; /* 0x008 */ 19 + u32 watchdog_timeout; /* 0x00c */ 20 + u32 unused_010[(0x070 - 0x010) / 4]; /* 0x010 */ 18 21 u32 q0_tx_flow_ctrl; /* 0x070 */ 19 - u32 unused_070[(0x090 - 0x074) / 4]; /* 0x074 */ 22 + u32 unused_074[(0x090 - 0x074) / 4]; /* 0x074 */ 20 23 u32 rx_flow_ctrl; /* 0x090 */ 21 - u32 unused_094; /* 0x094 */ 24 + u32 rxq_ctrl4; /* 0x094 */ 22 25 u32 txq_prty_map0; /* 0x098 */ 23 - u32 unused_09c; /* 0x09c */ 26 + u32 txq_prty_map1; /* 0x09c */ 24 27 u32 rxq_ctrl0; /* 0x0a0 */ 25 - u32 unused_0a4; /* 0x0a4 */ 28 + u32 rxq_ctrl1; /* 0x0a4 */ 26 29 u32 rxq_ctrl2; /* 0x0a8 */ 27 - u32 unused_0ac[(0x0dc - 0x0ac) / 4]; /* 0x0ac */ 30 + u32 rxq_ctrl3; /* 0x0ac */ 31 + u32 unused_0b0[(0x0dc - 0x0b0) / 4]; /* 0x0b0 */ 28 32 u32 us_tic_counter; /* 0x0dc */ 29 - u32 unused_0e0[(0x11c - 0x0e0) / 4]; /* 0x0e0 */ 33 + u32 unused_0e0[(0x110 - 0x0e0) / 4]; /* 0x0e0 */ 34 + u32 version; /* 0x110 */ 35 + u32 debug; /* 0x114 */ 36 + u32 unused_118; /* 0x118 */ 30 37 u32 hw_feature0; /* 0x11c */ 31 38 u32 hw_feature1; /* 0x120 */ 32 39 u32 hw_feature2; /* 0x124 */ 33 - u32 unused_128[(0x200 - 0x128) / 4]; /* 0x128 */ 40 + u32 hw_feature3; /* 0x128 */ 41 + u32 unused_12c[(0x200 - 0x12c) / 4]; /* 0x12c */ 34 42 u32 mdio_address; /* 0x200 */ 35 43 u32 mdio_data; /* 0x204 */ 36 44 u32 unused_208[(0x300 - 0x208) / 4]; /* 0x208 */ ··· 51 59 #define EQOS_MAC_CONFIGURATION_TE BIT(1) 52 60 #define EQOS_MAC_CONFIGURATION_RE BIT(0) 53 61 62 + #define EQOS_MAC_PACKET_FILTER_PR BIT(0) 63 + 54 64 #define EQOS_MAC_Q0_TX_FLOW_CTRL_PT_SHIFT 16 55 65 #define EQOS_MAC_Q0_TX_FLOW_CTRL_PT_MASK 0xffff 56 66 #define EQOS_MAC_Q0_TX_FLOW_CTRL_TFE BIT(1) ··· 65 75 #define EQOS_MAC_RXQ_CTRL0_RXQ0EN_NOT_ENABLED 0 66 76 #define EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB 2 67 77 #define EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV 1 78 + 79 + #define EQOS_MAC_RXQ_CTRL1_MCBCQEN BIT(20) 68 80 69 81 #define EQOS_MAC_RXQ_CTRL2_PSRQ0_SHIFT 0 70 82 #define EQOS_MAC_RXQ_CTRL2_PSRQ0_MASK 0xff
+6 -1
drivers/net/mdio-mt7531-mmio.c
··· 151 151 static int mt7531_mdio_probe(struct udevice *dev) 152 152 { 153 153 struct mt7531_mdio_priv *priv = dev_get_priv(dev); 154 + ofnode switch_node; 154 155 155 - priv->switch_regs = dev_read_addr(dev); 156 + switch_node = ofnode_get_parent(dev_ofnode(dev)); 157 + if (!ofnode_valid(switch_node)) 158 + return -EINVAL; 159 + 160 + priv->switch_regs = ofnode_get_addr(switch_node); 156 161 if (priv->switch_regs == FDT_ADDR_T_NONE) 157 162 return -EINVAL; 158 163
+3
drivers/net/phy/mscc.c
··· 1371 1371 case PHY_INTERFACE_MODE_GMII: 1372 1372 case PHY_INTERFACE_MODE_RMII: 1373 1373 case PHY_INTERFACE_MODE_RGMII: 1374 + case PHY_INTERFACE_MODE_RGMII_TXID: 1375 + case PHY_INTERFACE_MODE_RGMII_RXID: 1376 + case PHY_INTERFACE_MODE_RGMII_ID: 1374 1377 retval = vsc8531_vsc8541_mac_config(phydev); 1375 1378 if (retval != 0) 1376 1379 return retval;
+42 -9
lib/lwip/lwip/src/apps/tftp/tftp.c
··· 98 98 int last_pkt; 99 99 u16_t blknum; 100 100 u16_t blksize; 101 + u32_t tsize; 101 102 u8_t retries; 102 103 u8_t mode_write; 103 104 u8_t tftp_mode; ··· 167 168 { 168 169 size_t fname_length = strlen(fname)+1; 169 170 size_t mode_length = strlen(mode)+1; 171 + size_t tsize_length = strlen("tsize")+3; /* "tsize\0\0\0" */ 170 172 size_t blksize_length = 0; 171 173 int blksize = tftp_state.blksize; 172 174 struct pbuf* p; ··· 182 184 } 183 185 } 184 186 185 - p = init_packet(opcode, 0, fname_length + mode_length + blksize_length - 2); 187 + p = init_packet(opcode, 0, fname_length + mode_length + blksize_length + tsize_length - 2); 186 188 if (p == NULL) { 187 189 return ERR_MEM; 188 190 } ··· 190 192 payload = (char*) p->payload; 191 193 MEMCPY(payload+2, fname, fname_length); 192 194 MEMCPY(payload+2+fname_length, mode, mode_length); 195 + sprintf(payload+2+fname_length+mode_length, "tsize%c%u%c", 0, 0, 0); 193 196 if (tftp_state.blksize) 194 - sprintf(payload+2+fname_length+mode_length, "blksize%c%d", 0, tftp_state.blksize); 197 + sprintf(payload+2+fname_length+mode_length+tsize_length, "blksize%c%d", 0, tftp_state.blksize); 195 198 196 199 tftp_state.wait_oack = true; 197 200 ret = udp_sendto(tftp_state.upcb, p, addr, port); ··· 450 453 } 451 454 452 455 blknum = lwip_ntohs(sbuf[1]); 453 - if (tftp_state.blksize && tftp_state.wait_oack) { 456 + if (tftp_state.wait_oack) { 454 457 /* 455 - * Data received while we are expecting an OACK for our blksize option. 458 + * Data received while we are expecting an OACK for our tsize option. 456 459 * This means the server doesn't support it, let's switch back to the 457 460 * default block size. 458 461 */ 459 - tftp_state.blksize = 0; 460 - tftp_state.wait_oack = false; 462 + tftp_state.tsize = 0; 463 + tftp_state.wait_oack = false; 464 + 465 + if (tftp_state.blksize) { 466 + /* 467 + * Data received while we are expecting an OACK for our blksize option. 468 + * This means the server doesn't support it, let's switch back to the 469 + * default block size. 470 + */ 471 + tftp_state.blksize = 0; 472 + tftp_state.wait_oack = false; 473 + } 461 474 } 462 475 if (blknum == tftp_state.blknum) { 463 476 pbuf_remove_header(p, TFTP_HEADER_LENGTH); ··· 527 540 } 528 541 break; 529 542 case PP_HTONS(TFTP_OACK): { 530 - const char *optval = find_option(p, "blksize"); 543 + const char *blksizeoptval = find_option(p, "blksize"); 544 + const char *tsizeoptval = find_option(p, "tsize"); 531 545 u16_t srv_blksize = 0; 546 + u32_t srv_tsize = 0; 532 547 tftp_state.wait_oack = false; 533 - if (optval) { 548 + if (blksizeoptval) { 534 549 if (!tftp_state.blksize) { 535 550 /* We did not request this option */ 536 551 send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "blksize unexpected"); 537 552 } 538 - srv_blksize = atoi(optval); 553 + srv_blksize = atoi(blksizeoptval); 539 554 if (srv_blksize <= 0 || srv_blksize > tftp_state.blksize) { 540 555 send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "Invalid blksize"); 541 556 } 542 557 LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, ("tftp: accepting blksize=%d\n", srv_blksize)); 543 558 tftp_state.blksize = srv_blksize; 559 + } 560 + if (tsizeoptval) { 561 + srv_tsize = atoi(tsizeoptval); 562 + if (srv_tsize <= 0) { 563 + srv_tsize = 0; /* tsize is optional */ 564 + } 565 + LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, ("tftp: accepting tsize=%d\n", srv_tsize)); 566 + tftp_state.tsize = srv_tsize; 544 567 } 545 568 send_ack(addr, port, 0); 546 569 break; ··· 653 676 tftp_init_client(const struct tftp_context *ctx) 654 677 { 655 678 return tftp_init_common(LWIP_TFTP_MODE_CLIENT, ctx); 679 + } 680 + 681 + /** @ingroup tftp 682 + * Get the transfer size used by the TFTP client. The server may 683 + * report zero in case this is unsupported. 684 + */ 685 + u32_t 686 + tftp_client_get_tsize(void) 687 + { 688 + return tftp_state.tsize; 656 689 } 657 690 658 691 /** @ingroup tftp
+1
lib/lwip/lwip/src/include/lwip/apps/tftp_client.h
··· 45 45 46 46 err_t tftp_init_client(const struct tftp_context* ctx); 47 47 void tftp_client_set_blksize(u16_t blksize); 48 + u32_t tftp_client_get_tsize(void); 48 49 err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); 49 50 err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); 50 51
+31 -4
net/lwip/tftp.c
··· 31 31 ulong daddr; 32 32 ulong size; 33 33 ulong block_count; 34 + ulong hash_count; 34 35 ulong start_time; 35 36 enum done_state done; 36 37 }; ··· 49 50 static int store_block(struct tftp_ctx *ctx, void *src, u16_t len) 50 51 { 51 52 ulong store_addr = ctx->daddr; 53 + ulong tftp_tsize; 54 + ulong pos; 52 55 void *ptr; 53 56 54 57 if (CONFIG_IS_ENABLED(LMB)) { ··· 67 70 ctx->daddr += len; 68 71 ctx->size += len; 69 72 ctx->block_count++; 70 - if (ctx->block_count % 10 == 0) { 71 - putc('#'); 72 - if (ctx->block_count % (65 * 10) == 0) 73 - puts("\n\t "); 73 + 74 + tftp_tsize = tftp_client_get_tsize(); 75 + if (tftp_tsize) { 76 + pos = clamp(ctx->size, 0UL, tftp_tsize); 77 + 78 + while (ctx->hash_count < pos * 50 / tftp_tsize) { 79 + putc('#'); 80 + ctx->hash_count++; 81 + } 82 + } else { 83 + if (ctx->block_count % 10 == 0) { 84 + putc('#'); 85 + if (ctx->block_count % (65 * 10) == 0) 86 + puts("\n\t "); 87 + } 74 88 } 75 89 76 90 return 0; ··· 84 98 static void tftp_close(void *handle) 85 99 { 86 100 struct tftp_ctx *ctx = handle; 101 + ulong tftp_tsize; 87 102 ulong elapsed; 88 103 89 104 if (ctx->done == FAILURE || ctx->done == ABORTED) { ··· 91 106 return; 92 107 } 93 108 ctx->done = SUCCESS; 109 + 110 + tftp_tsize = tftp_client_get_tsize(); 111 + if (tftp_tsize) { 112 + /* Print hash marks for the last packet received */ 113 + while (ctx->hash_count < 49) { 114 + putc('#'); 115 + ctx->hash_count++; 116 + } 117 + puts(" "); 118 + print_size(tftp_tsize, ""); 119 + } 94 120 95 121 elapsed = get_timer(ctx->start_time); 96 122 if (elapsed > 0) { ··· 176 202 ctx.done = NOT_DONE; 177 203 ctx.size = 0; 178 204 ctx.block_count = 0; 205 + ctx.hash_count = 0; 179 206 ctx.daddr = addr; 180 207 181 208 printf("Using %s device\n", udev->name);
+23 -4
net/lwip/wget.c
··· 37 37 ulong size; 38 38 ulong prevsize; 39 39 ulong start_time; 40 + ulong content_len; 41 + ulong hash_count; 40 42 enum done_state done; 41 43 }; 42 44 ··· 152 154 { 153 155 ulong store_addr = ctx->daddr; 154 156 uchar *ptr; 157 + ulong pos; 155 158 156 159 /* Avoid overflow */ 157 160 if (wget_info->buffer_size && wget_info->buffer_size < ctx->size + len) ··· 174 177 175 178 ctx->daddr += len; 176 179 ctx->size += len; 177 - if (ctx->size - ctx->prevsize > PROGRESS_PRINT_STEP_BYTES) { 178 - if (!wget_info->silent) 179 - printf("#"); 180 - ctx->prevsize = ctx->size; 180 + 181 + pos = clamp(ctx->size, 0UL, ctx->content_len); 182 + 183 + while (ctx->hash_count < pos * 50 / ctx->content_len) { 184 + putc('#'); 185 + ctx->hash_count++; 181 186 } 182 187 183 188 return 0; ··· 234 239 return; 235 240 } 236 241 242 + /* Print hash marks for the last packet received */ 243 + while (ctx->hash_count < 49) { 244 + putc('#'); 245 + ctx->hash_count++; 246 + } 247 + puts(" "); 248 + print_size(ctx->content_len, ""); 249 + 237 250 elapsed = get_timer(ctx->start_time); 238 251 if (!elapsed) 239 252 elapsed = 1; ··· 263 276 static err_t httpc_headers_done_cb(httpc_state_t *connection, void *arg, struct pbuf *hdr, 264 277 u16_t hdr_len, u32_t content_len) 265 278 { 279 + struct wget_ctx *ctx = arg; 280 + 266 281 wget_lwip_fill_info(hdr, hdr_len, content_len); 267 282 268 283 if (wget_info->check_buffer_size && (ulong)content_len > wget_info->buffer_size) 269 284 return ERR_BUF; 285 + 286 + ctx->content_len = content_len; 270 287 271 288 return ERR_OK; 272 289 } ··· 294 311 ctx.size = 0; 295 312 ctx.prevsize = 0; 296 313 ctx.start_time = 0; 314 + ctx.content_len = 0; 315 + ctx.hash_count = 0; 297 316 298 317 if (parse_url(uri, ctx.server_name, &ctx.port, &path, &is_https)) 299 318 return CMD_RET_USAGE;
+1 -1
net/net.c
··· 692 692 693 693 eth_set_last_protocol(protocol); 694 694 695 - ret = net_boot_file_size; 695 + ret = !!net_boot_file_size; 696 696 debug_cond(DEBUG_INT_STATE, "--- net_loop Success!\n"); 697 697 goto done; 698 698
+2 -2
net/tftp.c
··· 94 94 static ulong tftp_load_addr; 95 95 #ifdef CONFIG_TFTP_TSIZE 96 96 /* The file size reported by the server */ 97 - static int tftp_tsize; 97 + static unsigned int tftp_tsize; 98 98 /* The number of hashes we printed */ 99 99 static short tftp_tsize_num_hash; 100 100 #endif ··· 573 573 if (strcasecmp((char *)pkt + i, "tsize") == 0) { 574 574 tftp_tsize = dectoul((char *)pkt + i + 6, 575 575 NULL); 576 - debug("size = %s, %d\n", 576 + debug("size = %s, %u\n", 577 577 (char *)pkt + i + 6, tftp_tsize); 578 578 } 579 579 #endif