netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] ibmveth: Convert multicast list size for little-endian system
@ 2019-08-12 21:13 Thomas Falcon
  2019-08-14  2:43 ` Jakub Kicinski
  2019-08-14  3:35 ` Hangbin Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Falcon @ 2019-08-12 21:13 UTC (permalink / raw)
  To: netdev; +Cc: liuhangbin, davem, joe, Thomas Falcon

The ibm,mac-address-filters property defines the maximum number of
addresses the hypervisor's multicast filter list can support. It is
encoded as a big-endian integer in the OF device tree, but the virtual
ethernet driver does not convert it for use by little-endian systems.
As a result, the driver is not behaving as it should on affected systems
when a large number of multicast addresses are assigned to the device.

Reported-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
---
v2: define filter size pointer as __be32 instead of unsigned int,
    suggested by Joe Perches
---
 drivers/net/ethernet/ibm/ibmveth.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 77af9c2c0571..5641c00d34f2 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1643,7 +1643,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 	struct net_device *netdev;
 	struct ibmveth_adapter *adapter;
 	unsigned char *mac_addr_p;
-	unsigned int *mcastFilterSize_p;
+	__be32 *mcastFilterSize_p;
 	long ret;
 	unsigned long ret_attr;
 
@@ -1665,8 +1665,9 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 		return -EINVAL;
 	}
 
-	mcastFilterSize_p = (unsigned int *)vio_get_attribute(dev,
-						VETH_MCAST_FILTER_SIZE, NULL);
+	mcastFilterSize_p = (__be32 *)vio_get_attribute(dev,
+							VETH_MCAST_FILTER_SIZE,
+							NULL);
 	if (!mcastFilterSize_p) {
 		dev_err(&dev->dev, "Can't find VETH_MCAST_FILTER_SIZE "
 			"attribute\n");
@@ -1683,7 +1684,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 
 	adapter->vdev = dev;
 	adapter->netdev = netdev;
-	adapter->mcastFilterSize = *mcastFilterSize_p;
+	adapter->mcastFilterSize = be32_to_cpu(*mcastFilterSize_p);
 	adapter->pool_config = 0;
 	ibmveth_init_link_settings(adapter);
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2] ibmveth: Convert multicast list size for little-endian system
  2019-08-12 21:13 [PATCH net v2] ibmveth: Convert multicast list size for little-endian system Thomas Falcon
@ 2019-08-14  2:43 ` Jakub Kicinski
  2019-08-14 15:41   ` Thomas Falcon
  2019-08-14  3:35 ` Hangbin Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2019-08-14  2:43 UTC (permalink / raw)
  To: Thomas Falcon; +Cc: netdev, liuhangbin, davem, joe

On Mon, 12 Aug 2019 16:13:06 -0500, Thomas Falcon wrote:
> The ibm,mac-address-filters property defines the maximum number of
> addresses the hypervisor's multicast filter list can support. It is
> encoded as a big-endian integer in the OF device tree, but the virtual
> ethernet driver does not convert it for use by little-endian systems.
> As a result, the driver is not behaving as it should on affected systems
> when a large number of multicast addresses are assigned to the device.
> 
> Reported-by: Hangbin Liu <liuhangbin@gmail.com>
> Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>

Okay, applied, but:

> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 77af9c2c0571..5641c00d34f2 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1643,7 +1643,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
>  	struct net_device *netdev;
>  	struct ibmveth_adapter *adapter;
>  	unsigned char *mac_addr_p;
> -	unsigned int *mcastFilterSize_p;
> +	__be32 *mcastFilterSize_p;
>  	long ret;
>  	unsigned long ret_attr;
>  
> @@ -1665,8 +1665,9 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
>  		return -EINVAL;
>  	}
>  
> -	mcastFilterSize_p = (unsigned int *)vio_get_attribute(dev,
> -						VETH_MCAST_FILTER_SIZE, NULL);
> +	mcastFilterSize_p = (__be32 *)vio_get_attribute(dev,
> +							VETH_MCAST_FILTER_SIZE,
> +							NULL);
>  	if (!mcastFilterSize_p) {
>  		dev_err(&dev->dev, "Can't find VETH_MCAST_FILTER_SIZE "
>  			"attribute\n");
> @@ -1683,7 +1684,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
>  
>  	adapter->vdev = dev;
>  	adapter->netdev = netdev;
> -	adapter->mcastFilterSize = *mcastFilterSize_p;
> +	adapter->mcastFilterSize = be32_to_cpu(*mcastFilterSize_p);
>  	adapter->pool_config = 0;
>  	ibmveth_init_link_settings(adapter);

ibmveth_init_link_settings() is part of your net-next patch which
you're respining, so I had to apply manually. Please double check your
patches apply cleanly to the designated tree.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2] ibmveth: Convert multicast list size for little-endian system
  2019-08-12 21:13 [PATCH net v2] ibmveth: Convert multicast list size for little-endian system Thomas Falcon
  2019-08-14  2:43 ` Jakub Kicinski
@ 2019-08-14  3:35 ` Hangbin Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2019-08-14  3:35 UTC (permalink / raw)
  To: Thomas Falcon; +Cc: netdev, davem, joe

On Mon, Aug 12, 2019 at 04:13:06PM -0500, Thomas Falcon wrote:
> The ibm,mac-address-filters property defines the maximum number of
> addresses the hypervisor's multicast filter list can support. It is
> encoded as a big-endian integer in the OF device tree, but the virtual
> ethernet driver does not convert it for use by little-endian systems.
> As a result, the driver is not behaving as it should on affected systems
> when a large number of multicast addresses are assigned to the device.
> 
> Reported-by: Hangbin Liu <liuhangbin@gmail.com>
> Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>

Thanks, I tested and it works good.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2] ibmveth: Convert multicast list size for little-endian system
  2019-08-14  2:43 ` Jakub Kicinski
@ 2019-08-14 15:41   ` Thomas Falcon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Falcon @ 2019-08-14 15:41 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, liuhangbin, davem, joe


On 8/13/19 9:43 PM, Jakub Kicinski wrote:
> On Mon, 12 Aug 2019 16:13:06 -0500, Thomas Falcon wrote:
>> The ibm,mac-address-filters property defines the maximum number of
>> addresses the hypervisor's multicast filter list can support. It is
>> encoded as a big-endian integer in the OF device tree, but the virtual
>> ethernet driver does not convert it for use by little-endian systems.
>> As a result, the driver is not behaving as it should on affected systems
>> when a large number of multicast addresses are assigned to the device.
>>
>> Reported-by: Hangbin Liu <liuhangbin@gmail.com>
>> Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
> Okay, applied, but:

Thanks!

...

> ibmveth_init_link_settings() is part of your net-next patch which
> you're respining, so I had to apply manually. Please double check your
> patches apply cleanly to the designated tree.

Sorry about that, I thought I fixed that but maybe I got patches mixed 
up somehow.  Thanks again.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-14 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 21:13 [PATCH net v2] ibmveth: Convert multicast list size for little-endian system Thomas Falcon
2019-08-14  2:43 ` Jakub Kicinski
2019-08-14 15:41   ` Thomas Falcon
2019-08-14  3:35 ` Hangbin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).