summaryrefslogtreecommitdiff
path: root/packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-11-29 09:25:50 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-11-29 09:25:50 +0000
commitec5d818fc28befe7bd53cc77236eaf98b3f1bd0f (patch)
tree0693c602d3f117524cad57d26a69613f98c0420c /packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch
parent1ebfe4f2b17e79aa8c609bca16759227c383065f (diff)
ixp400-eth: change to use maclist MAC values in 1.5
ixp4xx-csr: remove single PHY configuration options in 2.1
Diffstat (limited to 'packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch')
-rw-r--r--packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch b/packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch
new file mode 100644
index 0000000000..bd16124e94
--- /dev/null
+++ b/packages/ixp425-eth/ixp400-eth-1.5/mac-address.patch
@@ -0,0 +1,120 @@
+--- ./ixp400_eth.c.base 2005-11-28 23:59:34.476404165 -0800
++++ ./ixp400_eth.c 2005-11-29 00:42:44.587389574 -0800
+@@ -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
+@@ -621,21 +624,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
+@@ -3337,28 +3325,13 @@ 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.
+ */
++ if (maclist_read((u8(*)[6])&ndev->dev_addr, priv->port_id) ||
++ !is_valid_ether_addr(ndev->dev_addr))
++ random_ether_addr(ndev->dev_addr);
+
+- 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",
++ 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],
+@@ -3366,7 +3339,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
+@@ -3584,12 +3556,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();
++ 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;
+