[dpdk-dev] [PATCH v5 5/5] examples/l3fwd-power: support virtio/vhost
Li, Miao
miao.li at intel.com
Fri Oct 15 10:51:48 CEST 2021
Hi Chenbo,
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia at intel.com>
> Sent: Friday, October 15, 2021 4:14 PM
> To: Li, Miao <miao.li at intel.com>; dev at dpdk.org
> Cc: maxime.coquelin at redhat.com
> Subject: RE: [PATCH v5 5/5] examples/l3fwd-power: support virtio/vhost
>
> > -----Original Message-----
> > From: Li, Miao <miao.li at intel.com>
> > Sent: Friday, October 15, 2021 11:12 PM
> > To: dev at dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia at intel.com>; maxime.coquelin at redhat.com; Li,
> Miao
> > <miao.li at intel.com>
> > Subject: [PATCH v5 5/5] examples/l3fwd-power: support virtio/vhost
> >
> > In l3fwd-power, there is default port configuration which requires
> > RSS and IPV4/UDP/TCP checksum. Once device does not support these,
> > the l3fwd-power will exit and report an error.
> > This patch updates the port configuration based on device capabilities
> > after getting the device information to support devices like virtio
> > and vhost.
> >
> > Signed-off-by: Miao Li <miao.li at intel.com>
> > ---
> > examples/l3fwd-power/main.c | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> > index 73a3ab5bc0..61c15e01d2 100644
> > --- a/examples/l3fwd-power/main.c
> > +++ b/examples/l3fwd-power/main.c
> > @@ -505,7 +505,9 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t
> > link_len)
> > return -1;
> >
> > /* 2. The IP checksum must be correct. */
> > - /* this is checked in H/W */
> > + /* if this is not checked in H/W, check it. */
> > + if ((port_conf.rxmode.offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) == 0)
> > + rte_ipv4_cksum(pkt);
>
> This is not correct. The correct handling should be:
>
> 1. get actual cksum from pkt and save it
> 2. set pkt cksum to zero
> 3. compute correct cksum using rte_ipv4_cksum
> 4. compare to know if actual cksum == correct cksum
>
> You can refer to test_ipsec_l3_csum_verify in test_cryptodev_security_ipsec.c
>
> Thanks,
> Chenbo
I will fix it in the next version.
Thanks,
Miao
>
> >
> > /*
> > * 3. The IP version number must be 4. If the version number is not 4
> > @@ -2637,6 +2639,11 @@ main(int argc, char **argv)
> > local_port_conf.rx_adv_conf.rss_conf.rss_hf);
> > }
> >
> > + if (local_port_conf.rx_adv_conf.rss_conf.rss_hf == 0)
> > + local_port_conf.rxmode.mq_mode =
> ETH_MQ_RX_NONE;
> > + local_port_conf.rxmode.offloads &= dev_info.rx_offload_capa;
> > + port_conf.rxmode.offloads = local_port_conf.rxmode.offloads;
> > +
> > ret = rte_eth_dev_configure(portid, nb_rx_queue,
> > (uint16_t)n_tx_queue,
> &local_port_conf);
> > if (ret < 0)
> > --
> > 2.25.1
More information about the dev
mailing list