[dpdk-dev] [PATCH 2/5] gso/lib: add TCP/IPv4 GSO support

Jiayu Hu jiayu.hu at intel.com
Wed Aug 30 11:03:13 CEST 2017


Hi Konstantin,

On Wed, Aug 30, 2017 at 09:38:33AM +0800, Ananyev, Konstantin wrote:
> 
> 
> > -----Original Message-----
> > From: Hu, Jiayu
> > Sent: Thursday, August 24, 2017 3:16 PM
> > To: dev at dpdk.org
> > Cc: Kavanagh, Mark B <mark.b.kavanagh at intel.com>; Ananyev, Konstantin <konstantin.ananyev at intel.com>; Tan, Jianfeng
> > <jianfeng.tan at intel.com>; Hu, Jiayu <jiayu.hu at intel.com>
> > Subject: [PATCH 2/5] gso/lib: add TCP/IPv4 GSO support
> > 
> > This patch adds GSO support for TCP/IPv4 packets. Supported packets
> > may include a single VLAN tag. TCP/IPv4 GSO assumes that all input
> > packets have correct checksums, and doesn't update checksums for output
> > packets (the responsibility for this lies with the application).
> > Additionally, TCP/IPv4 GSO doesn't process IP fragmented packets.
> > 
> > TCP/IPv4 GSO uses two chained MBUFs, one direct MBUF and one indrect
> > MBUF, to organize an output packet. Note that we refer to these two
> > chained MBUFs as a two-segment MBUF. The direct MBUF stores the packet
> > header, while the indirect mbuf simply points to a location within the
> > original packet's payload. Consequently, use of the GSO library requires
> > multi-segment MBUF support in the TX functions of the NIC driver.
> > 
> > If a packet is GSOed, TCP/IPv4 GSO reduces its MBUF refcnt by 1. As a
> > result, when all of its GSOed segments are freed, the packet is freed
> > automatically.
> > 
> > Signed-off-by: Jiayu Hu <jiayu.hu at intel.com>
> > Signed-off-by: Mark Kavanagh <mark.b.kavanagh at intel.com>
> > ---
> >  int
> >  rte_gso_segment(struct rte_mbuf *pkt,
> >  		struct rte_gso_ctx gso_ctx,
> >  		struct rte_mbuf **pkts_out,
> > -		uint16_t nb_pkts_out __rte_unused)
> > +		uint16_t nb_pkts_out)
> >  {
> > +	struct rte_mempool *direct_pool, *indirect_pool;
> > +	struct rte_mbuf *pkt_seg;
> > +	uint16_t nb_segments, gso_size;
> > +
> >  	if (pkt == NULL || pkts_out == NULL || gso_ctx.direct_pool ==
> >  			NULL || gso_ctx.indirect_pool == NULL)
> >  		return -EINVAL;
> 
> Probably we don't need to check gso_ctx values for each incoming packet.
> If you feel it is necessary - create  new function rte_gso_ctx_check() that
> could be performed just once per ctx.
> 
> > 
> > -	return 1;
> > +	if ((gso_ctx.gso_types & RTE_GSO_TCP_IPV4) == 0 ||
> > +			gso_ctx.gso_size >= pkt->pkt_len ||
> > +			gso_ctx.gso_size == 0)
> 
> 
> First and third condition seems redundant.

Yes, we don't need the first and the third check here. Please ingore the redundant
reply in the previous mail.

Thanks,
Jiayu


More information about the dev mailing list