]> git.sur5r.net Git - u-boot/blobdiff - include/net.h
net: Move enetaddr env access code to env config instead of net config
[u-boot] / include / net.h
index ed5259a80738214ed60a44d2ddf6ba51ac5565c4..3469811aa0ea3a7f3910f45db52b882708f76c68 100644 (file)
 #ifndef __NET_H__
 #define __NET_H__
 
-#if defined(CONFIG_8xx)
-#include <commproc.h>
-#endif /* CONFIG_8xx */
-
 #include <asm/cache.h>
 #include <asm/byteorder.h>     /* for nton* / ntoh* stuff */
 
@@ -242,12 +238,9 @@ void eth_try_another(int first_restart);   /* Change the device */
 void eth_set_current(void);            /* set nterface to ethcur var */
 
 int eth_get_dev_index(void);           /* get the device index */
-void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
-int eth_getenv_enetaddr(const char *name, uchar *enetaddr);
-int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
 
 /**
- * eth_setenv_enetaddr_by_index() - set the MAC address environment variable
+ * eth_env_set_enetaddr_by_index() - set the MAC address environment variable
  *
  * This sets up an environment variable with the given MAC address (@enetaddr).
  * The environment variable to be set is defined by <@base_name><@index>addr.
@@ -259,7 +252,7 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
  * @enetaddr:   Pointer to MAC address to put into the variable
  * @return 0 if OK, other value on error
  */
-int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_set_enetaddr_by_index(const char *base_name, int index,
                                 uchar *enetaddr);
 
 
@@ -279,7 +272,7 @@ int usb_ether_init(void);
  * Returns:
  *     Return true if the address is valid.
  */
-int eth_getenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_get_enetaddr_by_index(const char *base_name, int index,
                                 uchar *enetaddr);
 
 int eth_init(void);                    /* Initialize the device */
@@ -312,7 +305,7 @@ struct ethernet_hdr {
        u8              et_dest[ARP_HLEN];      /* Destination node     */
        u8              et_src[ARP_HLEN];       /* Source node          */
        u16             et_protlen;             /* Protocol or length   */
-};
+} __attribute__((packed));
 
 /* Ethernet header size */
 #define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr))
@@ -330,7 +323,7 @@ struct e802_hdr {
        u8              et_snap2;
        u8              et_snap3;
        u16             et_prot;                /* 802 protocol         */
-};
+} __attribute__((packed));
 
 /* 802 + SNAP + ethernet header size */
 #define E802_HDR_SIZE  (sizeof(struct e802_hdr))
@@ -344,7 +337,7 @@ struct vlan_ethernet_hdr {
        u16             vet_vlan_type;          /* PROT_VLAN            */
        u16             vet_tag;                /* TAG of VLAN          */
        u16             vet_type;               /* protocol type        */
-};
+} __attribute__((packed));
 
 /* VLAN Ethernet header size */
 #define VLAN_ETHER_HDR_SIZE    (sizeof(struct vlan_ethernet_hdr))
@@ -373,7 +366,7 @@ struct ip_hdr {
        u16             ip_sum;         /* checksum                     */
        struct in_addr  ip_src;         /* Source IP address            */
        struct in_addr  ip_dst;         /* Destination IP address       */
-};
+} __attribute__((packed));
 
 #define IP_OFFS                0x1fff /* ip offset *= 8 */
 #define IP_FLAGS       0xe000 /* first 3 bits */
@@ -401,7 +394,7 @@ struct ip_udp_hdr {
        u16             udp_dst;        /* UDP destination port         */
        u16             udp_len;        /* Length of UDP packet         */
        u16             udp_xsum;       /* Checksum                     */
-};
+} __attribute__((packed));
 
 #define IP_UDP_HDR_SIZE                (sizeof(struct ip_udp_hdr))
 #define UDP_HDR_SIZE           (IP_UDP_HDR_SIZE - IP_HDR_SIZE)
@@ -439,7 +432,7 @@ struct arp_hdr {
        u8              ar_tha[];       /* Target hardware address      */
        u8              ar_tpa[];       /* Target protocol address      */
 #endif /* 0 */
-};
+} __attribute__((packed));
 
 #define ARP_HDR_SIZE   (8+20)          /* Size assuming ethernet       */
 
@@ -474,7 +467,7 @@ struct icmp_hdr {
                } frag;
                u8 data[0];
        } un;
-};
+} __attribute__((packed));
 
 #define ICMP_HDR_SIZE          (sizeof(struct icmp_hdr))
 #define IP_ICMP_HDR_SIZE       (IP_HDR_SIZE + ICMP_HDR_SIZE)
@@ -680,7 +673,7 @@ int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
 /* Processes a received packet */
 void net_process_received_packet(uchar *in_packet, int len);
 
-#ifdef CONFIG_NETCONSOLE
+#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_SPL_BUILD)
 void nc_start(void);
 int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
        unsigned src_port, unsigned len);
@@ -688,7 +681,7 @@ int nc_input_packet(uchar *pkt, struct in_addr src_ip, unsigned dest_port,
 
 static __always_inline int eth_is_on_demand_init(void)
 {
-#ifdef CONFIG_NETCONSOLE
+#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_SPL_BUILD)
        extern enum proto_t net_loop_last_protocol;
 
        return net_loop_last_protocol != NETCONS;
@@ -699,7 +692,7 @@ static __always_inline int eth_is_on_demand_init(void)
 
 static inline void eth_set_last_protocol(int protocol)
 {
-#ifdef CONFIG_NETCONSOLE
+#if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_SPL_BUILD)
        extern enum proto_t net_loop_last_protocol;
 
        net_loop_last_protocol = protocol;
@@ -838,7 +831,7 @@ void vlan_to_string(ushort x, char *s);
 ushort string_to_vlan(const char *s);
 
 /* read a VLAN id from an environment variable */
-ushort getenv_vlan(char *);
+ushort env_get_vlan(char *);
 
 /* copy a filename (allow for "..." notation, limit length) */
 void copy_filename(char *dst, const char *src, int size);