lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f29e40e-1a3b-8580-3fbd-6fba8fc02f1f@gmail.com>
Date:   Tue, 20 Sep 2022 08:41:30 +0200
From:   Mattias Forsblad <mattias.forsblad@...il.com>
To:     Vladimir Oltean <olteanv@...il.com>
Cc:     netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, linux@...linux.org.uk,
        ansuelsmth@...il.com
Subject: Re: [PATCH net-next v14 3/7] net: dsa: Introduce dsa tagger data
 operation.

On 2022-09-20 00:00, Vladimir Oltean wrote:
>> diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
>> index e4b6e3f2a3db..e7fdf3b5cb4a 100644
>> --- a/net/dsa/tag_dsa.c
>> +++ b/net/dsa/tag_dsa.c
>> @@ -198,8 +198,11 @@ static struct sk_buff *dsa_xmit_ll(struct sk_buff *skb, struct net_device *dev,
>>  static struct sk_buff *dsa_rcv_ll(struct sk_buff *skb, struct net_device *dev,
>>  				  u8 extra)
>>  {
>> +	struct dsa_port *cpu_dp = dev->dsa_ptr;
>> +	struct dsa_tagger_data *tagger_data;
>>  	bool trap = false, trunk = false;
>>  	int source_device, source_port;
>> +	struct dsa_switch *ds;
>>  	enum dsa_code code;
>>  	enum dsa_cmd cmd;
>>  	u8 *dsa_header;
>> @@ -218,9 +221,16 @@ static struct sk_buff *dsa_rcv_ll(struct sk_buff *skb, struct net_device *dev,
>>  
>>  		switch (code) {
>>  		case DSA_CODE_FRAME2REG:
>> -			/* Remote management is not implemented yet,
>> -			 * drop.
>> -			 */
>> +			source_device = FIELD_GET(DSA_FRAME2REG_SOURCE_DEV, dsa_header[0]);
>> +			ds = dsa_switch_find(cpu_dp->dst->index, source_device);
>> +			if (ds) {
>> +				tagger_data = ds->tagger_data;
> 
> Can you please also parse the sequence number here, so the
> decode_frame2reg() data consumer doesn't have to concern itself with the
> dsa_header at all?
> 

The sequence number is in the chip structure which isn't available here.
Should we really access that here in the dsa layer?

/Mattias

>> +				if (likely(tagger_data->decode_frame2reg))
>> +					tagger_data->decode_frame2reg(ds, skb);
>> +			} else {
>> +				net_err_ratelimited("RMU: Didn't find switch with index %d",
>> +						    source_device);
>> +			}
>>  			return NULL;
>>  		case DSA_CODE_ARP_MIRROR:
>>  		case DSA_CODE_POLICY_MIRROR:
>> @@ -254,7 +264,6 @@ static struct sk_buff *dsa_rcv_ll(struct sk_buff *skb, struct net_device *dev,
>>  	source_port = (dsa_header[1] >> 3) & 0x1f;
>>  
>>  	if (trunk) {
>> -		struct dsa_port *cpu_dp = dev->dsa_ptr;
>>  		struct dsa_lag *lag;
>>  
>>  		/* The exact source port is not available in the tag,
>> @@ -323,6 +332,25 @@ static struct sk_buff *dsa_rcv_ll(struct sk_buff *skb, struct net_device *dev,
>>  	return skb;
>>  }
>>  
>> +static int dsa_tag_connect(struct dsa_switch *ds)
>> +{
>> +	struct dsa_tagger_data *tagger_data;
>> +
>> +	tagger_data = kzalloc(sizeof(*tagger_data), GFP_KERNEL);
>> +	if (!tagger_data)
>> +		return -ENOMEM;
>> +
>> +	ds->tagger_data = tagger_data;
>> +
>> +	return 0;
>> +}
>> +
>> +static void dsa_tag_disconnect(struct dsa_switch *ds)
>> +{
>> +	kfree(ds->tagger_data);
>> +	ds->tagger_data = NULL;
>> +}
>> +
>>  #if IS_ENABLED(CONFIG_NET_DSA_TAG_DSA)
>>  
>>  static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev)
>> @@ -343,6 +371,8 @@ static const struct dsa_device_ops dsa_netdev_ops = {
>>  	.proto	  = DSA_TAG_PROTO_DSA,
>>  	.xmit	  = dsa_xmit,
>>  	.rcv	  = dsa_rcv,
>> +	.connect  = dsa_tag_connect,
>> +	.disconnect = dsa_tag_disconnect,
>>  	.needed_headroom = DSA_HLEN,
>>  };
>>  
>> @@ -385,6 +415,8 @@ static const struct dsa_device_ops edsa_netdev_ops = {
>>  	.proto	  = DSA_TAG_PROTO_EDSA,
>>  	.xmit	  = edsa_xmit,
>>  	.rcv	  = edsa_rcv,
>> +	.connect  = dsa_tag_connect,
>> +	.disconnect = dsa_tag_disconnect,
>>  	.needed_headroom = EDSA_HLEN,
>>  };
>>  
>> -- 
>> 2.25.1
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ