[1/7] examples/ipsec-secgw: add ol_flags support

Message ID 20210903112257.303961-2-radu.nicolau@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series IPsec Sec GW new features |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Radu Nicolau Sept. 3, 2021, 11:22 a.m. UTC
  Add support for ol_flags to the IPsec GW sample app.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 examples/ipsec-secgw/ipsec-secgw.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
  

Comments

Akhil Goyal Sept. 8, 2021, 12:48 p.m. UTC | #1
> Add support for ol_flags to the IPsec GW sample app.

Description is not appropriate.
ol_flags are supported to do what?
How the existing code was not good and
what benefit do we get from this patch?

> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
>  examples/ipsec-secgw/ipsec-secgw.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-
> secgw/ipsec-secgw.c
> index f252d34985..6d516e2221 100644
> --- a/examples/ipsec-secgw/ipsec-secgw.c
> +++ b/examples/ipsec-secgw/ipsec-secgw.c
> @@ -515,7 +515,7 @@ prepare_traffic(struct rte_mbuf **pkts, struct
> ipsec_traffic *t,
> 
>  static inline void
>  prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port,
> -		const struct lcore_conf *qconf)
> +		const struct lcore_conf *qconf __rte_unused)
>  {
>  	struct ip *ip;
>  	struct rte_ether_hdr *ethhdr;
> @@ -526,20 +526,17 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t
> port,
>  		rte_pktmbuf_prepend(pkt, RTE_ETHER_HDR_LEN);
> 
>  	if (ip->ip_v == IPVERSION) {
> -		pkt->ol_flags |= qconf->outbound.ipv4_offloads;
> -		pkt->l3_len = sizeof(struct ip);
>  		pkt->l2_len = RTE_ETHER_HDR_LEN;
> 
> -		ip->ip_sum = 0;
> -
>  		/* calculate IPv4 cksum in SW */
> -		if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0)
> +		if ((pkt->ol_flags &
> +				(PKT_TX_IP_CKSUM |
> PKT_TX_OUTER_IP_CKSUM)) == 0)
>  			ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr
> *)ip);
> +		else
> +			ip->ip_sum = 0;
> 
>  		ethhdr->ether_type =
> rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
>  	} else {
> -		pkt->ol_flags |= qconf->outbound.ipv6_offloads;
> -		pkt->l3_len = sizeof(struct ip6_hdr);
>  		pkt->l2_len = RTE_ETHER_HDR_LEN;
> 
>  		ethhdr->ether_type =
> rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
> --
> 2.25.1
  
Radu Nicolau Sept. 9, 2021, 8:57 a.m. UTC | #2
Hi Akhil,

On 9/8/2021 1:48 PM, Akhil Goyal wrote:
>> Add support for ol_flags to the IPsec GW sample app.
> Description is not appropriate.
> ol_flags are supported to do what?
> How the existing code was not good and
> what benefit do we get from this patch?
>
Thanks for reviewing the series! I will address your feedback for all 
the patches in the v2.
  

Patch

diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index f252d34985..6d516e2221 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -515,7 +515,7 @@  prepare_traffic(struct rte_mbuf **pkts, struct ipsec_traffic *t,
 
 static inline void
 prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port,
-		const struct lcore_conf *qconf)
+		const struct lcore_conf *qconf __rte_unused)
 {
 	struct ip *ip;
 	struct rte_ether_hdr *ethhdr;
@@ -526,20 +526,17 @@  prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port,
 		rte_pktmbuf_prepend(pkt, RTE_ETHER_HDR_LEN);
 
 	if (ip->ip_v == IPVERSION) {
-		pkt->ol_flags |= qconf->outbound.ipv4_offloads;
-		pkt->l3_len = sizeof(struct ip);
 		pkt->l2_len = RTE_ETHER_HDR_LEN;
 
-		ip->ip_sum = 0;
-
 		/* calculate IPv4 cksum in SW */
-		if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0)
+		if ((pkt->ol_flags &
+				(PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)) == 0)
 			ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr *)ip);
+		else
+			ip->ip_sum = 0;
 
 		ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
 	} else {
-		pkt->ol_flags |= qconf->outbound.ipv6_offloads;
-		pkt->l3_len = sizeof(struct ip6_hdr);
 		pkt->l2_len = RTE_ETHER_HDR_LEN;
 
 		ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);