All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ibmveth: Convert multicast list size for little-endian systems
@ 2019-08-12 17:43 Thomas Falcon
  2019-08-12 17:49 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Falcon @ 2019-08-12 17:43 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>
---
 drivers/net/ethernet/ibm/ibmveth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index d654c23..b50a6cf 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1645,7 +1645,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;
 
 	netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);
-- 
1.8.3.1


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

* Re: [PATCH net] ibmveth: Convert multicast list size for little-endian systems
  2019-08-12 17:43 [PATCH net] ibmveth: Convert multicast list size for little-endian systems Thomas Falcon
@ 2019-08-12 17:49 ` Joe Perches
  2019-08-12 18:02   ` Thomas Falcon
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2019-08-12 17:49 UTC (permalink / raw)
  To: Thomas Falcon, netdev; +Cc: liuhangbin, davem

On Mon, 2019-08-12 at 12:43 -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>
> ---
>  drivers/net/ethernet/ibm/ibmveth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index d654c23..b50a6cf 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1645,7 +1645,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;
>  
>  	netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);

Perhaps to keep sparse happy too: (untested)
---
 drivers/net/ethernet/ibm/ibmveth.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index d654c234aaf7..90539d7ce565 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1605,7 +1605,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;
 
@@ -1627,7 +1627,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
 		return -EINVAL;
 	}
 
-	mcastFilterSize_p = (unsigned int *)vio_get_attribute(dev,
+	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 "
@@ -1645,7 +1645,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;
 
 	netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);



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

* Re: [PATCH net] ibmveth: Convert multicast list size for little-endian systems
  2019-08-12 17:49 ` Joe Perches
@ 2019-08-12 18:02   ` Thomas Falcon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Falcon @ 2019-08-12 18:02 UTC (permalink / raw)
  To: Joe Perches, netdev; +Cc: liuhangbin, davem


On 8/12/19 12:49 PM, Joe Perches wrote:
> On Mon, 2019-08-12 at 12:43 -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>
>> ---
>>   drivers/net/ethernet/ibm/ibmveth.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
>> index d654c23..b50a6cf 100644
>> --- a/drivers/net/ethernet/ibm/ibmveth.c
>> +++ b/drivers/net/ethernet/ibm/ibmveth.c
>> @@ -1645,7 +1645,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;
>>   
>>   	netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);
> Perhaps to keep sparse happy too: (untested)


Thanks! I will test this and submit a v2 soon.


> ---
>   drivers/net/ethernet/ibm/ibmveth.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index d654c234aaf7..90539d7ce565 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1605,7 +1605,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;
>   
> @@ -1627,7 +1627,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
>   		return -EINVAL;
>   	}
>   
> -	mcastFilterSize_p = (unsigned int *)vio_get_attribute(dev,
> +	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 "
> @@ -1645,7 +1645,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;
>   
>   	netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);
>
>


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

end of thread, other threads:[~2019-08-12 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 17:43 [PATCH net] ibmveth: Convert multicast list size for little-endian systems Thomas Falcon
2019-08-12 17:49 ` Joe Perches
2019-08-12 18:02   ` Thomas Falcon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.