From: Andrew Lunn <andrew@lunn.ch>
To: Ratheesh Kannoth <rkannoth@marvell.com>
Cc: Shradha Gupta <shradhagupta@linux.microsoft.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Haiyang Zhang <haiyangz@microsoft.com>,
Randy Dunlap <rdunlap@infradead.org>,
Johannes Berg <johannes.berg@intel.com>,
Breno Leitao <leitao@debian.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Shradha Gupta <shradhagupta@microsoft.com>
Subject: Re: [PATCH net-next v3] net: Add sysfs atttribute for max_mtu
Date: Thu, 9 May 2024 22:16:57 +0200 [thread overview]
Message-ID: <6203153e-780c-4570-9c4e-a053cfbc3290@lunn.ch> (raw)
In-Reply-To: <20240509094225.GA1078660@maili.marvell.com>
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
next prev parent reply other threads:[~2024-05-09 20:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 9:11 [PATCH net-next v3] net: Add sysfs atttribute for max_mtu Shradha Gupta
2024-05-09 9:42 ` Ratheesh Kannoth
2024-05-09 20:16 ` Andrew Lunn [this message]
2024-05-09 10:01 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6203153e-780c-4570-9c4e-a053cfbc3290@lunn.ch \
--to=andrew@lunn.ch \
--cc=bhelgaas@google.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=haiyangz@microsoft.com \
--cc=johannes.berg@intel.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=rkannoth@marvell.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=shradhagupta@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).