[PATCH net-next v3 3/5] net: ipqess: Add out-of-band DSA tagging support

Andrew Lunn andrew at lunn.ch
Sat Aug 27 12:12:05 PDT 2022


> @@ -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



More information about the linux-arm-kernel mailing list