X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fnet.h;h=32364ed0ced9ee9e05580b0e09dd6cdca7622b98;hb=b85d75951fe126267a29bc953ed59ed64a152288;hp=1bf9867f8cf8efaf70528d1e4e892034701e9857;hpb=526fe06a5d1d96ce22cca743576945016ec4e2ef;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/net.h b/include/net.h index 1bf9867..32364ed 100644 --- a/include/net.h +++ b/include/net.h @@ -35,15 +35,12 @@ struct udevice; * alignment in memory. * */ - -#ifdef CONFIG_SYS_RX_ETH_BUFFER -# define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER -#else -# define PKTBUFSRX 4 -#endif - +#define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER #define PKTALIGN ARCH_DMA_MINALIGN +/* Number of packets processed together */ +#define ETH_PACKETS_BATCH_RECV 32 + /* ARP hardware address length */ #define ARP_HLEN 6 /* @@ -64,7 +61,7 @@ struct in_addr { * @flag: Command flags (CMD_FLAG_...) * @argc: Number of arguments * @argv: List of arguments - * @return result (see enum command_ret_t) + * Return: result (see enum command_ret_t) */ int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); @@ -112,7 +109,7 @@ enum eth_state_t { * @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env * @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_... * @max_speed: Maximum speed of Ethernet connection supported by MAC - * @priv_pdata: device specific platdata + * @priv_pdata: device specific plat */ struct eth_pdata { phys_addr_t iobase; @@ -155,6 +152,7 @@ enum eth_recv_flags { * ROM on the board. This is how the driver should expose it * to the network stack. This function should fill in the * eth_pdata::enetaddr field - optional + * set_promisc: Enable or Disable promiscuous mode */ struct eth_ops { int (*start)(struct udevice *dev); @@ -165,6 +163,7 @@ struct eth_ops { int (*mcast)(struct udevice *dev, const u8 *enetaddr, int join); int (*write_hwaddr)(struct udevice *dev); int (*read_rom_hwaddr)(struct udevice *dev); + int (*set_promisc)(struct udevice *dev, bool enable); }; #define eth_get_ops(dev) ((struct eth_ops *)(dev)->driver->ops) @@ -269,7 +268,7 @@ int eth_get_dev_index(void); /* get the device index */ * @base_name: Base name for variable, typically "eth" * @index: Index of interface being updated (>=0) * @enetaddr: Pointer to MAC address to put into the variable - * @return 0 if OK, other value on error + * Return: 0 if OK, other value on error */ int eth_env_set_enetaddr_by_index(const char *base_name, int index, uchar *enetaddr); @@ -392,6 +391,8 @@ struct ip_hdr { #define IP_HDR_SIZE (sizeof(struct ip_hdr)) +#define IP_MIN_FRAG_DATAGRAM_SIZE (IP_HDR_SIZE + 8) + /* * Internet Protocol (IP) + UDP header. */ @@ -496,7 +497,13 @@ struct icmp_hdr { * maximum packet size and multiple of 32 bytes = 1536 */ #define PKTSIZE 1522 +#ifndef CONFIG_DM_DSA #define PKTSIZE_ALIGN 1536 +#else +/* Maximum DSA tagging overhead (headroom and/or tailroom) */ +#define DSA_MAX_OVR 256 +#define PKTSIZE_ALIGN (1536 + DSA_MAX_OVR) +#endif /* * Maximum receive ring size; that is, the number of packets @@ -529,7 +536,9 @@ extern struct in_addr net_dns_server2; #endif extern char net_nis_domain[32]; /* Our IS domain */ extern char net_hostname[32]; /* Our hostname */ -extern char net_root_path[64]; /* Our root path */ +#ifdef CONFIG_NET +extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN]; /* Our root path */ +#endif /** END OF BOOTP EXTENTIONS **/ extern u8 net_ethaddr[ARP_HLEN]; /* Our ethernet address */ extern u8 net_server_ethaddr[ARP_HLEN]; /* Boot server enet address */ @@ -551,7 +560,7 @@ extern int net_restart_wrap; /* Tried all network devices */ enum proto_t { BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP, - TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL + TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, NCSI }; extern char net_boot_file_name[1024];/* Boot File name */ @@ -593,7 +602,7 @@ extern int net_ntp_time_offset; /* offset time from UTC */ #endif /* Initialize the network adapter */ -void net_init(void); +int net_init(void); int net_loop(enum proto_t); /* Load failed. Start again. */ @@ -617,7 +626,7 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, * * @addr: Address to check (must be 16-bit aligned) * @nbytes: Number of bytes to check (normally a multiple of 2) - * @return 16-bit IP checksum + * Return: 16-bit IP checksum */ unsigned compute_ip_checksum(const void *addr, unsigned nbytes); @@ -627,7 +636,7 @@ unsigned compute_ip_checksum(const void *addr, unsigned nbytes); * @offset: Offset of first sum (if odd we do a byte-swap) * @sum: First checksum * @new_sum: New checksum to add - * @return updated 16-bit IP checksum + * Return: updated 16-bit IP checksum */ unsigned add_ip_checksums(unsigned offset, unsigned sum, unsigned new_sum); @@ -638,7 +647,7 @@ unsigned add_ip_checksums(unsigned offset, unsigned sum, unsigned new_sum); * * @addr: Address to check (must be 16-bit aligned) * @nbytes: Number of bytes to check (normally a multiple of 2) - * @return true if the checksum matches, false if not + * Return: true if the checksum matches, false if not */ int ip_checksum_ok(const void *addr, unsigned nbytes); @@ -906,7 +915,7 @@ int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len); * @param interface - the DFU medium name - e.g. "mmc" * @param devstring - the DFU medium number - e.g. "1" * - * @return - 0 on success, other value on failure + * Return: - 0 on success, other value on failure */ int update_tftp(ulong addr, char *interface, char *devstring); @@ -916,7 +925,7 @@ int update_tftp(ulong addr, char *interface, char *devstring); * @var: Environment variable to convert. The value of this variable must be * in the format format a.b.c.d, where each value is a decimal number from * 0 to 255 - * @return IP address, or 0 if invalid + * Return: IP address, or 0 if invalid */ static inline struct in_addr env_get_ip(char *var) {