[ovs-dev] [PATCH] datapath: Change the single ENOENT return value to ENODEV...

Jarno Rajahalme jarno.rajahalme at nsn.com
Wed Jan 9 10:33:40 UTC 2013


On Jan 8, 2013, at 21:07 , ext Jesse Gross wrote:

> On Tue, Jan 8, 2013 at 3:41 AM, Jarno Rajahalme <jarno.rajahalme at nsn.com> wrote:
>> Userspace code will need to keep on checking for both ENODEV and ENOENT as
>> long as older kernel modules are around.
>> 
>> Signed-off-by: Jarno Rajahalme <jarno.rajahalme at nsn.com>
> 
> OVS userspace actually uses this distinction to determine whether it
> is the datapath or the port that doesn't exist.  For example, see
> netdev_vport_set_config().  In general, it's also usually helpful to
> have more information about the cause of the error as long as it
> doesn't expose implementation details.

Actually, it seems to me that netdev_vport_set_config() does the OVS_VPORT_CMD_SET based on the vport name only. In the "name" branch of the lookup_vport() ENODEV is returned if a matching vport cannot be found, i.e. ENOENT would not be returned to netdev_vport_set_config(). Also, it is the ENODEV value netdev_vport_set_config() looks for, not ENOENT. If netdev_vport_set_config() were to use ODP port number to refer to the vport, it would also need to check for ENOENT in addition to ENODEV.

It is the mismatch between the name and port_no branches of lookup_vport() that triggered me to propose the change. Currently:

If name is given,
  and no such port is found, return ENODEV
  if dp_ifindex is given but it does not match, return ENODEV
else if port_no is given
  and dp (via dp_ifindex) cannot be found, return ENODEV
  if the dp has no port_no, return ENOENT

To me this does not look right. A different value for similar error case ("valid datapath, no such port") is returned depending on whether the query is done with a name or a port_no.

> 
> Also, would you mind keeping the subject of your patches to around 70
> characters in the future so they don't wrap?

Sorry about that.


More information about the dev mailing list