From: Olivier MATZ <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: Jijiang Liu <jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH v3 3/3] app/testpmd:change tx_checksum command and csum forwarding engine
Date: Thu, 11 Dec 2014 11:52:36 +0100 [thread overview]
Message-ID: <54897774.6090107@6wind.com> (raw)
In-Reply-To: <1418173403-30202-4-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Hi Jijiang,
Some more comments, in addition to the one I've made in the cover
letter. Reference link for patchwork readers:
http://dpdk.org/ml/archives/dev/2014-December/009886.html
On 12/10/2014 02:03 AM, Jijiang Liu wrote:
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -316,16 +316,30 @@ static void cmd_help_long_parsed(void *parsed_result,
> " Disable hardware insertion of a VLAN header in"
> " packets sent on a port.\n\n"
>
> - "tx_cksum set (ip|udp|tcp|sctp|vxlan) (hw|sw) (port_id)\n"
> + "tx_cksum set (ip|udp|tcp|sctp) (hw|sw) (port_id)\n"
> " Select hardware or software calculation of the"
> " checksum with when transmitting a packet using the"
> " csum forward engine.\n"
> - " ip|udp|tcp|sctp always concern the inner layer.\n"
> - " vxlan concerns the outer IP and UDP layer (in"
> - " case the packet is recognized as a vxlan packet by"
> - " the forward engine)\n"
> + " In the case of tunneling packet, ip|udp|tcp|sctp"
> + " always concern the inner layer.\n\n"
> +
> + "tx_cksum set tunnel (hw|sw|none) (port_id)\n"
> + " Select hardware or software calculation of the"
> + " checksum with when transmitting a tunneling packet"
> + " using the csum forward engine.\n"
> + " The none option means treat tunneling packet as ordinary"
> + " packet when using the csum forward engine\n."
> + " Tunneling packet concerns the outer IP, inner IP"
> + " and inner L4\n"
> " Please check the NIC datasheet for HW limits.\n\n"
>
> + "tx_cksum set (outer-ip) (hw|sw) (port_id)\n"
> + " Select hardware or software calculation of the"
> + " checksum with when transmitting a packet using the"
> + " csum forward engine.\n"
> + " outer-ip always concern the outer layer of"
> + " tunneling packet.\n\n"
> +
> "tx_checksum show (port_id)\n"
> " Display tx checksum offload configuration\n\n"
>
not sure we need 2 different commands for tx_cksum set (outer-ip) and
tx_cksum set (ip|udp|tcp|sctp). As the syntax is exactly the same, it
may result in less code to have only one command.
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -256,17 +256,16 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,
> struct udp_hdr *udp_hdr;
> uint64_t ol_flags = 0;
>
> - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
> - ol_flags |= PKT_TX_UDP_TUNNEL_PKT;
> -
> if (outer_ethertype == _htons(ETHER_TYPE_IPv4)) {
> ipv4_hdr->hdr_checksum = 0;
>
> - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
> + if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)
> ol_flags |= PKT_TX_OUTER_IP_CKSUM;
> - else
> + else {
> ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);
> - } else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)
> + ol_flags |= PKT_TX_OUTER_IPV4;
> + }
> + } else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM)
> ol_flags |= PKT_TX_OUTER_IPV6;
>
> udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + outer_l3_len);
> @@ -300,11 +299,14 @@ process_outer_cksums(void *outer_l3_hdr, uint16_t outer_ethertype,
> * Ether / (vlan) / outer IP|IP6 / outer UDP / VxLAN / Ether / IP|IP6 /
> * UDP|TCP|SCTP
> *
> - * The testpmd command line for this forward engine sets the flags
> + * These testpmd command lines for this forward engine sets the flags
> * TESTPMD_TX_OFFLOAD_* in ports[tx_port].tx_ol_flags. They control
> - * wether a checksum must be calculated in software or in hardware. The
> - * IP, UDP, TCP and SCTP flags always concern the inner layer. The
> - * VxLAN flag concerns the outer IP (if packet is recognized as a vxlan packet).
> + * wether a checksum must be calculated in software or in hardware.
> + * In the case of tunneling packet, the IP, UDP, TCP and SCTP flags
> + * always concern the inner layer; the outer IP flag always concern
> + * the outer layer; the tunnel flag is used to tell the NIC that it
> + * is a tunneing packet, want hardware offload for outer layer,
> + * or inner layer, or both.
tunneing -> tunneling
"the tunnel flag is used to tell the NIC that it is a tunneing packet,
want hardware offload for outer layer, or inner layer, or both."
what does that mean?
> */
> static void
> pkt_burst_checksum_forward(struct fwd_stream *fs)
> @@ -376,7 +378,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
> l3_hdr = (char *)eth_hdr + l2_len;
>
> /* check if it's a supported tunnel (only vxlan for now) */
> - if (l4_proto == IPPROTO_UDP) {
> + if (((testpmd_ol_flags &
> + TESTPMD_TX_OFFLOAD_NON_TUNNEL_CKSUM) == 0)
> + && (l4_proto == IPPROTO_UDP)) {
> udp_hdr = (struct udp_hdr *)((char *)l3_hdr + l3_len);
>
> /* check udp destination port, 4789 is the default
> @@ -386,17 +390,23 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
> tunnel = 1;
>
> /* currently, this flag is set by i40e only if the
> - * packet is vxlan */
> + * packet is a tunneling packet */
> } else if (m->ol_flags & (PKT_RX_TUNNEL_IPV4_HDR |
> PKT_RX_TUNNEL_IPV6_HDR))
> tunnel = 1;
>
> if (tunnel == 1) {
> +
> + if (testpmd_ol_flags
> + & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM)
> + ol_flags |= PKT_TX_UDP_TUNNEL_PKT;
> +
> outer_ethertype = ethertype;
> outer_l2_len = l2_len;
> outer_l3_len = l3_len;
> outer_l3_hdr = l3_hdr;
>
> + /* currently, only VXLAN packet is supported */
> eth_hdr = (struct ether_hdr *)((char *)udp_hdr +
> sizeof(struct udp_hdr) +
> sizeof(struct vxlan_hdr));
> @@ -434,7 +444,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
> /* step 4: fill the mbuf meta data (flags and header lengths) */
>
> if (tunnel == 1) {
> - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) {
> + if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM) {
> m->outer_l2_len = outer_l2_len;
> m->outer_l3_len = outer_l3_len;
> m->l2_len = l4_tun_len + l2_len;
> @@ -505,7 +515,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
> "m->l4_len=%d\n",
> m->l2_len, m->l3_len, m->l4_len);
> if ((tunnel == 1) &&
> - (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM))
> + (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM))
> printf("tx: m->outer_l2_len=%d m->outer_l3_len=%d\n",
> m->outer_l2_len, m->outer_l3_len);
> if (tso_segsz != 0)
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index f8b0740..09caa6a 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -125,10 +125,20 @@ struct fwd_stream {
> #define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004
> /** Offload SCTP checksum in csum forward engine */
> #define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008
> -/** Offload VxLAN checksum in csum forward engine */
> -#define TESTPMD_TX_OFFLOAD_VXLAN_CKSUM 0x0010
> +/** Offload tunneling packet checksum in csum forward engine */
> +#define TESTPMD_TX_OFFLOAD_TUNNEL_CKSUM 0x0010
> /** Insert VLAN header in forward engine */
> #define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0020
> +/**
> + * Offload outer-IP checksum in csum forward engine
> + * for tunneling packet
> + */
> +#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0040
> +/**
> + * For a tunneling packet, user requests HW offload for its outer
> + * layer checksum, and don't care is it a tunneled packet or not.
> + */
> +#define TESTPMD_TX_OFFLOAD_NON_TUNNEL_CKSUM 0x0080
>
> /**
> * The data structure associated with each port.
>
For now, I did not check the implementation of the patch. I'm not
sure I understand the specifications, so I cannot check if the code
conforms to it.
How this patch is tested? I think a report similar to
http://dpdk.org/ml/archives/dev/2014-November/007991.html would help
to verify that it works (at least on one driver), and to understand
the test-pmd API and the different use cases.
Regards,
Olivier
next prev parent reply other threads:[~2014-12-11 10:52 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 1:03 [PATCH v3 0/3] enhance TX checksum command and csum forwarding engine Jijiang Liu
[not found] ` <1418173403-30202-1-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-10 1:03 ` [PATCH v3 1/3] librte_ether:add outer IP offload capability flag Jijiang Liu
[not found] ` <1418173403-30202-2-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-11 10:33 ` Olivier MATZ
2014-12-10 1:03 ` [PATCH v3 2/3] i40e:support outer IPv4 checksum capability Jijiang Liu
[not found] ` <1418173403-30202-3-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-11 10:34 ` Olivier MATZ
2014-12-10 1:03 ` [PATCH v3 3/3] app/testpmd:change tx_checksum command and csum forwarding engine Jijiang Liu
[not found] ` <1418173403-30202-4-git-send-email-jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-11 10:52 ` Olivier MATZ [this message]
[not found] ` <54897774.6090107-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-12-12 4:06 ` Liu, Jijiang
2014-12-11 10:17 ` [PATCH v3 0/3] enhance TX checksum " Olivier MATZ
[not found] ` <54896F4A.4070601-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-12-12 3:48 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DA1B70-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-12-12 16:33 ` Olivier MATZ
[not found] ` <548B18C9.3020408-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-07 2:03 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DA7699-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-07 9:59 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213D337B-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-07 11:39 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DA789E-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-07 12:07 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213D34AE-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-08 8:51 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DA7CC5-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-08 10:54 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213D3897-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-09 10:45 ` Olivier MATZ
[not found] ` <54AFB13E.2080200-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-12 3:41 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DA85A1-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-12 11:43 ` Olivier MATZ
[not found] ` <54B3B35A.5030803-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-13 3:04 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DA8E36-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-13 9:55 ` Olivier MATZ
[not found] ` <54B4EB92.40209-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-14 3:01 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DB0789-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-15 13:31 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213D4FCF-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-16 17:27 ` Olivier MATZ
[not found] ` <54B94A18.5030700-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-19 13:04 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213DCD25-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-19 14:38 ` Olivier MATZ
[not found] ` <54BD16F1.6050409-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-20 1:12 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213DDF46-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-20 12:39 ` Olivier MATZ
[not found] ` <54BE4C70.7050406-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-20 15:18 ` Thomas Monjalon
2015-01-20 17:10 ` Stephen Hemminger
2015-01-20 17:23 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213DE5FB-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-20 18:15 ` Olivier MATZ
[not found] ` <54BE9B56.7050108-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-21 3:12 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DB55DB-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-21 15:25 ` Olivier MATZ
[not found] ` <54BFC4D6.2010903-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-21 16:28 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213DEA1E-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-21 17:13 ` Olivier MATZ
2015-01-26 4:13 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213DF71B-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-26 6:02 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DB6FD2-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-26 14:07 ` Olivier MATZ
[not found] ` <54C64A10.2010906-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-26 14:15 ` Ananyev, Konstantin
[not found] ` <2601191342CEEE43887BDE71AB977258213DF90B-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-27 8:34 ` Olivier MATZ
[not found] ` <54C74D80.7090208-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-27 15:26 ` Ananyev, Konstantin
2015-01-21 19:44 ` Stephen Hemminger
2015-01-22 1:40 ` Liu, Jijiang
2015-01-21 8:01 ` Liu, Jijiang
[not found] ` <1ED644BD7E0A5F4091CF203DAFB8E4CC01DB56B3-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-21 9:10 ` Olivier MATZ
[not found] ` <54BF6D21.3010506-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-01-21 11:52 ` Ananyev, Konstantin
2015-01-07 13:06 ` Qiu, Michael
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=54897774.6090107@6wind.com \
--to=olivier.matz-pdr9zngts4eavxtiumwx3w@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
--cc=jijiang.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.