Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] net/usb: kalmia: Various fixes for better support of non-x86 architectures.
From: Alan Stern @ 2011-06-23 14:28 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Marius B. Kotsbak, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	Marius B. Kotsbak
In-Reply-To: <4E03198A.2060600-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>

On Thu, 23 Jun 2011, Sergei Shtylyov wrote:

> Hello.
> 
> On 22-06-2011 19:26, Marius B. Kotsbak wrote:
> 
> > -Support for big endian.
> > -Do not use USB buffers at the stack.
> > -Safer/more efficient code for local constants.
> 
> > Signed-off-by: Marius B. Kotsbak<marius-iy5w9mehe2BBDgjK7y7TUQ@public.gmane.org>
> > ---
> >   drivers/net/usb/kalmia.c |   40 ++++++++++++++++++++++++----------------
> >   1 files changed, 24 insertions(+), 16 deletions(-)
> 
> > diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c
> > index d965fb1..d4edeb2 100644
> > --- a/drivers/net/usb/kalmia.c
> > +++ b/drivers/net/usb/kalmia.c
> > @@ -100,27 +100,35 @@ kalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len,
> >   static int
> >   kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr)
> >   {
> > -	char init_msg_1[] =
> > +	const static char init_msg_1[] =
> >   		{ 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
> >   		0x00, 0x00 };
> > -	char init_msg_2[] =
> > +	const static char init_msg_2[] =
> >   		{ 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4,
> >   		0x00, 0x00 };
> 
>     Actually 'const' alone should've been enough for the variable to be placed 
> in the data section ISO stack.

I don't understand what "ISO stack" means here.

I would think that "const" might or might not cause the array to be 
allocated statically.  All it really tells the compiler is that the 
function will not change the contents of the array.

To be certain that the array is allocated statically (not on the 
stack), it's best to use "static".

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 1/2] iwlwifi: use pci_dev->revision, again
From: Sergei Shtylyov @ 2011-06-23 14:41 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA, linville-2XuSBdqkA4R54TAoqtyWWQ,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: wey-yi.w.guy-ral2JQCrhuEAvxtiuMwx3w, ilw-VuQAYsv1563Yd54FQh9/CA

Commit ff938e43d39e926de74b32a3656c190f979ab642 (net: use pci_dev->revision,
again) already converted this driver to using the 'revision' field of 'struct
pci_dev' but commit c2974a1d18832a9fffb2eb389c3878f5c4ed92f1 (iwlagn: remove
rev_id) later reverted that change for no reason. Now restore the change...

Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>

---
The patch is against the recent Linus' tree.

 drivers/net/wireless/iwlwifi/iwl-agn.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/net/wireless/iwlwifi/iwl-agn.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ linux-2.6/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3275,10 +3275,9 @@ struct ieee80211_ops iwlagn_hw_ops = {
 
 static u32 iwl_hw_detect(struct iwl_priv *priv)
 {
-	u8 rev_id;
+	IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n",
+		       priv->pci_dev->revision);
 
-	pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id);
-	IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id);
 	return iwl_read32(priv, CSR_HW_REV);
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 2/2 resend] mlx4: use pci_dev->revision
From: Sergei Shtylyov @ 2011-06-23 14:44 UTC (permalink / raw)
  To: netdev; +Cc: yevgenyp

Commit 725c89997e03d71b09ea3c17c997da0712b9d835 (mlx4_en: Reporting HW revision
in ethtool -i) added code to read the revision ID from the PCI configuration
register while it's already stored by PCI subsystem in the 'revision' field of
'struct pci_dev'...

While at it, move the code being changed a bit in order to not break the
initialization sequence.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
The patch is against the recent Linus' tree.
It wasn't merged to Linux 3.0, hopefully it will be picked up for 3.1...

 drivers/net/mlx4/main.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/net/mlx4/main.c
===================================================================
--- linux-2.6.orig/drivers/net/mlx4/main.c
+++ linux-2.6/drivers/net/mlx4/main.c
@@ -1230,11 +1230,11 @@ static int __mlx4_init_one(struct pci_de
 	INIT_LIST_HEAD(&priv->pgdir_list);
 	mutex_init(&priv->pgdir_mutex);
 
-	pci_read_config_byte(pdev, PCI_REVISION_ID, &dev->rev_id);
-
 	INIT_LIST_HEAD(&priv->bf_list);
 	mutex_init(&priv->bf_mutex);
 
+	dev->rev_id = pdev->revision;
+
 	/*
 	 * Now reset the HCA before we touch the PCI capabilities or
 	 * attempt a firmware command, since a boot ROM may have left

^ permalink raw reply

* [PATCH] ssb: use pci_dev->revision
From: Sergei Shtylyov @ 2011-06-23 14:49 UTC (permalink / raw)
  To: mb, netdev

The bus scan code reads PCI revision ID from the PCI configuration register
while it's already stored by PCI subsystem in the 'revision' field of 'struct
pci_dev'...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
The patch is against the recent Linus' tree.

There's another place where the revision ID register is read but as 16-bit
entity (probably by mistake though), so I didn't convert it...

 drivers/ssb/scan.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-2.6/drivers/ssb/scan.c
===================================================================
--- linux-2.6.orig/drivers/ssb/scan.c
+++ linux-2.6/drivers/ssb/scan.c
@@ -310,8 +310,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
 	} else {
 		if (bus->bustype == SSB_BUSTYPE_PCI) {
 			bus->chip_id = pcidev_to_chipid(bus->host_pci);
-			pci_read_config_byte(bus->host_pci, PCI_REVISION_ID,
-					     &bus->chip_rev);
+			bus->chip_rev = bus->host_pci->revision;
 			bus->chip_package = 0;
 		} else {
 			bus->chip_id = 0x4710;

^ permalink raw reply

* Re: [PATCH] net/usb: kalmia: Various fixes for better support of non-x86 architectures.
From: Sergei Shtylyov @ 2011-06-23 14:55 UTC (permalink / raw)
  To: Alan Stern
  Cc: Sergei Shtylyov, Marius B. Kotsbak, davem, netdev, linux-usb,
	Marius B. Kotsbak
In-Reply-To: <Pine.LNX.4.44L0.1106231025340.2033-100000@iolanthe.rowland.org>

Alan Stern wrote:

>>> -Support for big endian.
>>> -Do not use USB buffers at the stack.
>>> -Safer/more efficient code for local constants.

>>> Signed-off-by: Marius B. Kotsbak<marius@kotsbak.com>

>>> ---
>>>   drivers/net/usb/kalmia.c |   40 ++++++++++++++++++++++++----------------
>>>   1 files changed, 24 insertions(+), 16 deletions(-)

>>> diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c
>>> index d965fb1..d4edeb2 100644
>>> --- a/drivers/net/usb/kalmia.c
>>> +++ b/drivers/net/usb/kalmia.c
>>> @@ -100,27 +100,35 @@ kalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len,
>>>   static int
>>>   kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr)
>>>   {
>>> -	char init_msg_1[] =
>>> +	const static char init_msg_1[] =
>>>   		{ 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
>>>   		0x00, 0x00 };
>>> -	char init_msg_2[] =
>>> +	const static char init_msg_2[] =
>>>   		{ 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4,
>>>   		0x00, 0x00 };

>>     Actually 'const' alone should've been enough for the variable to be placed 
>> in the data section ISO stack.

> I don't understand what "ISO stack" means here.

    ISO == instead of.

> I would think that "const" might or might not cause the array to be 
> allocated statically.

    At least with gcc, it will be allocated statically.

> Alan Stern

WBR, Sergei

^ permalink raw reply

* Re: [PATCH] ssb: use pci_dev->revision
From: Michael Büsch @ 2011-06-23 15:09 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev
In-Reply-To: <201106231849.53030.sshtylyov@ru.mvista.com>

On Thu, 23 Jun 2011 18:49:52 +0400
Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote:

> The bus scan code reads PCI revision ID from the PCI configuration register
> while it's already stored by PCI subsystem in the 'revision' field of 'struct
> pci_dev'...
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> ---
> The patch is against the recent Linus' tree.
> 
> There's another place where the revision ID register is read but as 16-bit
> entity (probably by mistake though), so I didn't convert it...

Where is that?

>  drivers/ssb/scan.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Index: linux-2.6/drivers/ssb/scan.c
> ===================================================================
> --- linux-2.6.orig/drivers/ssb/scan.c
> +++ linux-2.6/drivers/ssb/scan.c
> @@ -310,8 +310,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
>  	} else {
>  		if (bus->bustype == SSB_BUSTYPE_PCI) {
>  			bus->chip_id = pcidev_to_chipid(bus->host_pci);
> -			pci_read_config_byte(bus->host_pci, PCI_REVISION_ID,
> -					     &bus->chip_rev);
> +			bus->chip_rev = bus->host_pci->revision;
>  			bus->chip_package = 0;
>  		} else {
>  			bus->chip_id = 0x4710;
> 


^ permalink raw reply

* Re: [PATCH] ssb: use pci_dev->revision
From: Sergei Shtylyov @ 2011-06-23 15:11 UTC (permalink / raw)
  To: Michael Büsch; +Cc: Sergei Shtylyov, netdev
In-Reply-To: <20110623170908.1417f933@maggie>

Hello.

Michael Büsch wrote:

>> The bus scan code reads PCI revision ID from the PCI configuration register
>> while it's already stored by PCI subsystem in the 'revision' field of 'struct
>> pci_dev'...

>> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

>> ---
>> The patch is against the recent Linus' tree.

>> There's another place where the revision ID register is read but as 16-bit
>> entity (probably by mistake though), so I didn't convert it...

> Where is that?

    drivers/ssb/pci.c, line 741.

WBR, Sergei


^ permalink raw reply

* Re: unintended ipv4 broadcast policy change
From: Stephen Hemminger @ 2011-06-23 15:16 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev
In-Reply-To: <20110622.163935.2248705300315908767.davem@davemloft.net>

On Wed, 22 Jun 2011 16:39:35 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> But debian definitely still has this bug.  On debian, as a result,
> every packet received gets parsed.

Are you saying the DHCP client ends up parsing every packet?
This doesn't appear to be true.

I checked and the dhclient spends its life waiting on select for DHCP port.

^ permalink raw reply

* Re: [PATCH] ssb: use pci_dev->revision
From: Michael Büsch @ 2011-06-23 15:32 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Sergei Shtylyov, netdev
In-Reply-To: <4E0357BF.7000408@mvista.com>

On Thu, 23 Jun 2011 19:11:59 +0400
Sergei Shtylyov <sshtylyov@mvista.com> wrote:

> Hello.
> 
> Michael Büsch wrote:
> 
> >> The bus scan code reads PCI revision ID from the PCI configuration register
> >> while it's already stored by PCI subsystem in the 'revision' field of 'struct
> >> pci_dev'...
> 
> >> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> >> ---
> >> The patch is against the recent Linus' tree.
> 
> >> There's another place where the revision ID register is read but as 16-bit
> >> entity (probably by mistake though), so I didn't convert it...
> 
> > Where is that?
> 
>     drivers/ssb/pci.c, line 741.

Yes that probably is by mistake. Can you convert it as well, please?

^ permalink raw reply

* Re: [PATCH 1/2] iwlwifi: use pci_dev->revision, again
From: Guy, Wey-Yi @ 2011-06-23 15:02 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: netdev@vger.kernel.org, linville@tuxdriver.com,
	linux-wireless@vger.kernel.org, ilw@linux.intel.com
In-Reply-To: <201106231841.40691.sshtylyov@ru.mvista.com>

On Thu, 2011-06-23 at 07:41 -0700, Sergei Shtylyov wrote:
> Commit ff938e43d39e926de74b32a3656c190f979ab642 (net: use pci_dev->revision,
> again) already converted this driver to using the 'revision' field of 'struct
> pci_dev' but commit c2974a1d18832a9fffb2eb389c3878f5c4ed92f1 (iwlagn: remove
> rev_id) later reverted that change for no reason. Now restore the change...
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> ---
> The patch is against the recent Linus' tree.
> 
>  drivers/net/wireless/iwlwifi/iwl-agn.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6/drivers/net/wireless/iwlwifi/iwl-agn.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ linux-2.6/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -3275,10 +3275,9 @@ struct ieee80211_ops iwlagn_hw_ops = {
>  
>  static u32 iwl_hw_detect(struct iwl_priv *priv)
>  {
> -	u8 rev_id;
> +	IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n",
> +		       priv->pci_dev->revision);
>  
> -	pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id);
> -	IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id);
>  	return iwl_read32(priv, CSR_HW_REV);
>  }
>  
hmm, I believe it is merge sequence issue, the IWL_DEBUG_INFO line has
benn remove all together in later patch. the information is being log in
the calling function, no need to log in "iwl_hw_detect"

Wey



^ permalink raw reply

* Re: linux-next: Tree for June 23 (net)
From: Randy Dunlap @ 2011-06-23 16:14 UTC (permalink / raw)
  To: Stephen Rothwell, netdev; +Cc: linux-next, LKML
In-Reply-To: <20110623155431.6bfe3b40.sfr@canb.auug.org.au>

On Thu, 23 Jun 2011 15:54:31 +1000 Stephen Rothwell wrote:

> Hi all,
> 
> Changes since 20110622:
> 
> The powerpc allyesconfig (and probably others) is still broken because we
> now build the staging drivers and because of a commit in the net tree.
> The breakage in Linus' tree is fixed by one of Andrew's patches above.
> 
> The net tree gained 2 build failures that I have left (see above).


When CONFIG_INET is not enabled:

net/core/dev.c:2535: error: implicit declaration of function 'ip_is_fragment'


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* Re: linux-next: Tree for June 23 (net)
From: Randy Dunlap @ 2011-06-23 17:17 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Rothwell, linux-next, LKML
In-Reply-To: <20110623091429.2d51b0f0.randy.dunlap@oracle.com>

On Thu, 23 Jun 2011 09:14:29 -0700 Randy Dunlap wrote:

> On Thu, 23 Jun 2011 15:54:31 +1000 Stephen Rothwell wrote:
> 
> > Hi all,
> > 
> > Changes since 20110622:
> > 
> > The powerpc allyesconfig (and probably others) is still broken because we
> > now build the staging drivers and because of a commit in the net tree.
> > The breakage in Linus' tree is fixed by one of Andrew's patches above.
> > 
> > The net tree gained 2 build failures that I have left (see above).
> 
> 
> When CONFIG_INET is not enabled:
> 
> net/core/dev.c:2535: error: implicit declaration of function 'ip_is_fragment'

same problem in more places:

net/sched/sch_choke.c:184: error: implicit declaration of function 'ip_is_fragment'
net/sched/cls_rsvp.h:170: error: implicit declaration of function 'ip_is_fragment'
net/sched/cls_flow.c:124: error: implicit declaration of function 'ip_is_fragment'


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply

* [PATCH 20/35] drivers/net changes for SMBIOS and System Firmware
From: Prarit Bhargava @ 2011-06-23 17:24 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: Prarit Bhargava

drivers/net changes for SMBIOS and System Firmware

As part of the new SMBIOS and System Firmware code:

- Replace old dmi* structures and functions with new sysfw* and smbios*
structures and functions in individual drivers
- cleanup sysfw_id lookup tables
- cleanup of includes for dmi.h and mod_devicetable.h which were included in
some files that did not need them

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/net/skge.c                 |   11 ++++++-----
 drivers/net/via-rhine.c            |   18 ++++++++++--------
 drivers/net/wireless/wl1251/sdio.c |    1 -
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index f4be5c7..1200c53 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -43,7 +43,7 @@
 #include <linux/seq_file.h>
 #include <linux/mii.h>
 #include <linux/slab.h>
-#include <linux/dmi.h>
+#include <linux/sysfw.h>
 #include <linux/prefetch.h>
 #include <asm/irq.h>
 
@@ -4089,12 +4089,13 @@ static struct pci_driver skge_driver = {
 	.driver.pm =	SKGE_PM_OPS,
 };
 
-static struct dmi_system_id skge_32bit_dma_boards[] = {
+static struct sysfw_id skge_32bit_dma_boards[] = {
 	{
 		.ident = "Gigabyte nForce boards",
 		.matches = {
-			DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"),
-			DMI_MATCH(DMI_BOARD_NAME, "nForce"),
+			SYSFW_MATCH(SYSFW_BOARD_VENDOR,
+				     "Gigabyte Technology Co"),
+			SYSFW_MATCH(SYSFW_BOARD_NAME, "nForce"),
 		},
 	},
 	{}
@@ -4102,7 +4103,7 @@ static struct dmi_system_id skge_32bit_dma_boards[] = {
 
 static int __init skge_init_module(void)
 {
-	if (dmi_check_system(skge_32bit_dma_boards))
+	if (sysfw_callback(skge_32bit_dma_boards))
 		only_32bit_dma = 1;
 	skge_debug_init();
 	return pci_register_driver(&skge_driver);
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 7f23ab9..81725d5 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -110,7 +110,7 @@ static const int multicast_filter_limit = 32;
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
-#include <linux/dmi.h>
+#include <linux/sysfw.h>
 
 /* These identify the driver base version and may not be removed. */
 static const char version[] __devinitconst =
@@ -2294,22 +2294,24 @@ static struct pci_driver rhine_driver = {
 	.shutdown =	rhine_shutdown,
 };
 
-static struct dmi_system_id __initdata rhine_dmi_table[] = {
+static struct sysfw_id __initdata rhine_id_table[] = {
 	{
 		.ident = "EPIA-M",
 		.matches = {
-			DMI_MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."),
-			DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
+			SYSFW_MATCH(SYSFW_BIOS_VENDOR,
+				    "Award Software International, Inc."),
+			SYSFW_MATCH(SYSFW_BIOS_VERSION, "6.00 PG"),
 		},
 	},
 	{
 		.ident = "KV7",
 		.matches = {
-			DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
-			DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"),
+			SYSFW_MATCH(SYSFW_BIOS_VENDOR,
+				    "Phoenix Technologies, LTD"),
+			SYSFW_MATCH(SYSFW_BIOS_VERSION, "6.00 PG"),
 		},
 	},
-	{ NULL }
+	{}
 };
 
 static int __init rhine_init(void)
@@ -2318,7 +2320,7 @@ static int __init rhine_init(void)
 #ifdef MODULE
 	pr_info("%s\n", version);
 #endif
-	if (dmi_check_system(rhine_dmi_table)) {
+	if (sysfw_callback(rhine_id_table)) {
 		/* these BIOSes fail at PXE boot if chip is in D3 */
 		avoid_D3 = 1;
 		pr_warn("Broken BIOS detected, avoid_D3 enabled\n");
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
index f51a024..68e36d7 100644
--- a/drivers/net/wireless/wl1251/sdio.c
+++ b/drivers/net/wireless/wl1251/sdio.c
@@ -20,7 +20,6 @@
  * Copyright (C) 2009 Bob Copeland (me@bobcopeland.com)
  */
 #include <linux/module.h>
-#include <linux/mod_devicetable.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/platform_device.h>
-- 
1.7.5.4

^ permalink raw reply related

* Re: [RFT PATCH 0/9] Cleanup and extension of netdev features
From: Mahesh Bandewar @ 2011-06-23 17:42 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: netdev, David S. Miller, Ben Hutchings
In-Reply-To: <cover.1308596962.git.mirq-linux@rere.qmqm.pl>

On Mon, Jun 20, 2011 at 12:14 PM, Michał Mirosław
<mirq-linux@rere.qmqm.pl> wrote:
>
> This is a preview of the cleanups pending after getting rid of old
> ethtool ops from remaining drivers.
>
> Patches inside:
>  1. (placeholder for Intel patches)
>  2. removal of old ethtool ops
>        (most further patches depend on this one)
>  3. break association of ETH_FLAG_* with netdev features
>        this will allow to change the representation and access pattern
>        of the feature sets if later needed; as a bonus, the features
>        can be (almost) freely rearranged
>  4. introducing netdev_features_t
>        use new type wherever features are passed around (this needed
>        new include - otherwise linux/skbuff.h would need linux/netdevice.h)
>  5. cleanup of feature bits
>  6. cleanup of feature name table
>        (depends on #5)
>  7. prepare ethtool [GS]FEATURES for larger netdev_features_t
>  8. tadaaa: 64 bits for features
>  9. a lone cleanup patch for NOCACHE_COPY feature
>
> Bear in mind, that I only compile tested the whole series (x86 allyesconfig).
> I'll do per-patch builds after all needed patches are in net-next.
>
> Note about netdev_features_t: I don't like the idea of converting it to
> bitmap type and building wrappers around, so I won't even try to
> implement it. Nevertheless, this series will make the conversion easier
> if someone ever wants to go that way.
>
The idea is to make feature type (by defining netdev_feature_t)
opaque and should handle XX bit integer as well as bitmap types. So
netdev_feature_t typedef-ed to u64 is OK but changes that we make
should be able to handle bitmaps as well to minimize future changes.

--mahesh..

> Best Regards,
> Michał Mirosław
>
> ---
>
> Michał Mirosław (9):
>  [NOT SENT] Intel net drivers: convert to ndo_fix_features
>  net: remove legacy ethtool ops
>  net: ethtool: break association of ETH_FLAG_* with NETIF_F_*
>  net: introduce and use netdev_features_t for device features sets
>  net: Define enum for net device features.
>  net: ethtool: use C99 array initialization for feature-names table
>  ethtool: prepare for larger netdev_features_t type
>  net: extend netdev_features_t to 64 bits
>  net: move NOCACHE_COPY checks to netdev_fix_features()
>
>  drivers/net/8139cp.c                  |    2 +-
>  drivers/net/bnx2.c                    |    6 +-
>  drivers/net/bnx2x/bnx2x_cmn.c         |    5 +-
>  drivers/net/bnx2x/bnx2x_cmn.h         |    5 +-
>  drivers/net/bonding/bond_main.c       |    9 +-
>  drivers/net/cxgb4/cxgb4_main.c        |   12 +-
>  drivers/net/dm9000.c                  |    3 +-
>  drivers/net/e1000/e1000_ethtool.c     |   69 ----
>  drivers/net/e1000/e1000_main.c        |   31 ++-
>  drivers/net/e1000e/ethtool.c          |   88 -----
>  drivers/net/e1000e/netdev.c           |   35 ++-
>  drivers/net/forcedeth.c               |    7 +-
>  drivers/net/gianfar.h                 |    2 +-
>  drivers/net/gianfar_ethtool.c         |    4 +-
>  drivers/net/ibmveth.c                 |    6 +-
>  drivers/net/igb/igb_ethtool.c         |   67 ----
>  drivers/net/igb/igb_main.c            |   33 ++-
>  drivers/net/igbvf/ethtool.c           |   57 ----
>  drivers/net/igbvf/netdev.c            |   25 ++-
>  drivers/net/ixgb/ixgb.h               |    2 +
>  drivers/net/ixgb/ixgb_ethtool.c       |   98 +------
>  drivers/net/ixgb/ixgb_main.c          |   44 +++-
>  drivers/net/ixgbe/ixgbe_ethtool.c     |  183 ++++--------
>  drivers/net/ixgbe/ixgbe_main.c        |   42 ++-
>  drivers/net/ixgbevf/ethtool.c         |   46 ---
>  drivers/net/ixgbevf/ixgbevf_main.c    |   26 ++-
>  drivers/net/jme.c                     |    8 +-
>  drivers/net/ksz884x.c                 |    3 +-
>  drivers/net/mv643xx_eth.c             |    2 +-
>  drivers/net/myri10ge/myri10ge.c       |    2 +-
>  drivers/net/netxen/netxen_nic_main.c  |    6 +-
>  drivers/net/pch_gbe/pch_gbe_main.c    |    5 +-
>  drivers/net/qlcnic/qlcnic.h           |    5 +-
>  drivers/net/qlcnic/qlcnic_hw.c        |    9 +-
>  drivers/net/qlcnic/qlcnic_main.c      |    2 +-
>  drivers/net/r8169.c                   |    6 +-
>  drivers/net/s2io.c                    |    4 +-
>  drivers/net/sfc/efx.c                 |    2 +-
>  drivers/net/sky2.c                    |    5 +-
>  drivers/net/tg3.c                     |    7 +-
>  drivers/net/usb/smsc75xx.c            |    3 +-
>  drivers/net/usb/smsc95xx.c            |    3 +-
>  drivers/net/vmxnet3/vmxnet3_ethtool.c |    4 +-
>  drivers/net/vmxnet3/vmxnet3_int.h     |    2 +-
>  drivers/net/vxge/vxge-main.c          |    9 +-
>  drivers/net/xen-netfront.c            |    8 +-
>  drivers/s390/net/qeth_l3_main.c       |    6 +-
>  include/linux/ethtool.h               |   53 ---
>  include/linux/netdev_features.h       |  152 +++++++++
>  include/linux/netdevice.h             |  141 ++-------
>  include/linux/skbuff.h                |    4 +-
>  include/net/protocol.h                |    4 +-
>  include/net/tcp.h                     |    3 +-
>  include/net/udp.h                     |    3 +-
>  net/8021q/vlan_dev.c                  |    5 +-
>  net/bridge/br_if.c                    |    5 +-
>  net/core/dev.c                        |   71 ++--
>  net/core/ethtool.c                    |  563 ++++++--------------------------
>  net/core/net-sysfs.c                  |    3 +-
>  net/core/skbuff.c                     |    2 +-
>  net/ipv4/af_inet.c                    |    3 +-
>  net/ipv4/tcp.c                        |    2 +-
>  net/ipv4/udp.c                        |    3 +-
>  net/ipv6/af_inet6.c                   |    3 +-
>  net/ipv6/udp.c                        |    2 +-
>  65 files changed, 683 insertions(+), 1347 deletions(-)
>  create mode 100644 include/linux/netdev_features.h
>
> --
> 1.7.2.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t type
From: Mahesh Bandewar @ 2011-06-23 17:50 UTC (permalink / raw)
  To: Ben Hutchings, Michał Mirosław; +Cc: netdev, David S. Miller
In-Reply-To: <1308604618.2701.189.camel@bwh-desktop>

On Mon, Jun 20, 2011 at 2:16 PM, Ben Hutchings
<bhutchings@solarflare.com> wrote:
>
> On Mon, 2011-06-20 at 21:14 +0200, Michał Mirosław wrote:
> [...]
> > @@ -125,19 +131,26 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
> >       if (copy_from_user(features, useraddr, sizeof(features)))
> >               return -EFAULT;
> >
> > -     if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
> > +     /* I wonder if the compiler will be smart enough to loop-unroll
> > +      * and optimize this... (no worries if not) --mq */
> > +     for (i = ETHTOOL_DEV_FEATURE_WORDS; i-- > 0; ) {
> > +             valid = (valid << 32)|features[i].valid;
> > +             wanted = (wanted << 32)|features[i].requested;
> > +     }
> [...]
>
> I don't know (or care) about optimisation of this, but I would expect
> gcc to complain about shifting a 32-bit value by 32 bits.  I suggest you
> write this as:
>
>        for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
>                valid |= (netdev_features_t)features[i].valid << 32 *i;
>                wanted |= (netdev_features_t)features[i].requested << 32 *i;

It's a valid point but this type of typecast or similar usage would
imply that netdev_feature_t is an int of XXX bits. That's not opaque
and would hinder the way you can abstract the feature type.

--mahesh..
>
>        }
>
> Ben.
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t type
From: Ben Hutchings @ 2011-06-23 18:03 UTC (permalink / raw)
  To: Mahesh Bandewar; +Cc: Michał Mirosław, netdev, David S. Miller
In-Reply-To: <BANLkTi=RB1MSR=c6GhXr4bsrPtFJVZnaZ8ZLCN=o339S_BE7iw@mail.gmail.com>

On Thu, 2011-06-23 at 10:50 -0700, Mahesh Bandewar wrote:
> On Mon, Jun 20, 2011 at 2:16 PM, Ben Hutchings
> <bhutchings@solarflare.com> wrote:
> >
> > On Mon, 2011-06-20 at 21:14 +0200, Michał Mirosław wrote:
> > [...]
> > > @@ -125,19 +131,26 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
> > >       if (copy_from_user(features, useraddr, sizeof(features)))
> > >               return -EFAULT;
> > >
> > > -     if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
> > > +     /* I wonder if the compiler will be smart enough to loop-unroll
> > > +      * and optimize this... (no worries if not) --mq */
> > > +     for (i = ETHTOOL_DEV_FEATURE_WORDS; i-- > 0; ) {
> > > +             valid = (valid << 32)|features[i].valid;
> > > +             wanted = (wanted << 32)|features[i].requested;
> > > +     }
> > [...]
> >
> > I don't know (or care) about optimisation of this, but I would expect
> > gcc to complain about shifting a 32-bit value by 32 bits.  I suggest you
> > write this as:
> >
> >        for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
> >                valid |= (netdev_features_t)features[i].valid << 32 *i;
> >                wanted |= (netdev_features_t)features[i].requested << 32 *i;
> 
> It's a valid point but this type of typecast or similar usage would
> imply that netdev_feature_t is an int of XXX bits. That's not opaque
> and would hinder the way you can abstract the feature type.

Yes, ethtool_{get,set}_features() will have to be changed if and when
the representation of netdev_features_t is changed significantly.  I
don't think there's any way of avoiding that and I don't think it really
matters.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply

* Re: [PATCH 0/8] 8390: Neatening
From: Geert Uytterhoeven @ 2011-06-23 18:04 UTC (permalink / raw)
  To: Joe Perches; +Cc: netdev, linux-kernel
In-Reply-To: <cover.1308810463.git.joe@perches.com>

On Thu, Jun 23, 2011 at 08:38, Joe Perches <joe@perches.com> wrote:
> Some updates requested by Geert Uytterhoeven
>
> Joe Perches (8):
>  ariadne: Update style, neaten, restructure to eliminate prototypes
>  a2065: Use pr_fmt, pr_<level> and netdev_<level>
>  lib8390: Use pr_<level> and netdev_<level>
>  lib8390: Indent braces appropriately
>  lib8390: Normalize source code spacing
>  lib8390: Convert include <asm to include <linux
>  lib8390: Remove unnecessary extern
>  zorro8390: Restructure and eliminate prototypes

Looks good. I had to make some minor adjustments to make it apply to my
current tree, though.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* [net-2.6 PATCH 3/3] qlge:Version change to v1.00.00.29
From: Ron Mercer @ 2011-06-23 17:52 UTC (permalink / raw)
  To: davem; +Cc: netdev, ron.mercer, jitendra.kalsaria, ameen.rahman
In-Reply-To: <1308851544-25719-1-git-send-email-ron.mercer@qlogic.com>

From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/qlge/qlge.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index b2c8612..ca306fd 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -16,7 +16,7 @@
  */
 #define DRV_NAME  	"qlge"
 #define DRV_STRING 	"QLogic 10 Gigabit PCI-E Ethernet Driver "
-#define DRV_VERSION	"v1.00.00.27.00.00-01"
+#define DRV_VERSION	"v1.00.00.29.00.00-01"
 
 #define WQ_ADDR_ALIGN	0x3	/* 4 byte alignment */
 
-- 
1.6.0.2



^ permalink raw reply related

* [net-2.6 PATCH 2/3] qlge:Fix printk priority so chip fatal errors are always reported.
From: Ron Mercer @ 2011-06-23 17:52 UTC (permalink / raw)
  To: davem; +Cc: netdev, ron.mercer, jitendra.kalsaria, ameen.rahman
In-Reply-To: <1308851544-25719-1-git-send-email-ron.mercer@qlogic.com>

From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

Precedence of the printk should be at higher level so chip
	fatal errors are always reported.

Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/qlge/qlge_main.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 4fbefcf..66274ab 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -2170,7 +2170,7 @@ static void ql_process_chip_ae_intr(struct ql_adapter *qdev,
 		return;
 
 	case CAM_LOOKUP_ERR_EVENT:
-		netif_err(qdev, link, qdev->ndev,
+		netif_err(qdev, drv, qdev->ndev,
 			  "Multiple CAM hits lookup occurred.\n");
 		netif_err(qdev, drv, qdev->ndev,
 			  "This event shouldn't occur.\n");
@@ -2178,13 +2178,13 @@ static void ql_process_chip_ae_intr(struct ql_adapter *qdev,
 		return;
 
 	case SOFT_ECC_ERROR_EVENT:
-		netif_err(qdev, rx_err, qdev->ndev,
+		netif_err(qdev, drv, qdev->ndev,
 			  "Soft ECC error detected.\n");
 		ql_queue_asic_error(qdev);
 		break;
 
 	case PCI_ERR_ANON_BUF_RD:
-		netif_err(qdev, rx_err, qdev->ndev,
+		netif_err(qdev, drv, qdev->ndev,
 			  "PCI error occurred when reading anonymous buffers from rx_ring %d.\n",
 			  ib_ae_rsp->q_id);
 		ql_queue_asic_error(qdev);
@@ -2441,10 +2441,10 @@ static irqreturn_t qlge_isr(int irq, void *dev_id)
 	 */
 	if (var & STS_FE) {
 		ql_queue_asic_error(qdev);
-		netif_err(qdev, intr, qdev->ndev,
+		netif_err(qdev, drv, qdev->ndev,
 			  "Got fatal error, STS = %x.\n", var);
 		var = ql_read32(qdev, ERR_STS);
-		netif_err(qdev, intr, qdev->ndev,
+		netif_err(qdev, drv, qdev->ndev,
 			  "Resetting chip. Error Status Register = 0x%x\n", var);
 		return IRQ_HANDLED;
 	}
-- 
1.6.0.2



^ permalink raw reply related

* [net-2.6 PATCH 1/3] qlge:Fix crash caused by mailbox execution on wedged chip.
From: Ron Mercer @ 2011-06-23 17:52 UTC (permalink / raw)
  To: davem; +Cc: netdev, ron.mercer, jitendra.kalsaria, ameen.rahman

From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

When we are in a recover process from a chip fatal error,
	driver should skip over execution of mailbox commands during
	resetting chip.

Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
---
 drivers/net/qlge/qlge.h      |    1 +
 drivers/net/qlge/qlge_main.c |   20 +++++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index d328507..b2c8612 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -1996,6 +1996,7 @@ enum {
 	QL_LB_LINK_UP = 10,
 	QL_FRC_COREDUMP = 11,
 	QL_EEH_FATAL = 12,
+	QL_ASIC_RECOVERY = 14, /* We are in ascic recovery. */
 };
 
 /* link_status bit definitions */
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 930ae45..4fbefcf 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -2152,6 +2152,10 @@ void ql_queue_asic_error(struct ql_adapter *qdev)
 	 * thread
 	 */
 	clear_bit(QL_ADAPTER_UP, &qdev->flags);
+	/* Set asic recovery bit to indicate reset process that we are
+	 * in fatal error recovery process rather than normal close
+	 */
+	set_bit(QL_ASIC_RECOVERY, &qdev->flags);
 	queue_delayed_work(qdev->workqueue, &qdev->asic_reset_work, 0);
 }
 
@@ -3818,11 +3822,17 @@ static int ql_adapter_reset(struct ql_adapter *qdev)
 	end_jiffies = jiffies +
 		max((unsigned long)1, usecs_to_jiffies(30));
 
-	/* Stop management traffic. */
-	ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_STOP);
+	/* Check if bit is set then skip the mailbox command and
+	 * clear the bit, else we are in normal reset process.
+	 */
+	if (!test_bit(QL_ASIC_RECOVERY, &qdev->flags)) {
+		/* Stop management traffic. */
+		ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_STOP);
 
-	/* Wait for the NIC and MGMNT FIFOs to empty. */
-	ql_wait_fifo_empty(qdev);
+		/* Wait for the NIC and MGMNT FIFOs to empty. */
+		ql_wait_fifo_empty(qdev);
+	} else
+		clear_bit(QL_ASIC_RECOVERY, &qdev->flags);
 
 	ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR);
 
-- 
1.6.0.2



^ permalink raw reply related

* Re: linux-next: Tree for June 23 (net)
From: Mike Frysinger @ 2011-06-23 18:13 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Stephen Rothwell, netdev, linux-next, LKML
In-Reply-To: <20110623091429.2d51b0f0.randy.dunlap@oracle.com>

On Thu, Jun 23, 2011 at 12:14, Randy Dunlap wrote:
> On Thu, 23 Jun 2011 15:54:31 +1000 Stephen Rothwell wrote:
>> Hi all,
>>
>> Changes since 20110622:
>>
>> The powerpc allyesconfig (and probably others) is still broken because we
>> now build the staging drivers and because of a commit in the net tree.
>> The breakage in Linus' tree is fixed by one of Andrew's patches above.
>>
>> The net tree gained 2 build failures that I have left (see above).
>
>
> When CONFIG_INET is not enabled:
>
> net/core/dev.c:2535: error: implicit declaration of function 'ip_is_fragment'

i see this on two Blackfin defconfigs like CM-BF533
-mike

^ permalink raw reply

* Re: [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t type
From: Mahesh Bandewar @ 2011-06-23 18:21 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Michał Mirosław, netdev, David S. Miller
In-Reply-To: <1308852228.2712.5.camel@bwh-desktop>

On Thu, Jun 23, 2011 at 11:03 AM, Ben Hutchings
<bhutchings@solarflare.com> wrote:
> On Thu, 2011-06-23 at 10:50 -0700, Mahesh Bandewar wrote:
>> On Mon, Jun 20, 2011 at 2:16 PM, Ben Hutchings
>> <bhutchings@solarflare.com> wrote:
>> >
>> > On Mon, 2011-06-20 at 21:14 +0200, Michał Mirosław wrote:
>> > [...]
>> > > @@ -125,19 +131,26 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
>> > >       if (copy_from_user(features, useraddr, sizeof(features)))
>> > >               return -EFAULT;
>> > >
>> > > -     if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
>> > > +     /* I wonder if the compiler will be smart enough to loop-unroll
>> > > +      * and optimize this... (no worries if not) --mq */
>> > > +     for (i = ETHTOOL_DEV_FEATURE_WORDS; i-- > 0; ) {
>> > > +             valid = (valid << 32)|features[i].valid;
>> > > +             wanted = (wanted << 32)|features[i].requested;
>> > > +     }
>> > [...]
>> >
>> > I don't know (or care) about optimisation of this, but I would expect
>> > gcc to complain about shifting a 32-bit value by 32 bits.  I suggest you
>> > write this as:
>> >
>> >        for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
>> >                valid |= (netdev_features_t)features[i].valid << 32 *i;
>> >                wanted |= (netdev_features_t)features[i].requested << 32 *i;
>>
>> It's a valid point but this type of typecast or similar usage would
>> imply that netdev_feature_t is an int of XXX bits. That's not opaque
>> and would hinder the way you can abstract the feature type.
>
> Yes, ethtool_{get,set}_features() will have to be changed if and when
> the representation of netdev_features_t is changed significantly.  I
> don't think there's any way of avoiding that and I don't think it really
> matters.
>
Well, if you have a conversion routine that converts (whatever the)
netdev_type_t type is to the ethtool representation (array of u32 for
example). So the changes would have to be done in that conversion
routine only and not get/set_features() ethtool methods as such.

--mahesh..

> Ben.
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
>

^ permalink raw reply

* Re: [PATCH 1/3] serial/imx: add device tree support
From: Shawn Guo @ 2011-06-23 18:38 UTC (permalink / raw)
  To: Grant Likely
  Cc: patches, netdev, devicetree-discuss, Jason Liu, linux-kernel,
	Jeremy Kerr, Sascha Hauer, linux-arm-kernel, David Gibson
In-Reply-To: <BANLkTim4vunTm1176MRw3pqRZnunu4=9jg@mail.gmail.com>

On Tue, Jun 21, 2011 at 01:13:50PM -0600, Grant Likely wrote:
[...]
> >
> >  /**
> > + *     of_get_device_index - Get device index by looking up "aliases" node
> > + *     @np:    Pointer to device node that asks for device index
> > + *     @name:  The device alias without index number
> > + *
> > + *     Returns the device index if find it, else returns -ENODEV.
> > + */
> > +int of_get_device_index(struct device_node *np, const char *alias)
> > +{
> > +       struct device_node *aliases = of_find_node_by_name(NULL, "aliases");
> > +       struct property *prop;
> > +       char name[32];
> > +       int index = 0;
> > +
> > +       if (!aliases)
> > +               return -ENODEV;
> > +
> > +       while (1) {
> > +               snprintf(name, sizeof(name), "%s%d", alias, index);
> > +               prop = of_find_property(aliases, name, NULL);
> > +               if (!prop)
> > +                       return -ENODEV;
> > +               if (np == of_find_node_by_path(prop->value))
> > +                       break;
> > +               index++;
> > +       }
> 
> Rather than parsing the alias strings everytime, it would probably be
> better to preprocess all the properties in the aliases node and create
> a lookup table of alias->node references that can be walked quickly
> and trivially.
> 
> Also, when obtaining an enumeration for a device, you'll need to be
> careful about what number gets returned.  If the node doesn't match a
> given alias, but aliases do exist for other devices of like type, then
> you need to be careful not to assign a number already assigned to
> another device via an alias (this of course assumes the driver
> supports dynamics enumeration, which many drivers will).  It would be
> 

Grant, please take a look at the second shot below.  Please let me
know what you think.

diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index 7976932..f4a5c3c 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -18,6 +18,12 @@
 	compatible = "fsl,imx51-babbage", "fsl,imx51";
 	interrupt-parent = <&tzic>;
 
+	aliases {
+		serial0 = &uart0;
+		serial1 = &uart1;
+		serial2 = &uart2;
+	};
+
 	chosen {
 		bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
 	};
@@ -47,29 +53,29 @@
 			reg = <0x70000000 0x40000>;
 			ranges;
 
-			uart@7000c000 {
-				compatible = "fsl,imx51-uart", "fsl,imx-uart";
+			uart2: uart@7000c000 {
+				compatible = "fsl,imx51-uart", "fsl,imx21-uart";
 				reg = <0x7000c000 0x4000>;
 				interrupts = <33>;
 				id = <3>;
				fsl,has-rts-cts;
 			};
 		};
 
-		uart@73fbc000 {
-			compatible = "fsl,imx51-uart", "fsl,imx-uart";
+		uart0: uart@73fbc000 {
+			compatible = "fsl,imx51-uart", "fsl,imx21-uart";
 			reg = <0x73fbc000 0x4000>;
 			interrupts = <31>;
 			id = <1>;
			fsl,has-rts-cts;
 		};
 
-		uart@73fc0000 {
-			compatible = "fsl,imx51-uart", "fsl,imx-uart";
+		uart1: uart@73fc0000 {
+			compatible = "fsl,imx51-uart", "fsl,imx21-uart";
 			reg = <0x73fc0000 0x4000>;
 			interrupts = <32>;
 			id = <2>;
			fsl,has-rts-cts;
 		};
 	};
 
diff --git a/arch/arm/mach-mx5/imx51-dt.c b/arch/arm/mach-mx5/imx51-dt.c
index 8bfdb91..e6c7298 100644
--- a/arch/arm/mach-mx5/imx51-dt.c
+++ b/arch/arm/mach-mx5/imx51-dt.c
@@ -40,6 +40,8 @@ static const struct of_device_id tzic_of_match[] __initconst = {
 
 static void __init imx51_dt_init(void)
 {
+	of_scan_aliases();
+
 	irq_domain_generate_simple(tzic_of_match, MX51_TZIC_BASE_ADDR, 0);
 
 	of_platform_populate(NULL, of_default_bus_match_table,
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 632ebae..90349a2 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -17,12 +17,27 @@
  *      as published by the Free Software Foundation; either version
  *      2 of the License, or (at your option) any later version.
  */
+#include <linux/ctype.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/proc_fs.h>
 
+struct alias_devname {
+	char devname[32];
+	struct list_head link;
+	struct list_head head;
+};
+
+struct alias_devid {
+	int devid;
+	struct device_node *node;
+	struct list_head link;
+};
+
+static LIST_HEAD(aliases_lookup);
+
 struct device_node *allnodes;
 struct device_node *of_chosen;
 
@@ -922,3 +937,170 @@ out_unlock:
 }
 #endif /* defined(CONFIG_OF_DYNAMIC) */
 
+/*
+ * get_alias_dev_name_id - Get device name and id from alias name
+ *
+ * an:	The alias name passed in
+ * dn:	The pointer used to return device name
+ *
+ * Returns device id which should be the number at the end of alias
+ * name, otherwise returns -1.
+ */
+static int get_alias_name_id(char *an, char *dn)
+{
+	int len = strlen(an);
+	char *end = an + len;
+
+	while (isdigit(*--end))
+		len--;
+
+	end++;
+	strncpy(dn, an, len);
+	dn[len] = '\0';
+
+	return strlen(end) ? simple_strtol(end, NULL, 10) : -1;
+}
+
+/*
+ * get_an_available_devid - Get an available devid for the given devname
+ *
+ * adn:	The pointer to the given alias_devname
+ *
+ * Returns the available devid
+ */
+static int get_an_available_devid(struct alias_devname *adn)
+{
+	int devid = 0;
+	struct alias_devid *adi;
+
+	while (1) {
+		bool used = false;
+		list_for_each_entry(adi, &adn->head, link) {
+			if (adi->devid == devid) {
+				used = true;
+				break;
+			}
+		}
+
+		if (!used)
+			break;
+
+		devid++;
+	}
+
+	return devid;
+}
+
+/*
+ * of_scan_aliases - Scan all properties of aliases node and populate the
+ * 		     global lookup table with the device name and id info
+ *
+ * Returns the number of aliases properties found, or error code in error case.
+ */
+int of_scan_aliases(void)
+{
+	struct device_node *aliases = of_find_node_by_name(NULL, "aliases");
+	struct property *pp;
+	struct alias_devname *adn;
+	struct alias_devid *adi;
+	int ret = 0;
+
+	if (!aliases) {
+		ret = -ENODEV;
+		goto out;
+	}
+
+	for (pp = aliases->properties; pp != NULL; pp = pp->next) {
+		bool found = false;
+		char devname[32];
+		int devid = get_alias_name_id(pp->name, devname);
+
+		/* We do not want to proceed this sentinel one */
+		if (!strcmp(pp->name, "name") && !strcmp(pp->value, "aliases"))
+			break;
+
+		/* See if the devname already exists */
+		list_for_each_entry(adn, &aliases_lookup, link) {
+			if (!strcmp(adn->devname, devname)) {
+				found = true;
+				break;
+			}
+		}
+
+		/*
+		 * Create the entry for this devname if not found,
+		 * and add it into aliases_lookup
+		 */
+		if (!found) {
+			adn = kzalloc(sizeof(*adn), GFP_KERNEL);
+			if (!adn) {
+				ret = -ENOMEM;
+				goto out;
+			}
+
+			strcpy(adn->devname, devname);
+			INIT_LIST_HEAD(&adn->head);
+			list_add_tail(&adn->link, &aliases_lookup);
+		}
+
+		/*
+		 * Save the devid as one entry of the list for this
+		 * specified devname
+		 */
+		adi = kzalloc(sizeof(*adi), GFP_KERNEL);
+		if (!adi) {
+			ret = -ENOMEM;
+			goto out;
+		}
+
+		adi->devid = (devid == -1) ? get_an_available_devid(adn) :
+					     devid;
+		adi->node = of_find_node_by_path(pp->value);
+
+		list_add_tail(&adi->link, &adn->head);
+		ret++;
+	}
+
+out:
+	return ret;
+}
+
+/**
+ *	of_get_device_id - Get device id by looking up "aliases" node
+ *	@np:	Pointer to device node that asks for device id
+ *	@name:	The device alias name
+ *
+ *	Returns the device id if find it, else returns -ENODEV.
+ */
+int of_get_device_id(struct device_node *np, const char *name)
+{
+	struct alias_devname *adn;
+	struct alias_devid *adi;
+	bool found = false;
+	int ret;
+
+	list_for_each_entry(adn, &aliases_lookup, link) {
+		if (!strcmp(adn->devname, name)) {
+			found = true;
+			break;
+		}
+	}
+
+	if (!found) {
+		ret = -ENODEV;
+		goto out;
+	}
+
+	found = false;
+	list_for_each_entry(adi, &adn->head, link) {
+		if (np == adi->node) {
+			found = true;
+			break;
+		}
+	}
+
+	ret = found ? adi->devid : -ENODEV;
+out:
+	return ret;
+}
+EXPORT_SYMBOL(of_get_device_id);
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 2769353..062639e 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1225,43 +1265,33 @@ static int serial_imx_resume(struct platform_device *dev)
 	return 0;
 }
 
 static int serial_imx_probe_dt(struct imx_port *sport,
 		struct platform_device *pdev)
 {
 	struct device_node *node = pdev->dev.of_node;
-	const __be32 *line;
+	int line;
 
 	if (!node)
 		return -ENODEV;
 
-	line = of_get_property(node, "id", NULL);
-	if (!line)
+	line = of_get_device_id(node, "serial");
+	if (IS_ERR_VALUE(line))
 		return -ENODEV;
 
-	sport->port.line = be32_to_cpup(line) - 1;
+	sport->port.line = line;
 
diff --git a/include/linux/of.h b/include/linux/of.h
index bfc0ed1..270c671 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -213,6 +213,9 @@ extern int of_parse_phandles_with_args(struct device_node *np,
 	const char *list_name, const char *cells_name, int index,
 	struct device_node **out_node, const void **out_args);
 
+extern int of_scan_aliases(void);
+extern int of_get_device_id(struct device_node *np, const char *name);
+
 extern int of_machine_is_compatible(const char *compat);
 
 extern int prom_add_property(struct device_node* np, struct property* prop);

-- 
Regards,
Shawn

^ permalink raw reply related

* Re: [net-2.6 PATCH 2/3] qlge:Fix printk priority so chip fatal errors are always reported.
From: Joe Perches @ 2011-06-23 18:50 UTC (permalink / raw)
  To: Ron Mercer; +Cc: davem, netdev, jitendra.kalsaria, ameen.rahman
In-Reply-To: <1308851544-25719-2-git-send-email-ron.mercer@qlogic.com>

On Thu, 2011-06-23 at 10:52 -0700, Ron Mercer wrote:
> From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
> Precedence of the printk should be at higher level so chip
> 	fatal errors are always reported.

You probably want to use netdev_err then, not a masked
netif_err when it is optionally not reported.

> diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
[]
> @@ -2170,7 +2170,7 @@ static void ql_process_chip_ae_intr(struct ql_adapter *qdev,
>  		return;
>  
>  	case CAM_LOOKUP_ERR_EVENT:
> -		netif_err(qdev, link, qdev->ndev,
> +		netif_err(qdev, drv, qdev->ndev,
>  			  "Multiple CAM hits lookup occurred.\n");

		netdev_err(qdev->ndev, "Multiple CAM hits lookup occurred\n");

> @@ -2178,13 +2178,13 @@ static void ql_process_chip_ae_intr(struct ql_adapter *qdev,
>  		return;
>  
>  	case SOFT_ECC_ERROR_EVENT:
> -		netif_err(qdev, rx_err, qdev->ndev,
> +		netif_err(qdev, drv, qdev->ndev,
>  			  "Soft ECC error detected.\n");

		netdev_err(qdev->ndev, "Soft ECC error detected\n");

etc...



^ permalink raw reply

* Re: [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t type
From: Ben Hutchings @ 2011-06-23 18:55 UTC (permalink / raw)
  To: Mahesh Bandewar; +Cc: Michał Mirosław, netdev, David S. Miller
In-Reply-To: <BANLkTikTquu8jr7U-8s=8kQcqT86Ji1MqnSKug+3zQdgsVKxKA@mail.gmail.com>

On Thu, 2011-06-23 at 11:21 -0700, Mahesh Bandewar wrote:
> On Thu, Jun 23, 2011 at 11:03 AM, Ben Hutchings
> <bhutchings@solarflare.com> wrote:
> > On Thu, 2011-06-23 at 10:50 -0700, Mahesh Bandewar wrote:
> >> On Mon, Jun 20, 2011 at 2:16 PM, Ben Hutchings
> >> <bhutchings@solarflare.com> wrote:
> >> >
> >> > On Mon, 2011-06-20 at 21:14 +0200, Michał Mirosław wrote:
> >> > [...]
> >> > > @@ -125,19 +131,26 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
> >> > >       if (copy_from_user(features, useraddr, sizeof(features)))
> >> > >               return -EFAULT;
> >> > >
> >> > > -     if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
> >> > > +     /* I wonder if the compiler will be smart enough to loop-unroll
> >> > > +      * and optimize this... (no worries if not) --mq */
> >> > > +     for (i = ETHTOOL_DEV_FEATURE_WORDS; i-- > 0; ) {
> >> > > +             valid = (valid << 32)|features[i].valid;
> >> > > +             wanted = (wanted << 32)|features[i].requested;
> >> > > +     }
> >> > [...]
> >> >
> >> > I don't know (or care) about optimisation of this, but I would expect
> >> > gcc to complain about shifting a 32-bit value by 32 bits.  I suggest you
> >> > write this as:
> >> >
> >> >        for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
> >> >                valid |= (netdev_features_t)features[i].valid << 32 *i;
> >> >                wanted |= (netdev_features_t)features[i].requested << 32 *i;
> >>
> >> It's a valid point but this type of typecast or similar usage would
> >> imply that netdev_feature_t is an int of XXX bits. That's not opaque
> >> and would hinder the way you can abstract the feature type.
> >
> > Yes, ethtool_{get,set}_features() will have to be changed if and when
> > the representation of netdev_features_t is changed significantly.  I
> > don't think there's any way of avoiding that and I don't think it really
> > matters.
> >
> Well, if you have a conversion routine that converts (whatever the)
> netdev_type_t type is to the ethtool representation (array of u32 for
> example). So the changes would have to be done in that conversion
> routine only and not get/set_features() ethtool methods as such.

These are precisely those conversion routines, because there is no other
place that needs to deal with the ethtool representation...

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox