[ovs-discuss] [PATCH 04/20] netdev: Change netdev_get_mtu() to return an error code.

Jesse Gross jesse at nicira.com
Tue Jul 28 00:44:41 UTC 2009


>> -/* Returns the maximum size of transmitted (and received) packets on 
>> 'netdev',
>> - * in bytes, not including the hardware header; thus, this is 
>> typically 1500
>> - * bytes for Ethernet devices. */
>> +/* Retrieves the MTU of 'netdev'.  The MTU is the maximum size of 
>> transmitted
>> + * (and received) packets, in bytes, not including the hardware 
>> header; thus,
>> + * this is typically 1500 bytes for Ethernet devices.
>> + *
>> + * If successful, returns 0 and stores the MTU size in '*mtup'.  On 
>> failure,
>> + * returns a positive errno value and stores ETH_PAYLOAD_MAX (1500) in
>> + * '*mtup'. */
>> int
>> -netdev_get_mtu(const struct netdev *netdev)
>> +netdev_get_mtu(const struct netdev *netdev, int *mtup)
>> {
>> -    return netdev->mtu;
>> +    *mtup = netdev->mtu;
>> +    return 0;
>> }
>
> This function also doesn't match its description.
I believe that these comments are more general descriptions of how the 
functions work from the perspective of the client of the API.  In this 
case, opening the netdev fails if it can't retrieve the MAC/MTU, so 
these functions will always succeed.  However, other implementations 
could fail here and would return errors as described.




More information about the discuss mailing list