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]
Date:	Sun, 24 Aug 2014 19:37:12 -0700
From:	Florian Fainelli <f.fainelli@...il.com>
To:	Alexander Duyck <alexander.duyck@...il.com>, netdev@...r.kernel.org
CC:	davem@...emloft.net, jhs@...atatu.com, linville@...driver.com,
	alexander.h.duyck@...el.com
Subject: Re: [PATCH net-next v3 09/12] net: dsa: add Broadcom tag RX/TX handler

Le 24/08/2014 15:51, Alexander Duyck a écrit :
> On 08/24/2014 11:44 AM, Florian Fainelli wrote:
>> Add support for the 4-bytes Broadcom tag that built-in switches such as
>> the Starfighter 2 might insert when receiving packets, or that we need
>> to insert while targetting specific switch ports. We use a fake
>> EtherType field for this 4-bytes switch tag: ETH_P_BRCMTAG since we need
>> to use the skb->protocol override in the receive path.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
>> ---
>> Changes in v3:
>> - add ETH_P_BRCMTAG as part of this changeset and not in a previous patch
>> - fixed an early de-reference in the receive hook
>
> I was just wondering.  Is there a reason we need to register this as yet
> another protocol?

For the broadcom tag format, not specifically no, this is mostly so it 
looks like what has been done so far, but since this is not a real 
ethertype, there is no need for this.

>
> It seems like we should be able to just register one DSA tag protocol
> and then we could push the parsing function out to a function pointer
> contained in the DSA switch structure.  My concern is that as we add
> each new switch message format we are looking at the potential for yet
> another Ethertype and they are a limited resource.
>
> So for example in the section below you already have to dig out the
> dsa_switch structure and tree before you even start processing the
> headers.
>
>> +
>> +static int brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
>> +			struct packet_type *pt, struct net_device *orig_dev)
>> +{
>> +	struct dsa_switch_tree *dst = dev->dsa_ptr;
>> +	struct dsa_switch *ds;
>> +	int source_port;
>> +	u8 *brcm_tag;
>> +
>> +	if (unlikely(dst == NULL))
>> +		goto out_drop;
>> +
>> +	ds = dst->ds[0];
>> +
>> +	skb = skb_unshare(skb, GFP_ATOMIC);
>> +	if (skb == NULL)
>> +		goto out;
>
> At this point here we already have the dsa pointers and could just pull
> up a function pointer so all of the code below could potentially be
> moved into a separate function allowing us to drop the need to have
> multiple Ethertypes and so we could just use ETH_P_DSA for all DSA
> tagging type.

I see, or rather maybe just use ETH_P_EDSA which is a real assigned 
ethertype?
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ