[dpdk-dev] [PATCH v2 15/39] examples/ipsec-secgw: convert to new ethdev offloads API

Shahaf Shuler shahafs at mellanox.com
Thu Dec 21 14:45:05 CET 2017


Hi Pablo and maintainers of ipsec-secgw,

Tuesday, December 19, 2017 2:39 PM, De Lara Guarch, Pablo
> > diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-
> > secgw/ipsec-secgw.c index c98454a..1e8af8d 100644
> > --- a/examples/ipsec-secgw/ipsec-secgw.c
> > +++ b/examples/ipsec-secgw/ipsec-secgw.c
> > @@ -217,6 +217,9 @@ struct lcore_conf {
> >  	},
> >  	.txmode = {
> >  		.mq_mode = ETH_MQ_TX_NONE,
> > +		.offloads = (DEV_TX_OFFLOAD_IPV4_CKSUM |
> > +			     DEV_TX_OFFLOAD_MULTI_SEGS |
> > +			     DEV_TX_OFFLOAD_MBUF_FAST_FREE),
> 
> Hi Shahaf,
> 
> Isn't this removing some checksums that were previously done?
> Txq_flags was set to 0, which means that SCTP, UDP... checksums are
> disabled now?

You are right that before txqflags were 0, but it doesn't seem the application uses any Tx checksum offload beside IPv4, as seen on snipped code[1].
If I was mistaken and it does uses L4 checksums then I will need to update this commit. 

Maintainers of this examples - can you confirm?

[1]
static inline void                                                           
prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port)                          
{                                                                            
        struct ip *ip;                                                       
        struct ether_hdr *ethhdr;                                            
                                                                             
        ip = rte_pktmbuf_mtod(pkt, struct ip *);                             
                                                                             
        ethhdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN);
                                                                             
        if (ip->ip_v == IPVERSION) {                                         
                pkt->ol_flags |= PKT_TX_IP_CKSUM | PKT_TX_IPV4;              
                pkt->l3_len = sizeof(struct ip);                             
                pkt->l2_len = ETHER_HDR_LEN;                                 
                                                                             
                ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4);      
        } else {                                                             
                pkt->ol_flags |= PKT_TX_IPV6;                                
                pkt->l3_len = sizeof(struct ip6_hdr);                        
                pkt->l2_len = ETHER_HDR_LEN;                                 
                                                                             
                ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6);      
        }                                                                    
                                                                             
        memcpy(&ethhdr->s_addr, &ethaddr_tbl[port].src,                      
                        sizeof(struct ether_addr));                          
        memcpy(&ethhdr->d_addr, &ethaddr_tbl[port].dst,                      
                        sizeof(struct ether_addr));                          
}                                                                            

> 
> Regards,
> Pablo
> 



More information about the dev mailing list