X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fnet.h;h=cec8c986182f911182970eb1a06089a74642e223;hb=52207514ba419a69a8105d16997b025f966c8879;hp=82500eeb30f706ea3254cd98421212dcfeba6739;hpb=6e3cd0a3845cbba7e49f48b2ec326564986bfb9b;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/net.h b/include/net.h index 82500ee..cec8c98 100644 --- a/include/net.h +++ b/include/net.h @@ -12,12 +12,19 @@ #ifndef __NET_H__ #define __NET_H__ +#include #include #include /* for nton* / ntoh* stuff */ #include +#include +#include #include #include +struct bd_info; +struct cmd_tbl; +struct udevice; + #define DEBUG_LL_STATE 0 /* Link local state machine changes */ #define DEBUG_DEV_PKT 0 /* Packets or info directed to the device */ #define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ @@ -37,6 +44,9 @@ #define PKTALIGN ARCH_DMA_MINALIGN +/* Number of packets processed together */ +#define ETH_PACKETS_BATCH_RECV 32 + /* ARP hardware address length */ #define ARP_HLEN 6 /* @@ -59,7 +69,7 @@ struct in_addr { * @argv: List of arguments * @return result (see enum command_ret_t) */ -int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); +int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); /** * An incoming packet handler. @@ -105,7 +115,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; @@ -148,6 +158,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); @@ -158,6 +169,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) @@ -184,12 +196,12 @@ struct eth_device { phys_addr_t iobase; int state; - int (*init)(struct eth_device *, bd_t *); + int (*init)(struct eth_device *eth, struct bd_info *bd); int (*send)(struct eth_device *, void *packet, int length); int (*recv)(struct eth_device *); void (*halt)(struct eth_device *); int (*mcast)(struct eth_device *, const u8 *enetaddr, int join); - int (*write_hwaddr)(struct eth_device *); + int (*write_hwaddr)(struct eth_device *eth); struct eth_device *next; int index; void *priv; @@ -242,7 +254,7 @@ static __always_inline void eth_halt_state_only(void) int eth_write_hwaddr(struct eth_device *dev, const char *base_name, int eth_number); -int usb_eth_initialize(bd_t *bi); +int usb_eth_initialize(struct bd_info *bi); #endif int eth_initialize(void); /* Initialize network subsystem */ @@ -489,7 +501,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 @@ -544,7 +562,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 }; extern char net_boot_file_name[1024];/* Boot File name */ @@ -586,7 +604,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. */ @@ -890,9 +908,6 @@ int is_serverip_in_cmd(void); */ int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len); -/* get a random source port */ -unsigned int random_port(void); - /** * update_tftp - Update firmware over TFTP (via DFU) *