[dpdk-dev] net/virtio-user: strip VIRTIO_NET_F_MAC when MAC isn't specified

Message ID 20180511105542.18395-1-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tiwei Bie May 11, 2018, 10:55 a.m. UTC
  Currently VIRTIO_NET_F_MAC is set unconditionally when server
mode is used. It should be stripped when MAC isn't specified.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Maxime Coquelin May 16, 2018, 11:08 a.m. UTC | #1
On 05/11/2018 12:55 PM, Tiwei Bie wrote:
> Currently VIRTIO_NET_F_MAC is set unconditionally when server
> mode is used. It should be stripped when MAC isn't specified.
> 
> Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 ++
>   1 file changed, 2 insertions(+)

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Maxime Coquelin May 16, 2018, 2:36 p.m. UTC | #2
On 05/16/2018 01:08 PM, Maxime Coquelin wrote:
> 
> 
> On 05/11/2018 12:55 PM, Tiwei Bie wrote:
>> Currently VIRTIO_NET_F_MAC is set unconditionally when server
>> mode is used. It should be stripped when MAC isn't specified.
>>
>> Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
>>
>> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
>> ---
>>   drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 ++
>>   1 file changed, 2 insertions(+)
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Applied to dpdk-next-virtio/master with commit message reworded to:

net/virtio-user: strip MAC feature when none specified

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 38b8bc90d..d31f895f2 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -378,6 +378,8 @@  virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 
 	if (dev->mac_specified)
 		dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
+	else
+		dev->device_features &= ~(1ull << VIRTIO_NET_F_MAC);
 
 	if (cq) {
 		/* device does not really need to know anything about CQ,