lkml.org 
[lkml]   [2024]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next v3] net: Add sysfs atttribute for max_mtu
On Thu, May 09, 2024 at 03:12:25PM +0530, Ratheesh Kannoth wrote:
> On 2024-05-09 at 14:41:23, Shradha Gupta (shradhagupta@linux.microsoft.com) wrote:
> > For drivers like MANA, max_mtu value is populated with the value of
> > maximum MTU that the underlying hardware can support.
> IIUC, this reads dev->mtu.

I think you are misunderstanding the code.

> > +NETDEVICE_SHOW_RO(max_mtu, fmt_dec);

/* generate a show function for simple field */
#define NETDEVICE_SHOW(field, format_string) \
static ssize_t format_##field(const struct net_device *dev, char *buf) \
{ \
return sysfs_emit(buf, format_string, dev->field); \
} \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return netdev_show(dev, attr, buf, format_##field); \
} \

#define NETDEVICE_SHOW_RO(field, format_string) \
NETDEVICE_SHOW(field, format_string); \
static DEVICE_ATTR_RO(field)

So field is max_mtu, so that dev->field gets expanded to dev->max_mtu.

> you can read the same using ifconfig

We stopped using ifconfig years ago. You actually mean "ip link show"

> or any thing that uses SIOCGIFMTU. why do you need to add a new sysfs ?

SIOCGIFMTU is still implemented, but obsolete, replaced by netlink, as
Eric pointed out.

Andrew

\
 
 \ /
  Last update: 2024-05-27 18:22    [W:0.051 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site