lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 9 Dec 2011 11:41:40 +0100
From:	Jiri Pirko <jpirko@...hat.com>
To:	Rusty Russell <rusty@...tcorp.com.au>
Cc:	netdev@...r.kernel.org
Subject: Re: [patch net-next 2/6] net: make vlan ndo_vlan_rx_[add/kill]_vid
 return error value

Fri, Dec 09, 2011 at 06:45:16AM CET, rusty@...tcorp.com.au wrote:
>On Thu,  8 Dec 2011 15:11:16 +0100, Jiri Pirko <jpirko@...hat.com> wrote:
>> Let caller know the result of adding/removing vlan id to/from vlan
>> filter.
>> 
>> In some drivers I make those functions to just return 0. But in those
>> where there is able to see if hw setup went correctly, return value is
>> set appropriately.
>...
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index 5a96172..609c51f 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -855,7 +855,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
>>  	kfree(buf);
>>  }
>>  
>> -static void virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
>> +static int virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
>>  {
>>  	struct virtnet_info *vi = netdev_priv(dev);
>>  	struct scatterlist sg;
>> @@ -865,9 +865,10 @@ static void virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
>>  	if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
>>  				  VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0))
>>  		dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid);
>> +	return 0;
>>  }
>>  
>> -static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
>> +static int virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
>>  {
>>  	struct virtnet_info *vi = netdev_priv(dev);
>>  	struct scatterlist sg;
>> @@ -877,6 +878,7 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
>>  	if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
>>  				  VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0))
>>  		dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid);
>> +	return 0;
>>  }
>
>Hmm, see that virtnet_send_command?  That's what you're after.  You
>could even replace the dev_warn(), if you're doing something more useful
>with the result.

I was not sure what value to return here so I let that be as it was.
Feel free to post follow-up.

Thanks

Jirka

>
>Thanks,
>Rusty.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ