cmd_zfs: use common get_device_and_partition function
[oweals/u-boot.git] / include / net.h
index ec413664f7d9e61280aec5e36006b4fcb2c52754..6d2d6cd84958ef7fb464cf5961705329702c8207 100644 (file)
 #include <asm/cache.h>
 #include <asm/byteorder.h>     /* for nton* / ntoh* stuff */
 
+#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 */
+#define DEBUG_INT_STATE 0      /* Internal network state changes */
 
 /*
  *     The number of receive packet buffers, and the required packet buffer
@@ -118,6 +122,23 @@ extern int eth_setenv_enetaddr(char *name, const uchar *enetaddr);
 extern int eth_getenv_enetaddr_by_index(const char *base_name, int index,
                                        uchar *enetaddr);
 
+#ifdef CONFIG_RANDOM_MACADDR
+/*
+ * The u-boot policy does not allow hardcoded ethernet addresses. Under the
+ * following circumstances a random generated address is allowed:
+ *  - in emergency cases, where you need a working network connection to set
+ *    the ethernet address.
+ *    Eg. you want a rescue boot and don't have a serial port to access the
+ *    CLI to set environment variables.
+ *
+ * In these cases, we generate a random locally administered ethernet address.
+ *
+ * Args:
+ *  enetaddr - returns 6 byte hardware address
+ */
+extern void eth_random_enetaddr(uchar *enetaddr);
+#endif
+
 extern int usb_eth_initialize(bd_t *bi);
 extern int eth_init(bd_t *bis);                        /* Initialize the device */
 extern int eth_send(void *packet, int length);    /* Send a packet */
@@ -395,7 +416,7 @@ extern int          NetRestartWrap;         /* Tried all network devices */
 
 enum proto_t {
        BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
-       TFTPSRV, TFTPPUT
+       TFTPSRV, TFTPPUT, LINKLOCAL
 };
 
 /* from net/net.c */
@@ -480,17 +501,18 @@ static inline void net_set_state(enum net_loop_state state)
 {
        extern enum net_loop_state net_state;
 
+       debug_cond(DEBUG_INT_STATE, "--- NetState set to %d\n", state);
        net_state = state;
 }
 
-/* Transmit "NetTxPacket" */
+/* Transmit a packet */
 static inline void NetSendPacket(uchar *pkt, int len)
 {
        (void) eth_send(pkt, len);
 }
 
 /*
- * Transmit UDP packet, performing ARP request if needed
+ * Transmit "NetTxPacket" as UDP packet, performing ARP request if needed
  *  (ether will be populated)
  *
  * @param ether Raw packet buffer
@@ -499,7 +521,7 @@ static inline void NetSendPacket(uchar *pkt, int len)
  * @param sport Source UDP port
  * @param payload_len Length of data after the UDP header
  */
-extern int     NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
+extern int NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport,
                        int sport, int payload_len);
 
 /* Processes a received packet */