From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D38C65947 for ; Wed, 15 Jul 2015 20:06:54 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 15 Jul 2015 11:06:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,481,1432623600"; d="scan'208";a="763211091" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by fmsmga002.fm.intel.com with ESMTP; 15 Jul 2015 11:06:44 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.224.2; Thu, 16 Jul 2015 02:06:14 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.129]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.157]) with mapi id 14.03.0224.002; Thu, 16 Jul 2015 02:06:13 +0800 From: "Zhang, Helin" To: Thomas Monjalon Thread-Topic: [PATCH] mlx4: replace some offload flags with packet type Thread-Index: AQHQvyS4om2z8tin3kijTcf9gTPJZJ3c0t3Q Date: Wed, 15 Jul 2015 18:06:12 +0000 Message-ID: References: <2161590.Y1eMLetJSj@xps13> <1436981535-15539-1-git-send-email-thomas.monjalon@6wind.com> In-Reply-To: <1436981535-15539-1-git-send-email-thomas.monjalon@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] mlx4: replace some offload flags with packet type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2015 18:06:56 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, July 15, 2015 10:32 AM > To: Zhang, Helin > Cc: dev@dpdk.org > Subject: [PATCH] mlx4: replace some offload flags with packet type >=20 > The workaround for Tx tunnel offloading can now be replaced with packet t= ype > flag checking. > The ol_flags for IPv4/IPv6 and tunnel Rx offloading are replaced with pac= ket type > flags. >=20 > Signed-off-by: Thomas Monjalon > Acked-by: Adrien Mazarguil > --- >=20 > On Rx side, the tunnel type cannot be set. > So RTE_ETH_IS_TUNNEL_PKT() will return wrong even if RTE_PTYPE_INNER_* is > set. > What about fixing RTE_ETH_IS_TUNNEL_PKT() to handle this case? >=20 > drivers/net/mlx4/mlx4.c | 58 > ++++++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 53 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index > f4491e7..3f5e9f3 100644 > --- a/drivers/net/mlx4/mlx4.c > +++ b/drivers/net/mlx4/mlx4.c > @@ -1263,14 +1263,17 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf > **pkts, uint16_t pkts_n) > /* HW does not support checksum offloads at arbitrary > * offsets but automatically recognizes the packet > * type. For inner L3/L4 checksums, only VXLAN (UDP) > - * tunnels are currently supported. > - * > - * FIXME: since PKT_TX_UDP_TUNNEL_PKT has been removed, > + * tunnels are currently supported. */ #ifdef RTE_NEXT_ABI > + if (RTE_ETH_IS_TUNNEL_PKT(buf->packet_type)) > +#else > + /* FIXME: since PKT_TX_UDP_TUNNEL_PKT has been removed, > * the outer packet type is unknown. All we know is > * that the L2 header is of unusual length (not > * ETHER_HDR_LEN with or without 802.1Q header). */ > if ((buf->l2_len !=3D ETHER_HDR_LEN) && > (buf->l2_len !=3D (ETHER_HDR_LEN + 4))) > +#endif > send_flags |=3D IBV_EXP_QP_BURST_TUNNEL; > } > if (likely(segs =3D=3D 1)) { > @@ -2485,6 +2488,41 @@ rxq_cleanup(struct rxq *rxq) > memset(rxq, 0, sizeof(*rxq)); > } >=20 > +#ifdef RTE_NEXT_ABI > +/** > + * Translate RX completion flags to packet type. > + * > + * @param flags > + * RX completion flags returned by poll_length_flags(). > + * > + * @return > + * Packet type for struct rte_mbuf. > + */ > +static inline uint32_t > +rxq_cq_to_pkt_type(uint32_t flags) > +{ > + uint32_t pkt_type =3D 0; Initial value of 0 seems not needed. > + > + if (flags & IBV_EXP_CQ_RX_TUNNEL_PACKET) > + pkt_type |=3D Operand of 'OR' is not needed at all. > + TRANSPOSE(flags, > + IBV_EXP_CQ_RX_OUTER_IPV4_PACKET, > RTE_PTYPE_L3_IPV4) | > + TRANSPOSE(flags, > + IBV_EXP_CQ_RX_OUTER_IPV6_PACKET, > RTE_PTYPE_L3_IPV6) | > + TRANSPOSE(flags, > + IBV_EXP_CQ_RX_IPV4_PACKET, > RTE_PTYPE_INNER_L3_IPV4) | > + TRANSPOSE(flags, > + IBV_EXP_CQ_RX_IPV6_PACKET, > RTE_PTYPE_INNER_L3_IPV6); > + else > + pkt_type |=3D Operand of 'OR' is not needed at all. Regards, Helin > + TRANSPOSE(flags, > + IBV_EXP_CQ_RX_IPV4_PACKET, RTE_PTYPE_L3_IPV4) > | > + TRANSPOSE(flags, > + IBV_EXP_CQ_RX_IPV6_PACKET, RTE_PTYPE_L3_IPV6); > + return pkt_type; > +} > +#endif /* RTE_NEXT_ABI */ > + > /** > * Translate RX completion flags to offload flags. > * > @@ -2499,11 +2537,13 @@ rxq_cleanup(struct rxq *rxq) static inline uint3= 2_t > rxq_cq_to_ol_flags(const struct rxq *rxq, uint32_t flags) { > - uint32_t ol_flags; > + uint32_t ol_flags =3D 0; >=20 > - ol_flags =3D > +#ifndef RTE_NEXT_ABI > + ol_flags |=3D > TRANSPOSE(flags, IBV_EXP_CQ_RX_IPV4_PACKET, PKT_RX_IPV4_HDR) > | > TRANSPOSE(flags, IBV_EXP_CQ_RX_IPV6_PACKET, > PKT_RX_IPV6_HDR); > +#endif > if (rxq->csum) > ol_flags |=3D > TRANSPOSE(~flags, > @@ -2519,12 +2559,14 @@ rxq_cq_to_ol_flags(const struct rxq *rxq, uint32_= t > flags) > */ > if ((flags & IBV_EXP_CQ_RX_TUNNEL_PACKET) && (rxq->csum_l2tun)) > ol_flags |=3D > +#ifndef RTE_NEXT_ABI > TRANSPOSE(flags, > IBV_EXP_CQ_RX_OUTER_IPV4_PACKET, > PKT_RX_TUNNEL_IPV4_HDR) | > TRANSPOSE(flags, > IBV_EXP_CQ_RX_OUTER_IPV6_PACKET, > PKT_RX_TUNNEL_IPV6_HDR) | > +#endif > TRANSPOSE(~flags, > IBV_EXP_CQ_RX_OUTER_IP_CSUM_OK, > PKT_RX_IP_CKSUM_BAD) | > @@ -2716,6 +2758,9 @@ mlx4_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf > **pkts, uint16_t pkts_n) > NB_SEGS(pkt_buf) =3D j; > PORT(pkt_buf) =3D rxq->port_id; > PKT_LEN(pkt_buf) =3D pkt_buf_len; > +#ifdef RTE_NEXT_ABI > + pkt_buf->packet_type =3D rxq_cq_to_pkt_type(flags); #endif > pkt_buf->ol_flags =3D rxq_cq_to_ol_flags(rxq, flags); >=20 > /* Return packet. */ > @@ -2876,6 +2921,9 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkt= s, > uint16_t pkts_n) > NEXT(seg) =3D NULL; > PKT_LEN(seg) =3D len; > DATA_LEN(seg) =3D len; > +#ifdef RTE_NEXT_ABI > + seg->packet_type =3D rxq_cq_to_pkt_type(flags); #endif > seg->ol_flags =3D rxq_cq_to_ol_flags(rxq, flags); >=20 > /* Return packet. */ > -- > 2.4.2