summaryrefslogtreecommitdiff
path: root/recipes/ixp425-eth/ixp400-eth-1.5/mac-address.patch
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/ixp425-eth/ixp400-eth-1.5/mac-address.patch
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/ixp425-eth/ixp400-eth-1.5/mac-address.patch')
-rw-r--r--recipes/ixp425-eth/ixp400-eth-1.5/mac-address.patch123
1 files changed, 123 insertions, 0 deletions
diff --git a/recipes/ixp425-eth/ixp400-eth-1.5/mac-address.patch b/recipes/ixp425-eth/ixp400-eth-1.5/mac-address.patch
new file mode 100644
index 0000000000..e23eaf5f2b
--- /dev/null
+++ b/recipes/ixp425-eth/ixp400-eth-1.5/mac-address.patch
@@ -0,0 +1,123 @@
+Patch to use maclist - get the MAC to use from the board level
+MAC repository based on the device portId.
+
+Signed-off-by: John Bowler <jbowler@acm.org>
+
+--- ixp400-eth/ixp400_eth.c 1970-01-01 00:00:00.000000000 +0000
++++ ixp400-eth/ixp400_eth.c 1970-01-01 00:00:00.000000000 +0000
+@@ -23,10 +23,10 @@
+ * This driver is written and optimized for Intel Xscale technology.
+ *
+ * SETUP NOTES:
+- * By default, this driver uses predefined MAC addresses.
+- * These are set in global var 'default_mac_addr' in this file.
+- * If required, these can be changed at run-time using
+- * the 'ifconfig' tool.
++ * By default, this driver uses MAC addresses from maclist, if
++ * these are not available the kernel api to randomly generate
++ * a locally assigned MAC address is used. The MAC can be
++ * overridden with ifconfig if absolutely necessary.
+ *
+ * Example - to set ixp0 MAC address to 00:02:B3:66:88:AA,
+ * run ifconfig with the following arguments:
+@@ -64,6 +64,7 @@
+ #include <linux/sysctl.h>
+ #include <linux/unistd.h>
+ #include <linux/version.h>
++#include <net/maclist.h>
+
+ #if KERNEL_VERSION(2,6,0) <= LINUX_VERSION_CODE
+ #include <linux/workqueue.h>
+@@ -130,6 +131,8 @@ static int dev_max_count = 1; /* only NP
+ static int dev_max_count = 2; /* only NPEB and NPEC */
+ #elif defined (CONFIG_ARCH_IXDP465) || defined(CONFIG_MACH_IXDP465)
+ static int dev_max_count = 3; /* all NPEs are used */
++#else
++static int dev_max_count = -1;/* use maclist_count */
+ #endif
+
+ #ifndef CONFIG_IXP400_NAPI
+@@ -614,21 +617,6 @@ static phy_cfg_t default_phy_cfg[] =
+ #endif
+ };
+
+-/* Default MAC addresses for EthAcc Ports 1 and 2 (using Intel MAC prefix)
+- * Default is
+- * IX_ETH_PORT_1 -> MAC 00:02:b3:01:01:01
+- * IX_ETH_PORT_2 -> MAC 00:02:b3:02:02:02
+- * IX_ETH_PORT_3 -> MAC 00:02:b3:03:03:03
+-*/
+-static IxEthAccMacAddr default_mac_addr[] =
+-{
+- {{0x00, 0x02, 0xB3, 0x01, 0x01, 0x01}} /* EthAcc Port 0 */
+- ,{{0x00, 0x02, 0xB3, 0x02, 0x02, 0x02}} /* EthAcc Port 1 */
+-#if defined (CONFIG_ARCH_IXDP465) || defined(CONFIG_MACH_IXDP465)
+- ,{{0x00, 0x02, 0xB3, 0x03, 0x03, 0x03}} /* EthAcc Port 2 */
+-#endif
+-};
+-
+ /* Default mapping of NpeImageIds for EthAcc Ports
+ * Default is
+ * IX_ETH_PORT_1 -> IX_ETH_NPE_B
+@@ -3325,28 +3313,10 @@ static int __devinit dev_eth_probe(struc
+
+ /* Defines the unicast MAC address
+ *
+- * Here is a good place to read a board-specific MAC address
+- * from a non-volatile memory, e.g. an external eeprom.
+- *
+- * This memcpy uses a default MAC address from this
+- * source code.
+- *
+- * This can be overriden later by the (optional) command
+- *
+- * ifconfig ixp0 ether 0002b3010101
+- *
++ * The code reads from the maclist API.
+ */
+-
+- memcpy(ndev->dev_addr,
+- &default_mac_addr[priv->port_id].macAddress,
+- IX_IEEE803_MAC_ADDRESS_SIZE);
+-
+- /* possibly remove this test and the message when a valid MAC address
+- * is not hardcoded in the driver source code.
+- */
+- if (is_valid_ether_addr(ndev->dev_addr))
+- {
+- P_WARN("Use default MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x for port %d\n",
++ maclist_read((u8(*)[6])&ndev->dev_addr, priv->port_id);
++ P_INFO("Use MAC address %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x for port %d\n",
+ (unsigned)ndev->dev_addr[0],
+ (unsigned)ndev->dev_addr[1],
+ (unsigned)ndev->dev_addr[2],
+@@ -3354,7 +3324,6 @@ static int __devinit dev_eth_probe(struc
+ (unsigned)ndev->dev_addr[4],
+ (unsigned)ndev->dev_addr[5],
+ priv->port_id);
+- }
+
+ /* Set/update the internal packet size
+ * This can be overriden later by the command
+@@ -3562,12 +3531,15 @@ static int __init ixp400_eth_init(void)
+
+ TRACE;
+
+- /* check module parameter range */
+- if (dev_max_count == 0 || dev_max_count > IX_ETH_ACC_NUMBER_OF_PORTS)
+- {
+- P_ERROR("Number of ports supported is dev_max_count <= %d\n", IX_ETH_ACC_NUMBER_OF_PORTS);
+- return -1;
+- }
++ /* fix dev_max_count to maclist_count - the actual number of
++ * available MACs
++ */
++ if (dev_max_count <= 0 || (dev_max_count > maclist_count() && maclist_count() > 0))
++ dev_max_count = maclist_count();
++ if (dev_max_count <= 0)
++ dev_max_count = 1;
++ else if (dev_max_count > IX_ETH_ACC_NUMBER_OF_PORTS)
++ dev_max_count = IX_ETH_ACC_NUMBER_OF_PORTS;
+
+ TRACE;
+