All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>,
	Sean Tranchetti <stranche@codeaurora.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] net: qualcomm: rmnet: Allow partial updates of IFLA_FLAGS
Date: Tue, 15 Jun 2021 20:35:52 -0500	[thread overview]
Message-ID: <37f0f6f3-3a11-304f-4030-445e2bc578e6@linaro.org> (raw)
In-Reply-To: <20210615232707.835258-1-bjorn.andersson@linaro.org>

On 6/15/21 6:27 PM, Bjorn Andersson wrote:
> The idiomatic way to handle the changelink flags/mask pair seems to be
> allow partial updates of the driver's link flags. In contrast the rmnet
> driver masks the incoming flags and then use that as the new flags.
> 
> Change the rmnet driver to follow the common scheme, before the
> introduction of IFLA_RMNET_FLAGS handling in iproute2 et al.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

KS was right, we want the same behavior in both newlink and changelink,
but aside from that, I like this a lot.

It looks good to me.

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
> 
> Changes since v1:
> - Also do the masking dance on newlink, per Subash request
> - Add "net-next" to subject prefix
> 
>  drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> index 8d51b0cb545c..27b1663c476e 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> @@ -163,7 +163,8 @@ static int rmnet_newlink(struct net *src_net, struct net_device *dev,
>  		struct ifla_rmnet_flags *flags;
>  
>  		flags = nla_data(data[IFLA_RMNET_FLAGS]);
> -		data_format = flags->flags & flags->mask;
> +		data_format &= ~flags->mask;
> +		data_format |= flags->flags & flags->mask;
>  	}
>  
>  	netdev_dbg(dev, "data format [0x%08X]\n", data_format);
> @@ -336,7 +337,8 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
>  
>  		old_data_format = port->data_format;
>  		flags = nla_data(data[IFLA_RMNET_FLAGS]);
> -		port->data_format = flags->flags & flags->mask;
> +		port->data_format &= ~flags->mask;
> +		port->data_format |= flags->flags & flags->mask;
>  
>  		if (rmnet_vnd_update_dev_mtu(port, real_dev)) {
>  			port->data_format = old_data_format;
> 


  reply	other threads:[~2021-06-16  1:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 23:27 [PATCH net-next v2] net: qualcomm: rmnet: Allow partial updates of IFLA_FLAGS Bjorn Andersson
2021-06-16  1:35 ` Alex Elder [this message]
2021-06-16  6:27 ` subashab
2021-06-16 19:20 ` patchwork-bot+netdevbpf

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=37f0f6f3-3a11-304f-4030-445e2bc578e6@linaro.org \
    --to=elder@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stranche@codeaurora.org \
    --cc=subashab@codeaurora.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.