[meego-commits] 24323: Changes to devel:kernel:1.2/kernel-adaptation-connext1

geoffroy no_reply at build.meego.com
Thu Oct 20 14:32:43 UTC 2011


Hi,
I have made the following changes to kernel-adaptation-connext1 in project devel:kernel:1.2. Please review and accept ASAP.

Thank You,
geoffroy

[This message was auto-generated]

---

Request #24323:

  submit:   home:geoffroy:MeeGo:1.2:IVI/kernel-adaptation-connext(r5) -> devel:kernel:1.2/kernel-adaptation-connext1


Message:
    * Tue Oct 18 2011 Geoffroy Van Cutsem <geoffroy.vancutsem at intel.com> - 2.6.37.6
- Backported 'mac_addr_str' parameter support
- This allows to set the MAC address when the driver is loaded instead
- of using a post-boot dirty hack. Good workaround for BMC #17418

State:   new          2011-10-20T07:19:59 geoffroy
Comment: None



changes files:
--------------
--- kernel-adaptation-connext.changes
+++ kernel-adaptation-connext.changes
@@ -0,0 +1,5 @@
+* Tue Oct 18 2011 Geoffroy Van Cutsem <geoffroy.vancutsem at intel.com> - 2.6.37.6
+- Backported 'mac_addr_str' parameter support
+- This allows to set the MAC address when the driver is loaded instead
+- of using a post-boot dirty hack. Good workaround for BMC #17418
+

new:
----
  add_mac_addr_str_param_stmmac.patch

spec files:
-----------
--- kernel-adaptation-connext.spec
+++ kernel-adaptation-connext.spec
@@ -276,6 +276,10 @@
 #
 Patch240: linux-2.6.37-cdc-ncm.patch
 
+#
+# Add parameter to set the MAC address of stmmac when driver is loaded
+#
+Patch241: add_mac_addr_str_param_stmmac.patch
 
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -562,6 +566,11 @@
 # linux-2.6.37-cdc-ncm.patch
 %patch240 -p1
 
+#
+# Add parameter to set the MAC address of stmmac when driver is loaded
+#
+# add_mac_addr_str_param_stmmac.patch
+%patch241 -p1
 
 # Drop some necessary files from the source dir into the buildroot
 cp $RPM_SOURCE_DIR/config-* .

other changes:
--------------

++++++ add_mac_addr_str_param_stmmac.patch (new)
--- add_mac_addr_str_param_stmmac.patch
+++ add_mac_addr_str_param_stmmac.patch
+diff -Naur linux-2.6.37/drivers/net/stmmac/stmmac_main.c linux-2.6.37-new/drivers/net/stmmac/stmmac_main.c
+--- linux-2.6.37/drivers/net/stmmac/stmmac_main.c	2011-10-17 19:49:32.946493971 +0300
++++ linux-2.6.37-new/drivers/net/stmmac/stmmac_main.c	2011-10-18 20:04:25.897440929 +0300
+@@ -120,6 +120,13 @@
+ module_param(tc, int, S_IRUGO | S_IWUSR);
+ MODULE_PARM_DESC(tc, "DMA threshold control value");
+ 
++/* Invalid mac address by default */
++#define DEFAULT_MAC_ADDRESS "00:00:00:00:00:00"
++static char *mac_address_str = DEFAULT_MAC_ADDRESS ;
++module_param(mac_address_str, charp, S_IRUGO | S_IWUSR);
++MODULE_PARM_DESC(mac_address_str, "MAC address (in case no platform mac is "
++                 "available");
++
+ #define RX_NO_COALESCE	1	/* Always interrupt on completion */
+ #define TX_NO_COALESCE	-1	/* No moderation by default */
+ 
+@@ -202,6 +209,55 @@
+ 					  phydev->speed);
+ }
+ 
++/*
++ *  str_to_mac
++ *  @mac : output mac address
++ * @mac_address_str : input mac address (string)
++ *
++ *  This function comes from netpoll.c
++ */
++void str_to_mac(u8 *mac, char *str)
++{
++        char *delim, *cur = str ;
++        /* MAC address */
++        delim = strchr(cur, ':');
++        if (delim == NULL)
++                goto parse_failed;
++        *delim = 0;
++        mac[0] = simple_strtol(cur, NULL, 16);
++        cur = delim + 1;
++        delim = strchr(cur, ':');
++        if (delim == NULL)
++                goto parse_failed;
++        *delim = 0;
++        mac[1] = simple_strtol(cur, NULL, 16);
++        cur = delim + 1;
++        delim = strchr(cur, ':');
++        if (delim == NULL)
++                goto parse_failed;
++        *delim = 0;
++        mac[2] = simple_strtol(cur, NULL, 16);
++        cur = delim + 1;
++        delim = strchr(cur, ':');
++        if (delim == NULL)
++                goto parse_failed;
++        *delim = 0;
++        mac[3] = simple_strtol(cur, NULL, 16);
++        cur = delim + 1;
++        delim = strchr(cur, ':');
++        if (delim == NULL)
++                goto parse_failed;
++        *delim = 0;
++	mac[4] = simple_strtol(cur, NULL, 16);
++        cur = delim + 1;
++        mac[5] = simple_strtol(cur, NULL, 16);
++        return;
++
++ parse_failed:
++        memset(mac, 0, ETH_ALEN);
++        return;
++}
++
+ /**
+  * stmmac_adjust_link
+  * @dev: net device structure
+@@ -1491,6 +1547,7 @@
+ static int stmmac_probe(struct net_device *dev)
+ {
+ 	int ret = 0;
++	u8 mac[dev->addr_len];
+ 	struct stmmac_priv *priv = netdev_priv(dev);
+ 
+ 	ether_setup(dev);
+@@ -1512,13 +1569,19 @@
+ 	priv->pause = pause;
+ 	netif_napi_add(dev, &priv->napi, stmmac_poll, 64);
+ 
+-	/* Get the MAC address */
+-	priv->hw->mac->get_umac_addr((void __iomem *) dev->base_addr,
+-				     dev->dev_addr, 0);
+-
+-	if (!is_valid_ether_addr(dev->dev_addr))
+-		pr_warning("\tno valid MAC address;"
+-			"please, use ifconfig or nwhwconfig!\n");
++        /*
++ 	  Get the MAC address as a module parameter
++	  If it fails, generate a random MAC
++ 	*/
++        str_to_mac(mac, mac_address_str);
++        if (!is_valid_ether_addr(mac)) {
++                pr_warning("no valid MAC address, picking a random one\n");
++                random_ether_addr(mac);
++        }
++
++        /* Write the MAC address */
++        priv->hw->mac->set_umac_addr((void __iomem *) dev->base_addr, mac, 0);
++        memcpy(dev->dev_addr, mac, dev->addr_len);
+ 
+ 	spin_lock_init(&priv->lock);

++++++ config-generic
--- config-generic
+++ config-generic
@@ -1791,7 +1791,7 @@
 # CONFIG_USB_GSPCA_T613 is not set
 # CONFIG_USB_GSPCA_TV8532 is not set
 # CONFIG_USB_GSPCA_VC032X is not set
-# CONFIG_USB_GSPCA_ZC3XX is not set
+CONFIG_USB_GSPCA_ZC3XX=m
 # CONFIG_VIDEO_PVRUSB2 is not set
 # CONFIG_VIDEO_EM28XX is not set
 # CONFIG_VIDEO_USBVISION is not set

++++++ series
--- series
+++ series
@@ -126,3 +126,7 @@
 #
 linux-2.6.37-cdc-ncm.patch
 
+#
+# Add parameter to set the MAC address of stmmac when driver is loaded
+#
+add_mac_addr_str_param_stmmac.patch



More information about the MeeGo-commits mailing list