From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E605DC433F5 for ; Fri, 22 Apr 2022 18:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aEsc2B14N4hQk5THuJw7JdeptgUQa1cLD8UaWbBFa2M=; b=07u5EanMH+Mh0S oARic37kFSnWHHaZCutH3t1kot5t1oTTGnl6IRSjwixrSxSiolm7/X4v9o3UG4BbzQ/yNg8xRR7Kp hFMJuSXsUZ6k3lx+pVBSB55tinx9egsPVAlhjoRLcBobIRAqGipPaqyu+sXLS8fjUFpdzu39jnzfj gaNIIuUutpzjj+T2jtoKu/12xQDfEe9IJVXTLXncf4fDMqV33oa3RTZqJyCtJ9qOT/0NpwcvB8EMA 8aRaFVzYI9iaGP98XkDqRl4buIV4SC8vnJLIs8wIFcFmZrRXKkaNYVBclrXtzdKeqoBaskn5iP+Ye EJkT1Kx7dk5+ATJnbQJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhxd7-001ssV-TT; Fri, 22 Apr 2022 18:03:42 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhxcl-001smH-UT for linux-arm-kernel@lists.infradead.org; Fri, 22 Apr 2022 18:03:23 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 874E24000A; Fri, 22 Apr 2022 18:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1650650595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3JC08cZE+VNj3BTHyjNtYZ6pb37MrGbgGzOGxJdRevQ=; b=iYvPTy5JGGsMZSmUu4ROU/+a5G0T0F0ogIXw6HukaSktm+bKMSBd4lY7fOJQpnKsT0PQlA Q0fUpPtNxdeXypCw1ThOPMA97qS0GCznn8FtGopIa9qcEAL/KapFK+/a8OxMQ+7dtLQsyP 4VNnrVrbjt0vg4rwIOSfT5XTGIJZqr8Q7bEkw4hkIGLqBpA0C271xDKgSS7pZVyAoe8949 WYh9pSJzrRFRTDnUCBqvo1SMP8ycdqrcxqM9bGI9TlztwH9Qol/XMlMd7u/Hbj6TaftPWx b2heQ4MQ7R/x9xVrgA0IAOgVft80kSGZMezwlR0yIeaDlhktV7QSgb6ZKSWiyA== From: Maxime Chevallier To: davem@davemloft.net, Rob Herring Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Vladimir Oltean , Luka Perkov , Robert Marko Subject: [PATCH net-next 3/5] net: ipqess: Add out-of-band DSA tagging support Date: Fri, 22 Apr 2022 20:03:03 +0200 Message-Id: <20220422180305.301882-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220422180305.301882-1-maxime.chevallier@bootlin.com> References: <20220422180305.301882-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220422_110320_291942_F5647476 X-CRM114-Status: GOOD ( 12.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On the IPQ4019, there's an 5 ports switch connected to the CPU through the IPQESS Ethernet controller. The way the DSA tag is sent-out to that switch is through the DMA descriptor, due to how tightly it is integrated with the switch. This commit uses the out-of-band tagging protocol to get the outgoing port index for each SKB, and reports it back in the skb->shinfo on the RX side based on information located in the descriptor. Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/qualcomm/ipqess/ipqess.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/ethernet/qualcomm/ipqess/ipqess.c b/drivers/net/ethernet/qualcomm/ipqess/ipqess.c index 4ecb8c65417b..32a5cdd1c063 100644 --- a/drivers/net/ethernet/qualcomm/ipqess/ipqess.c +++ b/drivers/net/ethernet/qualcomm/ipqess/ipqess.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "ipqess.h" @@ -399,6 +400,11 @@ static int ipqess_rx_poll(struct ipqess_rx_ring *rx_ring, int budget) skb->protocol = eth_type_trans(skb, rx_ring->ess->netdev); skb_record_rx_queue(skb, rx_ring->ring_id); + if (netdev_uses_dsa(rx_ring->ess->netdev)) { + skb_shinfo(skb)->dsa_tag_info.dp = + FIELD_GET(IPQESS_RRD_PORT_ID_MASK, rd->rrd1); + } + if (rd->rrd6 & IPQESS_RRD_CSUM_FAIL_MASK) skb_checksum_none_assert(skb); else @@ -706,6 +712,21 @@ 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 skb_shared_info *shinfo = skb_shinfo(skb); + struct dsa_tag_info *tag_info = &shinfo->dsa_tag_info; + + if (!netdev_uses_dsa(ess->netdev) || + tag_info->proto != DSA_TAG_PROTO_OOB) + return; + + *word3 |= tag_info->dp << IPQESS_TPD_PORT_BITMAP_SHIFT; + *word3 |= BIT(IPQESS_TPD_FROM_CPU_SHIFT); + *word3 |= 0x3e << IPQESS_TPD_PORT_BITMAP_SHIFT; +} + static int ipqess_tx_map_and_fill(struct ipqess_tx_ring *tx_ring, struct sk_buff *skb) { @@ -716,6 +737,8 @@ static int ipqess_tx_map_and_fill(struct ipqess_tx_ring *tx_ring, u16 len; int i; + ipqess_process_dsa_tag_sh(tx_ring->ess, skb, &word3); + if (skb_is_gso(skb)) { if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { lso_word1 |= IPQESS_TPD_IPV4_EN; -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel