From: Vadim Fedorenko <vadim.fedorenko@linux•dev>
To: Furong Xu <0x1207@gmail•com>,
"Russell King (Oracle)" <linux@armlinux•org.uk>,
"David S. Miller" <davem@davemloft•net>,
Alexandre Torgue <alexandre.torgue@foss•st.com>,
Jose Abreu <joabreu@synopsys•com>,
Eric Dumazet <edumazet@google•com>,
Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
Maxime Coquelin <mcoquelin.stm32@gmail•com>,
Joao Pinto <jpinto@synopsys•com>,
Corinna Vinschen <vinschen@redhat•com>
Cc: netdev@vger•kernel.org, linux-stm32@st-md-mailman•stormreply.com,
linux-arm-kernel@lists•infradead.org,
linux-kernel@vger•kernel.org, xfr@outlook•com, rock.xu@nio•com
Subject: Re: [PATCH net-next v2] net: stmmac: Enable TSO on VLANs
Date: Fri, 14 Jun 2024 11:43:00 +0100 [thread overview]
Message-ID: <0474a247-e5f2-4a7f-879b-c764591a5f28@linux.dev> (raw)
In-Reply-To: <20240614060349.498414-1-0x1207@gmail.com>
On 14/06/2024 07:03, Furong Xu wrote:
> The TSO engine works well when the frames are not VLAN Tagged.
> But it will produce broken segments when frames are VLAN Tagged.
>
> The first segment is all good, while the second segment to the
> last segment are broken, they lack of required VLAN tag.
>
> An example here:
> ========
> // 1st segment of a VLAN Tagged TSO frame, nothing wrong.
> MacSrc > MacDst, ethertype 802.1Q (0x8100), length 1518: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [.], seq 1:1449
>
> // 2nd to last segments of a VLAN Tagged TSO frame, VLAN tag is missing.
> MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 1449:2897
> MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 2897:4345
> MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 4345:5793
> MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [P.], seq 5793:7241
>
> // normal VLAN Tagged non-TSO frame, nothing wrong.
> MacSrc > MacDst, ethertype 802.1Q (0x8100), length 1022: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [P.], seq 7241:8193
> MacSrc > MacDst, ethertype 802.1Q (0x8100), length 70: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [F.], seq 8193
> ========
>
> When transmitting VLAN Tagged TSO frames, never insert VLAN tag by HW,
> always insert VLAN tag to SKB payload, then TSO works well on VLANs for
> all MAC cores.
>
> Tested on DWMAC CORE 5.10a, DWMAC CORE 5.20a and DWXGMAC CORE 3.20a
>
> Signed-off-by: Furong Xu <0x1207@gmail•com>
> ---
> Changes in v2:
> - Use __vlan_hwaccel_push_inside() to insert vlan tag to the payload.
> ---
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 27 ++++++++++---------
> 1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index bbedf2a8c60f..e8cbfada63ca 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4233,18 +4233,27 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> struct dma_desc *desc, *first, *mss_desc = NULL;
> struct stmmac_priv *priv = netdev_priv(dev);
> - int nfrags = skb_shinfo(skb)->nr_frags;
> - u32 queue = skb_get_queue_mapping(skb);
> unsigned int first_entry, tx_packets;
> struct stmmac_txq_stats *txq_stats;
> - int tmp_pay_len = 0, first_tx;
> + int tmp_pay_len = 0, first_tx, nfrags;
> struct stmmac_tx_queue *tx_q;
> - bool has_vlan, set_ic;
> + bool set_ic;
> u8 proto_hdr_len, hdr;
> - u32 pay_len, mss;
> + u32 pay_len, mss, queue;
> dma_addr_t des;
> int i;
>
As there will be another iteration, could you please re-arrange
variables to keep reverse x-mas tree order?
prev parent reply other threads:[~2024-06-14 10:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-14 6:03 [PATCH net-next v2] net: stmmac: Enable TSO on VLANs Furong Xu
2024-06-14 6:29 ` Eric Dumazet
2024-06-14 10:43 ` Vadim Fedorenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0474a247-e5f2-4a7f-879b-c764591a5f28@linux.dev \
--to=vadim.fedorenko@linux$(echo .)dev \
--cc=0x1207@gmail$(echo .)com \
--cc=alexandre.torgue@foss$(echo .)st.com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=joabreu@synopsys$(echo .)com \
--cc=jpinto@synopsys$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-stm32@st-md-mailman$(echo .)stormreply.com \
--cc=linux@armlinux$(echo .)org.uk \
--cc=mcoquelin.stm32@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=rock.xu@nio$(echo .)com \
--cc=vinschen@redhat$(echo .)com \
--cc=xfr@outlook$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox