Merge branch 'master' of git://git.denx.de/u-boot-cfi-flash
[oweals/u-boot.git] / include / net.h
index 79ddfa294acd82499677086218b3e8b35660a2b9..bbe0d4b5a2dfe4b001f00b3b8e62d86923372ca1 100644 (file)
 #define CONFIG_NET_MULTI
 #if (CONFIG_ETHER_INDEX == 1)
 #define        CONFIG_ETHER_ON_FCC1
-# define CFG_CMXFCR_MASK1      CFG_CMXFCR_MASK
-# define CFG_CMXFCR_VALUE1     CFG_CMXFCR_VALUE
+# define CONFIG_SYS_CMXFCR_MASK1       CONFIG_SYS_CMXFCR_MASK
+# define CONFIG_SYS_CMXFCR_VALUE1      CONFIG_SYS_CMXFCR_VALUE
 #elif (CONFIG_ETHER_INDEX == 2)
 #define        CONFIG_ETHER_ON_FCC2
-# define CFG_CMXFCR_MASK2      CFG_CMXFCR_MASK
-# define CFG_CMXFCR_VALUE2     CFG_CMXFCR_VALUE
+# define CONFIG_SYS_CMXFCR_MASK2       CONFIG_SYS_CMXFCR_MASK
+# define CONFIG_SYS_CMXFCR_VALUE2      CONFIG_SYS_CMXFCR_VALUE
 #elif (CONFIG_ETHER_INDEX == 3)
 #define        CONFIG_ETHER_ON_FCC3
-# define CFG_CMXFCR_MASK3      CFG_CMXFCR_MASK
-# define CFG_CMXFCR_VALUE3     CFG_CMXFCR_VALUE
+# define CONFIG_SYS_CMXFCR_MASK3       CONFIG_SYS_CMXFCR_MASK
+# define CONFIG_SYS_CMXFCR_VALUE3      CONFIG_SYS_CMXFCR_VALUE
 #endif /* CONFIG_ETHER_INDEX */
 #endif /* CONFIG_ETHER_ON_FCC */
 #endif /* !CONFIG_NET_MULTI && CONFIG_8260 */
@@ -61,8 +61,8 @@
  *
  */
 
-#ifdef CFG_RX_ETH_BUFFER
-# define PKTBUFSRX     CFG_RX_ETH_BUFFER
+#ifdef CONFIG_SYS_RX_ETH_BUFFER
+# define PKTBUFSRX     CONFIG_SYS_RX_ETH_BUFFER
 #else
 # define PKTBUFSRX     4
 #endif
@@ -200,6 +200,12 @@ typedef struct {
        ushort          udp_xsum;       /* Checksum                     */
 } IP_t;
 
+#define IP_OFFS                0x1fff /* ip offset *= 8 */
+#define IP_FLAGS       0xe000 /* first 3 bits */
+#define IP_FLAGS_RES   0x8000 /* reserved */
+#define IP_FLAGS_DFRAG 0x4000 /* don't fragments */
+#define IP_FLAGS_MFRAG 0x2000 /* more fragments */
+
 #define IP_HDR_SIZE_NO_UDP     (sizeof (IP_t) - 8)
 #define IP_HDR_SIZE            (sizeof (IP_t))
 
@@ -468,6 +474,22 @@ static inline int is_multicast_ether_addr(const u8 *addr)
        return (0x01 & addr[0]);
 }
 
+/**
+ * is_valid_ether_addr - Determine if the given Ethernet address is valid
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
+ * a multicast address, and is not FF:FF:FF:FF:FF:FF.
+ *
+ * Return true if the address is valid.
+ */
+static inline int is_valid_ether_addr(const u8 * addr)
+{
+       /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
+        * explicitly check for it here. */
+       return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
+}
+
 /* Convert an IP address to a string */
 extern void    ip_to_string (IPaddr_t x, char *s);