Re: [PATCH v3] ibmveth: Add function to enable live MAC address changes

2015-03-03 Thread Jiri Pirko
Mon, Mar 02, 2015 at 06:56:12PM CET, tlfal...@linux.vnet.ibm.com wrote:
Add a function that will enable changing the MAC address
of an ibmveth interface while it is still running.

Signed-off-by: Thomas Falcon tlfal...@linux.vnet.ibm.com

Reviewed-by: Jiri Pirko j...@resnulli.us
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCHi v2] ibmveth: Add function to enable live MAC address changes

2015-02-28 Thread Jiri Pirko
Sat, Feb 28, 2015 at 06:56:04AM CET, tlfal...@linux.vnet.ibm.com wrote:
Add a function that will enable changing the MAC address
of an ibmveth interface while it is still running.

Signed-off-by: Thomas Falcon tlfal...@linux.vnet.ibm.com
---
v2:
   If h_change_logical_lan_mac fails, dev-dev_addr will not be changed.

 drivers/net/ethernet/ibm/ibmveth.c | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c 
b/drivers/net/ethernet/ibm/ibmveth.c
index 21978cc..b6ac676 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1327,6 +1327,29 @@ static unsigned long ibmveth_get_desired_dma(struct 
vio_dev *vdev)
   return ret;
 }
 
+static int ibmveth_set_mac_addr(struct net_device *dev, void *p)
+{
+  struct ibmveth_adapter *adapter = netdev_priv(dev);
+  struct sockaddr *addr = p;
+  u64 mac_address;
+  int rc;
+
+  if (!is_valid_ether_addr(addr-sa_data))
+  return -EADDRNOTAVAIL;
+
+  mac_address = ibmveth_encode_mac_addr(addr-sa_data);
+  rc = h_change_logical_lan_mac(adapter-vdev-unit_address, mac_address);
+  if (rc) {
+  netdev_err(adapter-netdev, h_change_logical_lan_mac failed 
+ with rc=%d\n, rc);

Please do not wrap text in message. For that, 80-char limit does not apply.


+  return rc;
+  }
+
+  ether_addr_copy(dev-dev_addr, addr-sa_data);
+
+  return 0;
+}
+
 static const struct net_device_ops ibmveth_netdev_ops = {
   .ndo_open   = ibmveth_open,
   .ndo_stop   = ibmveth_close,
@@ -1337,7 +1360,7 @@ static const struct net_device_ops ibmveth_netdev_ops = {
   .ndo_fix_features   = ibmveth_fix_features,
   .ndo_set_features   = ibmveth_set_features,
   .ndo_validate_addr  = eth_validate_addr,
-  .ndo_set_mac_address= eth_mac_addr,
+  .ndo_set_mac_address= ibmveth_set_mac_addr,
 #ifdef CONFIG_NET_POLL_CONTROLLER
   .ndo_poll_controller= ibmveth_poll_controller,
 #endif
-- 
1.8.3.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] ibmveth: Add function to enable live MAC address changes

2015-02-26 Thread Jiri Pirko
Thu, Feb 26, 2015 at 02:08:06PM CET, brk...@linux.vnet.ibm.com wrote:
On 02/25/2015 06:34 PM, Thomas Falcon wrote:
 @@ -1327,6 +1327,24 @@ static unsigned long ibmveth_get_desired_dma(struct 
 vio_dev *vdev)
  return ret;
  }
 
 +static int ibmveth_set_mac_addr(struct net_device *dev, void *p)
 +{
 +struct ibmveth_adapter *adapter = netdev_priv(dev);
 +struct sockaddr *addr = p;
 +u64 mac_address;
 +int rc;
 +
 +if (!is_valid_ether_addr(addr-sa_data))
 +return -EADDRNOTAVAIL;
 +
 +ether_addr_copy(dev-dev_addr, addr-sa_data);
 +
 +mac_address = ibmveth_encode_mac_addr(dev-dev_addr);
 +rc = h_change_logical_lan_mac(adapter-vdev-unit_address, mac_address);
 +
 +return rc;

Do you still want to be changing dev-dev_addr if h_change_logical_lan_mac
returns a failure?

That should not be done. dev_addr should be in sync with real hw addr.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PowerPC] Next May 8 boot failure: OOPS during ibmveth moduleinit

2009-05-12 Thread Jiri Pirko
Tue, May 12, 2009 at 09:44:51AM CEST, s...@canb.auug.org.au wrote:
Hi Dave,

This fixes it (I wonder if this bug is lurking in any other drivers):
Grepping the sources I see some other places suffering this problem. I'll send
patch for this.

From: Stephen Rothwell s...@canb.auug.org.au
Date: Tue, 12 May 2009 17:24:02 +1000
Subject: [PATCH] net/ibmveth: fix panic in probe

netdev-dev_addr changed from being an array to being a pointer, so we
should not take its address for memcpy().
Nice!
Signed-off-by: Jiri Pirko jpi...@redhat.com

Signed-off-by: Stephen Rothwell s...@canb.auug.org.au
---
 drivers/net/ibmveth.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 7902e5e..8daffad 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1285,7 +1285,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, 
const struct vio_device_
   netdev-features |= NETIF_F_LLTX;
   spin_lock_init(adapter-stats_lock);
 
-  memcpy(netdev-dev_addr, adapter-mac_addr, netdev-addr_len);
+  memcpy(netdev-dev_addr, adapter-mac_addr, netdev-addr_len);
 
   for(i = 0; iIbmVethNumBufferPools; i++) {
   struct kobject *kobj = adapter-rx_buff_pool[i].kobj;
-- 
1.6.3


-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PowerPC] Next May 8 boot failure: OOPS during ibmveth module init

2009-05-08 Thread Jiri Pirko
Fri, May 08, 2009 at 09:57:22PM CEST, da...@davemloft.net wrote:
From: Sachin Sant sach...@in.ibm.com
Date: Fri, 08 May 2009 18:22:48 +0530

 Todays Next failed to boot on a Power6 JS22 blade with following oops.

Jiri, I suspect this might be your address list changes.

Although that's just a guess.  But please take a look.

Hmm, only thing I see might cause the problem would be if calling __hw_addr_add
in dev_addr_init fails, then dev-dev_addr would contain zeroes (which looks
this is not the case). But in this case the oops would appear earlier (in
ibmveth_probe dev_addr memcpy).

Will do the patch which checks the result to behave correctly in case of oom
but this imho this wouldn't help. Strange, I will dig into this more tomorrow.


 Unable to handle kernel paging request for data at address
 0x654af306c04b990
 Faulting instruction address: 0xc003a740
 Oops: Kernel access of bad area, sig: 11 [#1]
 SMP NR_CPUS=1024 NUMA pSeries
 Modules linked in: ibmveth(+) sg sd_mod crc_t10dif ibmvscsic
 scsi_transport_srp scsi_tgt scsi_mod
 NIP: c003a740 LR: c0361e20 CTR: 
 REGS: c00042af6e80 TRAP: 0300 Not tainted
 (2.6.30-rc4-next-20090508)
 MSR: 80009032 EE,ME,IR,DR  CR: 2886  XER: 2001
 DAR: 0654af306c04b990, DSISR: 4000
 TASK = c000428084d0[590] 'modprobe' THREAD: c00042af4000 CPU:
 0
 GPR00: c0361e10 c00042af7100 c0eb8190
 c0004427cc80
 GPR04: 0654af306c04b990 0006 
 0002
 GPR08: c0004427cc00 0088 0280
 007c
 GPR12: 8484 c0f92400 
 
 GPR16:   d0ed4346
 d0ed3aa0
 GPR20: d0ed6358 c0004427cc00 
 
 GPR24:  c000402d 0010
 c0004194b400
 GPR28: 0006 0654af306c04b990 c0e44f18
 
 NIP [c003a740] .memcpy+0x240/0x278
 LR [c0361e20] .__nla_put+0x30/0x4c
 Call Trace:
 [c00042af7100] [c0361e10] .__nla_put+0x20/0x4c
 (unreliable)
 [c00042af7190] [c0361e88] .nla_put+0x4c/0x60
 [c00042af7200] [c053993c] .rtnl_fill_ifinfo+0x308/0x614
 [c00042af7300] [c053a118] .rtmsg_ifinfo+0x104/0x198
 [c00042af73b0] [c053a244] .rtnetlink_event+0x98/0xb0
 [c00042af7430] [c05c8330] .notifier_call_chain+0x68/0xdc
 [c00042af74d0] [c0530488] .register_netdevice+0x390/0x418
 [c00042af75a0] [c0530568] .register_netdev+0x58/0x80
 [c00042af7630] [d0ed2da4] .ibmveth_probe+0x2c8/0x3a4
 [ibmveth]
 [c00042af7730] [c0023208] .vio_bus_probe+0x2f0/0x358
 [c00042af77f0] [c0462be0] .driver_probe_device+0xd4/0x1bc
 [c00042af7890] [c0462d5c] .__driver_attach+0x94/0xd8
 [c00042af7920] [c0462164] .bus_for_each_dev+0x80/0xe8
 [c00042af79d0] [c04629b0] .driver_attach+0x28/0x40
 [c00042af7a50] [c0461808] .bus_add_driver+0xdc/0x27c
 [c00042af7af0] [c04631d0] .driver_register+0xf0/0x1b0
 [c00042af7b90] [c0025178] .vio_register_driver+0x44/0x60
 [c00042af7c20] [d0ed2ed4] .ibmveth_module_init+0x54/0xa60
 [ibmveth]
 [c00042af7ca0] [c00092c0] .do_one_initcall+0x80/0x19c
 [c00042af7d90] [c00bf884] .SyS_init_module+0xe0/0x248
 [c00042af7e30] [c0008534] syscall_exit+0x0/0x40
 Instruction dump:
 7cb01120 7c862214 7c661a14 4bfffe04 409c001c 8004 81240004
 38840008
 9003 91230004 38630008 409d0014 8004 38840004 9003
 38630004
 ---[ end trace 695e9dc0c5a9da2f ]---
 
 udevd-event[587]: '/sbin/modprobe' abnormal exit
 
 Unable to handle kernel paging request for data at address
 0x654af306c04b990
 Faulting instruction address: 0xc0543ce0
 Oops: Kernel access of bad area, sig: 11 [#2]
 SMP NR_CPUS=1024 NUMA pSeries
 Modules linked in: ibmveth(+) sg sd_mod crc_t10dif ibmvscsic
 scsi_transport_srp scsi_tgt scsi_mod
 NIP: c0543ce0 LR: c0543dcc CTR: c053dd98
 REGS: c000408b3740 TRAP: 0300 Tainted: G D
 (2.6.30-rc4-next-20090508)
 MSR: 80009032 EE,ME,IR,DR  CR: 24042428  XER: 0001
 DAR: 0654af306c04b990, DSISR: 4000
 TASK = c0004053d880[752] 'udevd' THREAD: c000408b CPU: 3
 GPR00: c0543dcc c000408b39c0 c0eb8190
 c000448e
 GPR04: 0001 c0796dec 0006
 
 GPR08: c0004265cf34 c0ea7250 c0004265cf34
 
 GPR12: 44042488 c0f92a00 0001
 0001
 GPR16: 100372dc 100374e0 100376f8
 
 GPR20: 10036ec8  0fffdb3a6618
 0200
 GPR24: 0006 0005 c000448f
 c000448e
 GPR28: 0654af306c04b990