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:   Sat, 27 Aug 2022 21:12:05 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc:     davem@...emloft.net, Rob Herring <robh+dt@...nel.org>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, thomas.petazzoni@...tlin.com,
        Florian Fainelli <f.fainelli@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        linux-arm-kernel@...ts.infradead.org,
        Vladimir Oltean <vladimir.oltean@....com>,
        Luka Perkov <luka.perkov@...tura.hr>,
        Robert Marko <robert.marko@...tura.hr>
Subject: Re: [PATCH net-next v3 3/5] net: ipqess: Add out-of-band DSA tagging
 support

> @@ -409,6 +412,12 @@ static int ipqess_rx_poll(struct ipqess_rx_ring *rx_ring, int budget)
>  			__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD),
>  					       rd->rrd4);
>  
> +		if (netdev_uses_dsa(rx_ring->ess->netdev)) {
> +			tag_info.dp = FIELD_GET(IPQESS_RRD_PORT_ID_MASK, rd->rrd1);
> +			tag_info.proto = DSA_TAG_PROTO_OOB;
> +			dsa_oob_tag_push(skb, &tag_info);
> +		}
> +
>  		napi_gro_receive(&rx_ring->napi_rx, skb);
>  
>  		rx_ring->ess->stats.rx_packets++;
> @@ -713,6 +722,22 @@ static void ipqess_rollback_tx(struct ipqess *eth,
>  	tx_ring->head = start_index;
>  }
>  
> +static void ipqess_process_dsa_tag_sh(struct ipqess *ess, struct sk_buff *skb,
> +				      u32 *word3)
> +{
> +	struct dsa_oob_tag_info tag_info;
> +
> +	if (!netdev_uses_dsa(ess->netdev))
> +		return;
> +
> +	if (dsa_oob_tag_pop(skb, &tag_info))
> +		return;
> +
> +	*word3 |= tag_info.dp << IPQESS_TPD_PORT_BITMAP_SHIFT;
> +	*word3 |= BIT(IPQESS_TPD_FROM_CPU_SHIFT);
> +	*word3 |= 0x3e << IPQESS_TPD_PORT_BITMAP_SHIFT;
> +}

Using netdev_uses_dsa() here will work, but you are on the fast
path. You are following a lot of pointers, which could be bad on the
cache. You might want to consider caching this as a bool in struct
ipqess. Maybe update the cache on NETDEV_CHANGEUPPER?

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ