From: Danny Kukawka <hidden> Date: 2012-02-24 13:46:47
Print MAC/dev_addr via printk extended format specifier %pm/%pM
instead of using custom code.
These patches are against net-next.
Danny Kukawka (11):
arch/ia64/hp/sim/simeth.c: print MAC via printk format specifier
amd/hplance.c: print MAC via printk format specifier
cirrus/mac89x0: print MAC via printk format specifier
dec/tulip/de4x5: print MAC via printk format specifier
ixgbevf: print MAC via printk format specifier
sun/sunqe: print MAC via printk format specifier
xscale/ixp2000/ixpdev: print MAC via printk format specifier
usb/cdc_ncm: print MAC via printk format specifier
usb/kaweth: print MAC via printk format specifier
Staging: ft1000-pcmcia: print MAC via printk format specifier
Staging: wlags49_h2: print MAC via printk format specifier
arch/ia64/hp/sim/simeth.c | 10 +++-------
drivers/net/ethernet/amd/hplance.c | 10 ++--------
drivers/net/ethernet/cirrus/mac89x0.c | 12 ++++++++----
drivers/net/ethernet/dec/tulip/de4x5.c | 6 +-----
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 8 +-------
drivers/net/ethernet/sun/sunqe.c | 10 ++--------
drivers/net/ethernet/xscale/ixp2000/ixpdev.c | 7 ++-----
drivers/net/usb/cdc_ncm.c | 6 +-----
drivers/net/usb/kaweth.c | 8 +-------
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 7 ++-----
drivers/staging/wlags49_h2/wl_cs.c | 7 ++-----
11 files changed, 25 insertions(+), 66 deletions(-)
--
1.7.8.3
@@ -3462,13 +3462,7 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,ixgbevf_init_last_counter_stats(adapter);/* print the MAC address */-hw_dbg(hw,"%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",-netdev->dev_addr[0],-netdev->dev_addr[1],-netdev->dev_addr[2],-netdev->dev_addr[3],-netdev->dev_addr[4],-netdev->dev_addr[5]);+hw_dbg(hw,"%pM\n",netdev->dev_addr);hw_dbg(hw,"MAC: %d\n",hw->mac.type);
--
1.7.8.3
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
From: Danny Kukawka <hidden> Date: 2012-02-24 13:47:18
Print MAC/dev_addr via printk extended format specifier %pM instead
of custom code.
Use memcpy to set the address to dev->dev_addr in set_mac_address,
instead of mxing it up in a for loop with printing a debug msg.
Check also if the given address is valid.
Signed-off-by: Danny Kukawka <redacted>
---
drivers/net/ethernet/cirrus/mac89x0.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
@@ -592,10 +592,14 @@ static void set_multicast_list(struct net_device *dev)staticintset_mac_address(structnet_device*dev,void*addr){inti;-printk("%s: Setting MAC address to ",dev->name);-for(i=0;i<6;i++)-printk(" %2.2x",dev->dev_addr[i]=((unsignedchar*)addr)[i]);-printk(".\n");+structsockaddr*saddr=addr;++if(!is_valid_ether_addr(addr->sa_data))+return-EADDRNOTAVAIL;++memcpy(dev->dev_addr,addr->sa_data,ETH_ALEN);+printk("%s: Setting MAC address to %pM\n",dev->name,dev->dev_addr);+/* set the Ethernet address */for(i=0;i<ETH_ALEN/2;i++)writereg(dev,PP_IA+i*2,dev->dev_addr[i*2]|(dev->dev_addr[i*2+1]<<8));
From: David Miller <davem@davemloft.net> Date: 2012-02-24 20:46:18
From: Danny Kukawka <redacted>
Date: Fri, 24 Feb 2012 14:45:51 +0100
Print MAC/dev_addr via printk extended format specifier %pm/%pM
instead of using custom code.
These patches are against net-next.
All applied, but you absolutely have to start posting patch series
correctly.
If it's a series for net-next, then every single patch must be
CC:'d to netdev so it gets queued up properly in patchwork.
On Fri, Feb 24, 2012 at 14:45, Danny Kukawka [off-list ref] wrote:
Print MAC/dev_addr via printk extended format specifier %pM instead
of custom code.
Use memcpy to set the address to dev->dev_addr in set_mac_address,
instead of mxing it up in a for loop with printing a debug msg.
Check also if the given address is valid.
static int set_mac_address(struct net_device *dev, void *addr)
{
int i;
- printk("%s: Setting MAC address to ", dev->name);
- for (i = 0; i < 6; i++)
- printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]);
- printk(".\n");
+ struct sockaddr *saddr = addr;
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EADDRNOTAVAIL;
+
+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ printk("%s: Setting MAC address to %pM\n", dev->name, dev->dev_addr);
+
/* set the Ethernet address */
for (i=0; i < ETH_ALEN/2; i++)
writereg(dev, PP_IA+i*2, dev->dev_addr[i*2] | (dev->dev_addr[i*2+1] << 8));
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
On Sat, Feb 25, 2012 at 11:15, Geert Uytterhoeven [off-list ref] wrote:
On Fri, Feb 24, 2012 at 14:45, Danny Kukawka [off-list ref] wrote:
quoted
Print MAC/dev_addr via printk extended format specifier %pM instead
of custom code.
Use memcpy to set the address to dev->dev_addr in set_mac_address,
instead of mxing it up in a for loop with printing a debug msg.
Check also if the given address is valid.
Why do you sneak in this check in this patch?
And it doesn't compile:
http://kisskb.ellerman.id.au/kisskb/buildresult/5752157/
drivers/net/ethernet/cirrus/mac89x0.c: In function ‘set_mac_address’:
drivers/net/ethernet/cirrus/mac89x0.c:597: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:597: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:600: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:600: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:595: warning: unused variable ‘saddr’
No patch included as I don't think this should have been applied as-is.
static int set_mac_address(struct net_device *dev, void *addr)
{
int i;
- printk("%s: Setting MAC address to ", dev->name);
- for (i = 0; i < 6; i++)
- printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]);
- printk(".\n");
+ struct sockaddr *saddr = addr;
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EADDRNOTAVAIL;
+
+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ printk("%s: Setting MAC address to %pM\n", dev->name, dev->dev_addr);
+
/* set the Ethernet address */
for (i=0; i < ETH_ALEN/2; i++)
writereg(dev, PP_IA+i*2, dev->dev_addr[i*2] | (dev->dev_addr[i*2+1] << 8));
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
drivers/net/ethernet/cirrus/mac89x0.c: In function ‘set_mac_address’:
drivers/net/ethernet/cirrus/mac89x0.c:597: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:597: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:600: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:600: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:595: warning: unused variable ‘saddr’
Thanks, I've fixed this as follows and pushed to net-next:
--------------------
mac89x0: Fix build error.
Need to use the new 'saddr' variable not the void 'addr' in
set_mac_address().
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/ethernet/cirrus/mac89x0.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
@@ -591,13 +591,13 @@ static void set_multicast_list(struct net_device *dev)staticintset_mac_address(structnet_device*dev,void*addr){-inti;structsockaddr*saddr=addr;+inti;-if(!is_valid_ether_addr(addr->sa_data))+if(!is_valid_ether_addr(saddr->sa_data))return-EADDRNOTAVAIL;-memcpy(dev->dev_addr,addr->sa_data,ETH_ALEN);+memcpy(dev->dev_addr,saddr->sa_data,ETH_ALEN);printk("%s: Setting MAC address to %pM\n",dev->name,dev->dev_addr);/* set the Ethernet address */
drivers/net/ethernet/cirrus/mac89x0.c: In function ‘set_mac_address’:
drivers/net/ethernet/cirrus/mac89x0.c:597: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:597: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:600: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:600: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:595: warning: unused variable ‘saddr’
Thanks, I've fixed this as follows and pushed to net-next:
--------------------
mac89x0: Fix build error.
Need to use the new 'saddr' variable not the void 'addr' in
set_mac_address().
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Thanks, that fixed the build.
What about the is_valid_ether_addr() check?
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
drivers/net/ethernet/cirrus/mac89x0.c: In function ‘set_mac_address’:
drivers/net/ethernet/cirrus/mac89x0.c:597: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:597: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:600: warning: dereferencing
‘void *’ pointer
drivers/net/ethernet/cirrus/mac89x0.c:600: error: request for member
‘sa_data’ in something not a structure or union
drivers/net/ethernet/cirrus/mac89x0.c:595: warning: unused variable
‘saddr’
Thanks, I've fixed this as follows and pushed to net-next:
--------------------
mac89x0: Fix build error.
Need to use the new 'saddr' variable not the void 'addr' in
set_mac_address().
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Thanks for the fix!
Thanks, that fixed the build.
What about the is_valid_ether_addr() check?
If you mean the discussion about checking if the MAC is valid in
.ndo_set_mac_address, I'm on that issue and will hopefully send a patch soon.
Danny