mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Kubecek <mkubecek@suse.cz>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	David Jander <david@protonic.nl>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
	mkl@pengutronix.de, Marek Vasut <marex@denx.de>,
	Christian Herber <christian.herber@nxp.com>
Subject: Re: [PATCH v5 1/2] ethtool: provide UAPI for PHY master/slave configuration.
Date: Mon, 4 May 2020 10:37:34 +0200	[thread overview]
Message-ID: <20200504083734.GA5989@lion.mk-sys.cz> (raw)
In-Reply-To: <20200504080417.i3d2jsjjpu2zjk4z@pengutronix.de>

On Mon, May 04, 2020 at 10:04:17AM +0200, Oleksij Rempel wrote:
> @Michal,
> 
> i noticed that linkmodes_fill_reply() some times get not enough
> tailroom.
> if data->peer_empty == 0
> linkmodes_reply_size() size: 476
> linkmodes_fill_reply() skb tailroom: 724
> 
> 
> if data->peer_empty == 1
> linkmodes_reply_size() size: 216                                      
> linkmodes_fill_reply() skb tailroom: 212
> 
> In the last case i won't be able to attach master_lave state and cfg
> fields.
> 
> It looks like this issue was not introduced by my patches. May be you
> have idea, what is missing?

It's my mistake, I'm just not sure why I never ran into this while
testing. Please try the patch below.

Michal

diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 0c772318c023..ed5357210193 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -342,7 +342,7 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info)
 	ret = ops->reply_size(req_info, reply_data);
 	if (ret < 0)
 		goto err_cleanup;
-	reply_len = ret;
+	reply_len = ret + ethnl_reply_header_size();
 	ret = -ENOMEM;
 	rskb = ethnl_reply_init(reply_len, req_info->dev, ops->reply_cmd,
 				ops->hdr_attr, info, &reply_payload);
@@ -588,7 +588,7 @@ static void ethnl_default_notify(struct net_device *dev, unsigned int cmd,
 	ret = ops->reply_size(req_info, reply_data);
 	if (ret < 0)
 		goto err_cleanup;
-	reply_len = ret;
+	reply_len = ret + ethnl_reply_header_size();
 	ret = -ENOMEM;
 	skb = genlmsg_new(reply_len, GFP_KERNEL);
 	if (!skb)
diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c
index 95eae5c68a52..0eed4e4909ab 100644
--- a/net/ethtool/strset.c
+++ b/net/ethtool/strset.c
@@ -324,7 +324,6 @@ static int strset_reply_size(const struct ethnl_req_info *req_base,
 	int len = 0;
 	int ret;
 
-	len += ethnl_reply_header_size();
 	for (i = 0; i < ETH_SS_COUNT; i++) {
 		const struct strset_info *set_info = &data->sets[i];
 

  reply	other threads:[~2020-05-04  8:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04  7:12 [PATCH net-next v4 0/2] provide support " Oleksij Rempel
2020-05-04  7:12 ` [PATCH v5 1/2] ethtool: provide UAPI " Oleksij Rempel
2020-05-04  8:04   ` Oleksij Rempel
2020-05-04  8:37     ` Michal Kubecek [this message]
2020-05-04  8:55       ` Oleksij Rempel
2020-05-04 13:35         ` Michal Kubecek
2020-05-04  9:10   ` Michal Kubecek
2020-05-04 10:10     ` Oleksij Rempel
2020-05-04 13:29       ` Michal Kubecek
2020-05-04  7:12 ` [PATCH v5 2/2] net: phy: tja11xx: add support for master-slave configuration Oleksij Rempel

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=20200504083734.GA5989@lion.mk-sys.cz \
    --to=mkubecek@suse.cz \
    --cc=andrew@lunn.ch \
    --cc=christian.herber@nxp.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=david@protonic.nl \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=marex@denx.de \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    /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

all inboxes | Powered by JetHome®