examples/ipsec-secgw: update error prints to data path log
PATCH 1/4 examples/ipsec-secgw: update error prints to data path log
Update error prints in data path to RTE_LOG_DP(). Error prints in fast path are not good for performance as they slow down the application when few bad packets are received.
--- examples/ipsec-secgw/ipsec_worker.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
examples/ipsec-secgw/ipsec_worker.c +4 -2
@@ -332,7 +332,8 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,break ;default : -RTE_LOG (ERR ,IPSEC ,"Unsupported packet type = %d\n" , type); +RTE_LOG_DP (DEBUG ,IPSEC_ESP ,"Unsupported packet type = %d\n" , + type); goto drop_pkt_and_exit; }
@@ -570,7 +571,8 @@ classify_pkt(struct rte_mbuf *pkt, struct ipsec_traffic *t) t->ip6.pkts[(t->ip6.num)++] = pkt;break ;default : -RTE_LOG (ERR ,IPSEC ,"Unsupported packet type = %d\n" , type); +RTE_LOG_DP (DEBUG ,IPSEC_ESP ,"Unsupported packet type = %d\n" , + type);free_pkts (&pkt,1 );break ; }
Signature · 1 line
2.8.4
PATCH 2/4 examples/ipsec-secgw: disable Tx chksum offload for inline
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW. The advantage of having only necessary offloads enabled is that Tx burst function can be as light as possible.
--- examples/ipsec-secgw/ipsec-secgw.c | 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)
examples/ipsec-secgw/ipsec-secgw.c +0 -3
@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; -if (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; - printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n", portid, local_port_conf.rxmode.offloads,
examples/ipsec-secgw/sa.c +9 -0
@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |=RTE_ETH_TX_OFFLOAD_SECURITY ; + +/* Checksum offload is not needed for inline protocol as +* all processing for Outbound IPSec packets will be +* implicitly taken care and for non-IPSec packets, +* there is no need of IPv4 Checksum offload. +*/ +if (rule_type ==RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ) + *tx_offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; +if (rule->mss) *tx_offloads |=RTE_ETH_TX_OFFLOAD_TCP_TSO ; }
Signature · 1 line
2.8.4
RE: [PATCH 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline
Quoted 4 lines
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW.
Why is that?
These is two separate HW offload and user has to enable each of them explicitly. Also we can TX clear-text traffic.
Quoted 45 lines
The advantage of having only necessary
offloads enabled is that Tx burst function can be as light as possible.Signed-off-by Nithin Dabilpuram <[email protected]>--- examples/ipsec-secgw/ipsec-secgw.c | 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)examples/ipsec-secgw/ipsec-secgw.c +0
-3@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; -if (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; - printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n", portid, local_port_conf.rxmode.offloads,examples/ipsec-secgw/sa.c +9
-1@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |=RTE_ETH_TX_OFFLOAD_SECURITY ; + +/* Checksum offload is not needed for inline protocol as +* all processing for Outbound IPSec packets will be +* implicitly taken care and for non-IPSec packets, +* there is no need of IPv4 Checksum offload. +*/ +if (rule_type ==RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ) + *tx_offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; +if (rule->mss) *tx_offloads |=RTE_ETH_TX_OFFLOAD_TCP_TSO ; } --2.8.4
Re: [PATCH 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline
Quoted 7 lines · Konstantin
Quoted 4 lines
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW.
Why is that?
These is two separate HW offload and user has to enable each of them explicitly.
In Inline IPSec protocol offload, the complete tunnel header for tunnel mode is updated by HW/PMD. So it doesn't have any dependency on RTE_ETH_TX_OFFLOAD_IPV4_CKSUM as there is no valid l2_len/l3_len yet in the mbuf. Similarly in case of Transport mode, the IPv4 header is updated by HW itself for next proto and hence the offsets and all can vary based on the HW implementation.
Hence my thought was for Inline IPsec protocol offload, there is no need to explicitly say that RTE_ETH_TX_OFFLOAD_IPV4_CKSUM is enabled and need not provide ol_flags RTE_MBUF_F_TX_IP_CKSUM and l2_len and l3_len which might not be correct in prepare_tx_pkt().
Quoted 2 lines
*
RTE_MBUF_F_TX_IP_CKSUM.
* - fill the mbuf offload information:l2_len,l3_len
(Ex: Tunnel header being inserted is IPv6 while inner header is IPv4.
For inline crypto I agree, the packet content is all in place except for plain text->cipher text translation so l2/l3 offsets are valid.
Quoted 1 line
Also we can TX clear-text traffic.
Ok, I agree that we can have clear-text traffic. We are already handling ipv4 checksum in SW in case Tx offload doesn't have IPv4 Checksum offload enabled. And for clear text traffic I think that is not needed as well as we are not updating ttl.
My overall intention was to have lighter Tx burst function for Inline IPsec protocol offload as mainly IPsec traffic and not plain traffic is primary use case for ipsec-secgw.
Quoted 47 lines
Quoted 46 lines
The advantage of having only necessary
offloads enabled is that Tx burst function can be as light as possible.Signed-off-by Nithin Dabilpuram <[email protected]>--- examples/ipsec-secgw/ipsec-secgw.c | 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)examples/ipsec-secgw/ipsec-secgw.c +0
-3@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; -if (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; - printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n", portid, local_port_conf.rxmode.offloads,examples/ipsec-secgw/sa.c +9
-1@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |=RTE_ETH_TX_OFFLOAD_SECURITY ; + +/* Checksum offload is not needed for inline protocol as +* all processing for Outbound IPSec packets will be +* implicitly taken care and for non-IPSec packets, +* there is no need of IPv4 Checksum offload. +*/ +if (rule_type ==RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ) + *tx_offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; +if (rule->mss) *tx_offloads |=RTE_ETH_TX_OFFLOAD_TCP_TSO ; } --2.8.4
RE: [PATCH 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline
Quoted 21 lines
Quoted 7 lines
Quoted 4 lines
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW.
Why is that?
These is two separate HW offload and user has to enable each of them explicitly.In Inline IPSec protocol offload, the complete tunnel header for tunnel mode is updated by HW/PMD. So it doesn't have any dependency on
RTE_ETH_TX_OFFLOAD_IPV4_CKSUMas there is no valid l2_len/l3_len yet in the mbuf. Similarly in case of Transport mode, the IPv4 header is updated by HW itself for next proto and hence the offsets and all can vary based on the HW implementation.Hence my thought was for Inline IPsec protocol offload, there is no need to explicitly say that
RTE_ETH_TX_OFFLOAD_IPV4_CKSUMis enabled and need not provideol_flagsRTE_MBUF_F_TX_IP_CKSUMandl2_lenandl3_lenwhich might not be correct inprepare_tx_pkt().
Quoted 6 lines
Quoted 2 lines
*
RTE_MBUF_F_TX_IP_CKSUM.
* - fill the mbuf offload information:l2_len,l3_len(Ex: Tunnel header being inserted is IPv6 while inner header is IPv4.
For inline crypto I agree, the packet content is all in place except for plain
text->ciphertext translation so l2/l3 offsets are valid.
Ok, but apart from inline modes we also have lookaside modes. Why to disable ip cksum for them?
Quoted 6 lines
Quoted 2 lines
Also we can TX clear-text traffic.
Ok, I agree that we can have clear-text traffic. We are already handling ipv4 checksum in SW in case Tx offload doesn't have IPv4 Checksum offload enabled. And for clear text traffic I think that is not needed as well as we are not updating ttl.
As I remember we always recalculate ip cksum if RTE_MBUF_F_TX_IP_CKSUM is not set:
static inline void
prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port,
const struct lcore_conf *qconf)
{
struct ip *ip;
struct rte_ether_hdr *ethhdr;
ip = rte_pktmbuf_mtod(pkt, struct ip *);
ethhdr = (struct rte_ether_hdr *)
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 & RTE_MBUF_F_TX_IP_CKSUM) == 0)
ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr *)ip);...
Quoted 54 lines
My overall intention was to have lighter Tx burst function for Inline IPsec protocol offload as mainly IPsec traffic and not plain traffic is primary use case for ipsec-secgw.
Quoted 47 lines
Quoted 46 lines
The advantage of having only necessary
offloads enabled is that Tx burst function can be as light as possible.Signed-off-by Nithin Dabilpuram <[email protected]>--- examples/ipsec-secgw/ipsec-secgw.c | 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)examples/ipsec-secgw/ipsec-secgw.c +0
-3@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; -if (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; - printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n", portid, local_port_conf.rxmode.offloads,examples/ipsec-secgw/sa.c +9
-1@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |=RTE_ETH_TX_OFFLOAD_SECURITY ; + +/* Checksum offload is not needed for inline protocol as +* all processing for Outbound IPSec packets will be +* implicitly taken care and for non-IPSec packets, +* there is no need of IPv4 Checksum offload. +*/ +if (rule_type ==RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ) + *tx_offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; +if (rule->mss) *tx_offloads |=RTE_ETH_TX_OFFLOAD_TCP_TSO ; } --2.8.4
Re: [PATCH 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline
Quoted 25 lines · Konstantin
Quoted 25 lines
Quoted 7 lines
Quoted 4 lines
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW.
Why is that?
These is two separate HW offload and user has to enable each of them explicitly.In Inline IPSec protocol offload, the complete tunnel header for tunnel mode is updated by HW/PMD. So it doesn't have any dependency on
RTE_ETH_TX_OFFLOAD_IPV4_CKSUMas there is no valid l2_len/l3_len yet in the mbuf. Similarly in case of Transport mode, the IPv4 header is updated by HW itself for next proto and hence the offsets and all can vary based on the HW implementation.Hence my thought was for Inline IPsec protocol offload, there is no need to explicitly say that
RTE_ETH_TX_OFFLOAD_IPV4_CKSUMis enabled and need not provideol_flagsRTE_MBUF_F_TX_IP_CKSUMandl2_lenandl3_lenwhich might not be correct inprepare_tx_pkt().Quoted 2 lines
*
RTE_MBUF_F_TX_IP_CKSUM.
* - fill the mbuf offload information:l2_len,l3_len(Ex: Tunnel header being inserted is IPv6 while inner header is IPv4.
Quoted 5 lines
Quoted 2 lines
For inline crypto I agree, the packet content is all in place except for plain
text->ciphertext translation so l2/l3 offsets are valid.Ok, but apart from inline modes we also have lookaside modes. Why to disable ip cksum for them?
Ack, I missed that case. I'll make the change to enable Tx checksum offload enabled even for Lookaside crypto.
Quoted 34 lines
Quoted 7 lines
Quoted 3 lines
Also we can TX clear-text traffic.
Ok, I agree that we can have clear-text traffic. We are already handling ipv4 checksum in SW in case Tx offload doesn't have IPv4 Checksum offload enabled. And for clear text traffic I think that is not needed as well as we are not updating ttl.
As I remember we always recalculate ip cksum if
RTE_MBUF_F_TX_IP_CKSUMis not set:static inline void
prepare_tx_pkt(structrte_mbuf*pkt,uint16_tport,
const structlcore_conf*qconf){ struct ip *ip; struct rte_ether_hdr *ethhdr; ip = rte_pktmbuf_mtod(pkt, struct ip *); ethhdr = (struct rte_ether_hdr *) 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 & RTE_MBUF_F_TX_IP_CKSUM) == 0) ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr *)ip);
Quoted 2 lines
...
I'm working on another series to restructure fast path based on different mode. As part of that, I think we can avoid checksum recalculation in cases of inline protocol offload.
Quoted 54 lines
Quoted 54 lines
My overall intention was to have lighter Tx burst function for Inline IPsec protocol offload as mainly IPsec traffic and not plain traffic is primary use case for ipsec-secgw.
Quoted 47 lines
Quoted 46 lines
The advantage of having only necessary
offloads enabled is that Tx burst function can be as light as possible.Signed-off-by Nithin Dabilpuram <[email protected]>--- examples/ipsec-secgw/ipsec-secgw.c | 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)examples/ipsec-secgw/ipsec-secgw.c +0
-3@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; -if (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; - printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n", portid, local_port_conf.rxmode.offloads,examples/ipsec-secgw/sa.c +9
-1@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |=RTE_ETH_TX_OFFLOAD_SECURITY ; + +/* Checksum offload is not needed for inline protocol as +* all processing for Outbound IPSec packets will be +* implicitly taken care and for non-IPSec packets, +* there is no need of IPv4 Checksum offload. +*/ +if (rule_type ==RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ) + *tx_offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; +if (rule->mss) *tx_offloads |=RTE_ETH_TX_OFFLOAD_TCP_TSO ; } --2.8.4
Re: [PATCH 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline
Quoted 66 lines · Nithin Kumar Dabilpuram
Quoted 25 lines · Konstantin
Quoted 25 lines
Quoted 7 lines
Quoted 4 lines
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW.
Why is that?
These is two separate HW offload and user has to enable each of them explicitly.In Inline IPSec protocol offload, the complete tunnel header for tunnel mode is updated by HW/PMD. So it doesn't have any dependency on
RTE_ETH_TX_OFFLOAD_IPV4_CKSUMas there is no valid l2_len/l3_len yet in the mbuf. Similarly in case of Transport mode, the IPv4 header is updated by HW itself for next proto and hence the offsets and all can vary based on the HW implementation.Hence my thought was for Inline IPsec protocol offload, there is no need to explicitly say that
RTE_ETH_TX_OFFLOAD_IPV4_CKSUMis enabled and need not provideol_flagsRTE_MBUF_F_TX_IP_CKSUMandl2_lenandl3_lenwhich might not be correct inprepare_tx_pkt().>*
RTE_MBUF_F_TX_IP_CKSUM.
> * - fill the mbuf offload information:l2_len,l3_len(Ex: Tunnel header being inserted is IPv6 while inner header is IPv4.Quoted 5 lines
Quoted 2 lines
For inline crypto I agree, the packet content is all in place except for plain
text->ciphertext translation so l2/l3 offsets are valid.Ok, but apart from inline modes we also have lookaside modes. Why to disable ip cksum for them?
Ack, I missed that case. I'll make the change to enable Tx checksum offload enabled even for Lookaside crypto.
Quoted 30 lines
Quoted 7 lines
> Also we can TX clear-text traffic.
Ok, I agree that we can have clear-text traffic. We are already handling ipv4 checksum in SW in case Tx offload doesn't have IPv4 Checksum offload enabled. And for clear text traffic I think that is not needed as well as we are not updating ttl.As I remember we always recalculate ip cksum if
RTE_MBUF_F_TX_IP_CKSUMis not set:static inline void
prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, const struct lcore_conf *qconf){
struct ip *ip;
structrte_ether_hdr*ethhdr;ip =
rte_pktmbuf_mtod(pkt, struct ip *);ethhdr = (struct
rte_ether_hdr*)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;
Quoted 8 lines
Quoted 6 lines
/* calculate IPv4 cksum in SW */
if ((pkt->ol_flags&RTE_MBUF_F_TX_IP_CKSUM) == 0)ip->ip_sum=rte_ipv4_cksum((struct rte_ipv4_hdr *)ip);...
I'm working on another series to restructure fast path based on different mode. As part of that, I think we can avoid checksum recalculation in cases of inline protocol offload.
I removed this patch from v3 of this series. I'll included it in other series that I'm working on to have separate worker thread when all SA's are of particular mode. There we can avoid checksum recalculation
completely both in SW and HW.
Thanks
Nithin
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
My overall intention was to have lighter Tx burst function for Inline IPsec protocol offload as mainly IPsec traffic and not plain traffic is primary use case for ipsec-secgw.
Quoted 50 lines
Quoted 49 lines
The advantage of having only necessary
offloads enabled is that Tx burst function can be as light as possible.Signed-off-by Nithin Dabilpuram <[email protected]>---
examples/ipsec-secgw/ipsec-secgw.c| 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++2 files changed, 9 insertions(+), 3 deletions(-)examples/ipsec-secgw/ipsec-secgw.c +0
-0@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads)local_port_conf.txmode.offloads |=
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;- if (dev_info.tx_offload_capa &
RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
-
printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n",
portid, local_port_conf.rxmode.offloads,examples/ipsec-secgw/sa.c +9
-0@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |= RTE_ETH_TX_OFFLOAD_SECURITY; + + /* Checksum offload is not needed for inline protocol as + * all processing for Outbound IPSec packets will be + * implicitly taken care and for non-IPSec packets, + * there is no need of IPv4 Checksum offload. + */ + if (rule_type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO) + *tx_offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM; + if (rule->mss) *tx_offloads |= RTE_ETH_TX_OFFLOAD_TCP_TSO;}
Signature · 1 line
2.8.4
PATCH 3/4 examples/ipsec-secgw: fix buffer free logic in vector mode
In reply to Nithin DabilpuramFix packet processing to skip after mbuf is freed instead of touching and Tx'ing it.
Also free vector event buffer in event worker when after processing there is no pkt to be enqueued to Tx adapter.
--- examples/ipsec-secgw/ipsec_worker.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
examples/ipsec-secgw/ipsec_worker.c +12 -3
@@ -205,12 +205,16 @@ check_sp_sa_bulk(struct sp_ctx *sp, struct sa_ctx *sa_ctx, ip->pkts[j++] = m; else { sa = *(struct ipsec_sa **)rte_security_dynfield (m); -if (sa ==NULL ) +if (sa ==NULL ) {free_pkts (&m,1 ); +continue ; + }/* SPI on the packet should match with the one in SA */ -if (unlikely (sa->spi != sa_ctx->sa[res -1 ].spi)) +if (unlikely (sa->spi != sa_ctx->sa[res -1 ].spi)) {free_pkts (&m,1 ); +continue ; + } ip->pkts[j++] = m; }
@@ -536,6 +540,7 @@ ipsec_ev_route_pkts(struct rte_event_vector *vec, struct route_table *rt, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)) {RTE_LOG (ERR ,IPSEC ,"SA type not supported\n" );free_pkts (&pkt,1 ); +continue ; }rte_security_set_pkt_metadata (sess->security.ctx, sess->security.ses, pkt,NULL );
@@ -695,11 +700,13 @@ ipsec_ev_vector_process(struct lcore_conf_ev_tx_int_port_wrkr *lconf, ret =process_ipsec_ev_outbound_vector (&lconf->outbound, &lconf->rt, vec); -if (ret >0 ) { +if (likely (ret >0 )) { vec->nb_elem = ret;rte_event_eth_tx_adapter_enqueue (links[0 ].eventdev_id, links[0 ].event_port_id, ev,1 ,0 ); + }else { +rte_mempool_put (rte_mempool_from_obj (vec), vec); } }
@@ -720,6 +727,8 @@ ipsec_ev_vector_drv_mode_process(struct eh_event_link_info *links,rte_event_eth_tx_adapter_enqueue (links[0 ].eventdev_id, links[0 ].event_port_id, ev,1 ,0 ); + else +rte_mempool_put (rte_mempool_from_obj (vec ),vec ); }/*
Signature · 1 line
2.8.4
PATCH 4/4 examples/ipsec-secgw: add per port pool and vector pool size
In reply to Nithin DabilpuramAdd support to enable per port packet pool and also override vector pool size from command line args. This is useful on some HW to tune performance based on usecase.
--- examples/ipsec-secgw/event_helper.c | 17 ++++++-- examples/ipsec-secgw/event_helper.h | 2 + examples/ipsec-secgw/ipsec-secgw.c | 80 ++++++++++++++++++++++++++++--------- examples/ipsec-secgw/ipsec-secgw.h | 2 + examples/ipsec-secgw/ipsec.h | 2 +- 5 files changed, 80 insertions(+), 23 deletions(-)
examples/ipsec-secgw/event_helper.c +14 -3
@@ -792,8 +792,8 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,uint32_t service_id, socket_id, nb_elem;struct rte_mempool *vector_pool =NULL ;uint32_t lcore_id =rte_lcore_id (); +int ret, portid, nb_ports =0 ;uint8_t eventdev_id; -int ret;int j;/* Get event dev ID */
@@ -806,10 +806,21 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,return ret; } + RTE_ETH_FOREACH_DEV(portid) + if ((em_conf->eth_portmask & (1 << portid))) + nb_ports++; +if (em_conf->ext_params.event_vector) { socket_id =rte_lcore_to_socket_id (lcore_id); - nb_elem = (nb_bufs_in_pool / em_conf->ext_params.vector_size) - +1 ; + +if (em_conf->vector_pool_sz) { + nb_elem = em_conf->vector_pool_sz; + }else { + nb_elem = (nb_bufs_in_pool / + em_conf->ext_params.vector_size) +1 ; +if (per_port_pool) + nb_elem = nb_ports * nb_elem; + } vector_pool = rte_event_vector_pool_create( "vector_pool", nb_elem, 0,
examples/ipsec-secgw/event_helper.h +2 -0
@@ -183,6 +183,8 @@ struct eventmode_conf {/**< 64 bit field to specify extended params */ uint64_t vector_tmo_ns;/**< Max vector timeout in nanoseconds */ +uint64_t vector_pool_sz; +/**< Vector pool size */ };/**
examples/ipsec-secgw/ipsec-secgw.c +61 -19
177 lines not on this page · raw message
examples/ipsec-secgw/ipsec-secgw.h +2 -0
@@ -134,6 +134,8 @@ extern volatile bool force_quit;extern uint32_t nb_bufs_in_pool; +extern bool per_port_pool; +static inline uint8_t is_unprotected_port (uint16_t port_id) {
examples/ipsec-secgw/ipsec.h +1 -1
@@ -248,7 +248,7 @@ struct socket_ctx {struct sp_ctx *sp_ip6_out;struct rt_ctx *rt_ip4;struct rt_ctx *rt_ip6; -struct rte_mempool *mbuf_pool; +struct rte_mempool *mbuf_pool[RTE_MAX_ETHPORTS ];struct rte_mempool *mbuf_pool_indir;struct rte_mempool *session_pool;struct rte_mempool *session_priv_pool;
Signature · 1 line
2.8.4
PATCH v2 1/4 examples/ipsec-secgw: update error prints to data path log
In reply to Nithin DabilpuramUpdate error prints in data path to RTE_LOG_DP(). Error prints in fast path are not good for performance as they slow down the application when few bad packets are received.
---
v2:
- Fixed issue with warning in patch 4/4 by checking for session pool initialization instead of mbuf_pool as now mbuf pool is per port.
examples/ipsec-secgw/ipsec_worker.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
examples/ipsec-secgw/ipsec_worker.c +4 -2
@@ -332,7 +332,8 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,break ;default : -RTE_LOG (ERR ,IPSEC ,"Unsupported packet type = %d\n" , type); +RTE_LOG_DP (DEBUG ,IPSEC_ESP ,"Unsupported packet type = %d\n" , + type); goto drop_pkt_and_exit; }
@@ -570,7 +571,8 @@ classify_pkt(struct rte_mbuf *pkt, struct ipsec_traffic *t) t->ip6.pkts[(t->ip6.num)++] = pkt;break ;default : -RTE_LOG (ERR ,IPSEC ,"Unsupported packet type = %d\n" , type); +RTE_LOG_DP (DEBUG ,IPSEC_ESP ,"Unsupported packet type = %d\n" , + type);free_pkts (&pkt,1 );break ; }
Signature · 1 line
2.8.4
PATCH v2 2/4 examples/ipsec-secgw: disable Tx chksum offload for inline
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW. The advantage of having only necessary offloads enabled is that Tx burst function can be as light as possible.
--- examples/ipsec-secgw/ipsec-secgw.c | 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)
examples/ipsec-secgw/ipsec-secgw.c +0 -3
@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; -if (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; - printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n", portid, local_port_conf.rxmode.offloads,
examples/ipsec-secgw/sa.c +9 -0
@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |=RTE_ETH_TX_OFFLOAD_SECURITY ; + +/* Checksum offload is not needed for inline protocol as +* all processing for Outbound IPSec packets will be +* implicitly taken care and for non-IPSec packets, +* there is no need of IPv4 Checksum offload. +*/ +if (rule_type ==RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ) + *tx_offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; +if (rule->mss) *tx_offloads |=RTE_ETH_TX_OFFLOAD_TCP_TSO ; }
Signature · 1 line
2.8.4
RE: [PATCH v2 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline
Quoted 7 lines
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW. The advantage of having only necessary offloads enabled is that Tx burst function can be as light as possible.
Signed-off-by Nithin Dabilpuram <[email protected]>---
RE: [PATCH v2 2/4] examples/ipsec-secgw: disable Tx chksum offload for inline
In reply to Nithin DabilpuramQuoted 6 lines
Enable Tx IPv4 checksum offload only when Tx inline crypto is needed. In other cases such as Tx Inline protocol offload, checksum computation is implicitly taken care by HW. The advantage of having only necessary offloads enabled is that Tx burst function can be as light as possible.
I am still not sure this is a right thing to do. Could you explain what will happen for lookaside modes? Would they always fall-back to SW cksum calculation?
Quoted 43 lines
Signed-off-by Nithin Dabilpuram <[email protected]>--- examples/ipsec-secgw/ipsec-secgw.c | 3 --- examples/ipsec-secgw/sa.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)examples/ipsec-secgw/ipsec-secgw.c +0
-3@@ -2314,9 +2314,6 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE ; -if (dev_info.tx_offload_capa &RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ) - local_port_conf.txmode.offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; - printf("port %u configuring rx_offloads=0x%" PRIx64 ", tx_offloads=0x%" PRIx64 "\n", portid, local_port_conf.rxmode.offloads,examples/ipsec-secgw/sa.c +9
-1@@ -1790,6 +1790,15 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) && rule->portid == port_id) { *tx_offloads |=RTE_ETH_TX_OFFLOAD_SECURITY ; + +/* Checksum offload is not needed for inline protocol as +* all processing for Outbound IPSec packets will be +* implicitly taken care and for non-IPSec packets, +* there is no need of IPv4 Checksum offload. +*/ +if (rule_type ==RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ) + *tx_offloads |=RTE_ETH_TX_OFFLOAD_IPV4_CKSUM ; +if (rule->mss) *tx_offloads |=RTE_ETH_TX_OFFLOAD_TCP_TSO ; } --2.8.4
PATCH v2 3/4 examples/ipsec-secgw: fix buffer free logic in vector mode
In reply to Nithin DabilpuramFix packet processing to skip after mbuf is freed instead of touching and Tx'ing it.
Also free vector event buffer in event worker when after processing there is no pkt to be enqueued to Tx adapter.
--- examples/ipsec-secgw/ipsec_worker.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
examples/ipsec-secgw/ipsec_worker.c +12 -3
@@ -205,12 +205,16 @@ check_sp_sa_bulk(struct sp_ctx *sp, struct sa_ctx *sa_ctx, ip->pkts[j++] = m; else { sa = *(struct ipsec_sa **)rte_security_dynfield (m); -if (sa ==NULL ) +if (sa ==NULL ) {free_pkts (&m,1 ); +continue ; + }/* SPI on the packet should match with the one in SA */ -if (unlikely (sa->spi != sa_ctx->sa[res -1 ].spi)) +if (unlikely (sa->spi != sa_ctx->sa[res -1 ].spi)) {free_pkts (&m,1 ); +continue ; + } ip->pkts[j++] = m; }
@@ -536,6 +540,7 @@ ipsec_ev_route_pkts(struct rte_event_vector *vec, struct route_table *rt, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)) {RTE_LOG (ERR ,IPSEC ,"SA type not supported\n" );free_pkts (&pkt,1 ); +continue ; }rte_security_set_pkt_metadata (sess->security.ctx, sess->security.ses, pkt,NULL );
@@ -695,11 +700,13 @@ ipsec_ev_vector_process(struct lcore_conf_ev_tx_int_port_wrkr *lconf, ret =process_ipsec_ev_outbound_vector (&lconf->outbound, &lconf->rt, vec); -if (ret >0 ) { +if (likely (ret >0 )) { vec->nb_elem = ret;rte_event_eth_tx_adapter_enqueue (links[0 ].eventdev_id, links[0 ].event_port_id, ev,1 ,0 ); + }else { +rte_mempool_put (rte_mempool_from_obj (vec), vec); } }
@@ -720,6 +727,8 @@ ipsec_ev_vector_drv_mode_process(struct eh_event_link_info *links,rte_event_eth_tx_adapter_enqueue (links[0 ].eventdev_id, links[0 ].event_port_id, ev,1 ,0 ); + else +rte_mempool_put (rte_mempool_from_obj (vec ),vec ); }/*
Signature · 1 line
2.8.4
RE: [PATCH v2 3/4] examples/ipsec-secgw: fix buffer free logic in vector mode
Quoted 11 lines
Fix packet processing to skip after mbuf is freed instead of touching and Tx'ing it.
Also free vector event buffer in event worker when after processing there is no pkt to be enqueued to Tx adapter.
Fixes 86738ebe1e3d ("examples/ipsec-secgw: support event vector")Signed-off-by Nithin Dabilpuram <[email protected]>
PATCH v2 4/4 examples/ipsec-secgw: add per port pool and vector pool size
In reply to Nithin DabilpuramAdd support to enable per port packet pool and also override vector pool size from command line args. This is useful on some HW to tune performance based on usecase.
--- examples/ipsec-secgw/event_helper.c | 17 ++++++-- examples/ipsec-secgw/event_helper.h | 2 + examples/ipsec-secgw/ipsec-secgw.c | 82 ++++++++++++++++++++++++++++--------- examples/ipsec-secgw/ipsec-secgw.h | 2 + examples/ipsec-secgw/ipsec.h | 2 +- 5 files changed, 81 insertions(+), 24 deletions(-)
examples/ipsec-secgw/event_helper.c +14 -3
@@ -792,8 +792,8 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,uint32_t service_id, socket_id, nb_elem;struct rte_mempool *vector_pool =NULL ;uint32_t lcore_id =rte_lcore_id (); +int ret, portid, nb_ports =0 ;uint8_t eventdev_id; -int ret;int j;/* Get event dev ID */
@@ -806,10 +806,21 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,return ret; } + RTE_ETH_FOREACH_DEV(portid) + if ((em_conf->eth_portmask & (1 << portid))) + nb_ports++; +if (em_conf->ext_params.event_vector) { socket_id =rte_lcore_to_socket_id (lcore_id); - nb_elem = (nb_bufs_in_pool / em_conf->ext_params.vector_size) - +1 ; + +if (em_conf->vector_pool_sz) { + nb_elem = em_conf->vector_pool_sz; + }else { + nb_elem = (nb_bufs_in_pool / + em_conf->ext_params.vector_size) +1 ; +if (per_port_pool) + nb_elem = nb_ports * nb_elem; + } vector_pool = rte_event_vector_pool_create( "vector_pool", nb_elem, 0,
examples/ipsec-secgw/event_helper.h +2 -0
@@ -183,6 +183,8 @@ struct eventmode_conf {/**< 64 bit field to specify extended params */ uint64_t vector_tmo_ns;/**< Max vector timeout in nanoseconds */ +uint64_t vector_pool_sz; +/**< Vector pool size */ };/**
examples/ipsec-secgw/ipsec-secgw.c +62 -20
185 lines not on this page · raw message
examples/ipsec-secgw/ipsec-secgw.h +2 -0
@@ -134,6 +134,8 @@ extern volatile bool force_quit;extern uint32_t nb_bufs_in_pool; +extern bool per_port_pool; +static inline uint8_t is_unprotected_port (uint16_t port_id) {
examples/ipsec-secgw/ipsec.h +1 -1
@@ -248,7 +248,7 @@ struct socket_ctx {struct sp_ctx *sp_ip6_out;struct rt_ctx *rt_ip4;struct rt_ctx *rt_ip6; -struct rte_mempool *mbuf_pool; +struct rte_mempool *mbuf_pool[RTE_MAX_ETHPORTS ];struct rte_mempool *mbuf_pool_indir;struct rte_mempool *session_pool;struct rte_mempool *session_priv_pool;
Signature · 1 line
2.8.4
RE: [PATCH v2 4/4] examples/ipsec-secgw: add per port pool and vector pool size
Quoted 5 lines
Add support to enable per port packet pool and also override vector pool size from command line args. This is useful on some HW to tune performance based on usecase.
Signed-off-by Nithin Dabilpuram <[email protected]>
Quoted 8 lines
--- examples/ipsec-secgw/event_helper.c | 17 ++++++-- examples/ipsec-secgw/event_helper.h | 2 + examples/ipsec-secgw/ipsec-secgw.c | 82 ++++++++++++++++++++++++++++-- ------- examples/ipsec-secgw/ipsec-secgw.h | 2 + examples/ipsec-secgw/ipsec.h | 2 +- 5 files changed, 81 insertions(+), 24 deletions(-)
Documentation update missing for the new options added. Apart from that,
Quoted 8 lines
Update error prints in data path to
RTE_LOG_DP(). Error prints in fast path are not good for performance as they slow down the application when few bad packets are received.Signed-off-by Nithin Dabilpuram <[email protected]>---
PATCH v3 1/3 examples/ipsec-secgw: update error prints to data path log
In reply to Nithin DabilpuramUpdate error prints in data path to RTE_LOG_DP(). Error prints in fast path are not good for performance as they slow down the application when few bad packets are received.
---
v2:
- Fixed issue with warning in patch 4/4 by checking for session pool initialization instead of mbuf_pool as now mbuf pool is per port.
v3:
- Removed patch 2/4 from this series. Will send it with other series that adds seperate worker thread for ipsec-secgw if all SA's are from inline protocol.
- Added documentation for patch 4/4.
examples/ipsec-secgw/ipsec_worker.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
examples/ipsec-secgw/ipsec_worker.c +4 -2
@@ -332,7 +332,8 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt,break ;default : -RTE_LOG (ERR ,IPSEC ,"Unsupported packet type = %d\n" , type); +RTE_LOG_DP (DEBUG ,IPSEC_ESP ,"Unsupported packet type = %d\n" , + type); goto drop_pkt_and_exit; }
@@ -570,7 +571,8 @@ classify_pkt(struct rte_mbuf *pkt, struct ipsec_traffic *t) t->ip6.pkts[(t->ip6.num)++] = pkt;break ;default : -RTE_LOG (ERR ,IPSEC ,"Unsupported packet type = %d\n" , type); +RTE_LOG_DP (DEBUG ,IPSEC_ESP ,"Unsupported packet type = %d\n" , + type);free_pkts (&pkt,1 );break ; }
Signature · 1 line
2.8.4
PATCH v3 2/3 examples/ipsec-secgw: fix buffer free logic in vector mode
Fix packet processing to skip after mbuf is freed instead of touching and Tx'ing it.
Also free vector event buffer in event worker when after processing there is no pkt to be enqueued to Tx adapter.
--- examples/ipsec-secgw/ipsec_worker.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
examples/ipsec-secgw/ipsec_worker.c +12 -3
@@ -205,12 +205,16 @@ check_sp_sa_bulk(struct sp_ctx *sp, struct sa_ctx *sa_ctx, ip->pkts[j++] = m; else { sa = *(struct ipsec_sa **)rte_security_dynfield (m); -if (sa ==NULL ) +if (sa ==NULL ) {free_pkts (&m,1 ); +continue ; + }/* SPI on the packet should match with the one in SA */ -if (unlikely (sa->spi != sa_ctx->sa[res -1 ].spi)) +if (unlikely (sa->spi != sa_ctx->sa[res -1 ].spi)) {free_pkts (&m,1 ); +continue ; + } ip->pkts[j++] = m; }
@@ -536,6 +540,7 @@ ipsec_ev_route_pkts(struct rte_event_vector *vec, struct route_table *rt, RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)) {RTE_LOG (ERR ,IPSEC ,"SA type not supported\n" );free_pkts (&pkt,1 ); +continue ; }rte_security_set_pkt_metadata (sess->security.ctx, sess->security.ses, pkt,NULL );
@@ -695,11 +700,13 @@ ipsec_ev_vector_process(struct lcore_conf_ev_tx_int_port_wrkr *lconf, ret =process_ipsec_ev_outbound_vector (&lconf->outbound, &lconf->rt, vec); -if (ret >0 ) { +if (likely (ret >0 )) { vec->nb_elem = ret;rte_event_eth_tx_adapter_enqueue (links[0 ].eventdev_id, links[0 ].event_port_id, ev,1 ,0 ); + }else { +rte_mempool_put (rte_mempool_from_obj (vec), vec); } }
@@ -720,6 +727,8 @@ ipsec_ev_vector_drv_mode_process(struct eh_event_link_info *links,rte_event_eth_tx_adapter_enqueue (links[0 ].eventdev_id, links[0 ].event_port_id, ev,1 ,0 ); + else +rte_mempool_put (rte_mempool_from_obj (vec ),vec ); }/*
Signature · 1 line
2.8.4
PATCH v3 3/3 examples/ipsec-secgw: add per port pool and vector pool size
In reply to Nithin DabilpuramAdd support to enable per port packet pool and also override vector pool size from command line args. This is useful on some HW to tune performance based on usecase.
--- doc/guides/sample_app_ug/ipsec_secgw.rst | 7 +++ examples/ipsec-secgw/event_helper.c | 17 +++++-- examples/ipsec-secgw/event_helper.h | 2 + examples/ipsec-secgw/ipsec-secgw.c | 82 ++++++++++++++++++++++++-------- examples/ipsec-secgw/ipsec-secgw.h | 2 + examples/ipsec-secgw/ipsec.h | 2 +- 6 files changed, 88 insertions(+), 24 deletions(-)
doc/guides/sample_app_ug/ipsec_secgw.rst +7 -0
@@ -249,6 +249,13 @@ Where: Should be lower for low number of reassembly buckets. Valid values: from 1 ns to 10 s. Default value: 10000000 (10 s). +* ``--per-port-pool``: Enable per ethdev port pktmbuf pool. + By default one packet mbuf pool per socket is created and configured + via Rx queue setup. + +* ``--vector-pool-sz``: Number of buffers in vector pool. + By default, vector pool size depeneds on packet pool size + and size of each vector. The mapping of lcores to port/queues is similar to other l3fwd applications.
examples/ipsec-secgw/event_helper.c +14 -3
@@ -792,8 +792,8 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,uint32_t service_id, socket_id, nb_elem;struct rte_mempool *vector_pool =NULL ;uint32_t lcore_id =rte_lcore_id (); +int ret, portid, nb_ports =0 ;uint8_t eventdev_id; -int ret;int j;/* Get event dev ID */
@@ -806,10 +806,21 @@ eh_rx_adapter_configure(struct eventmode_conf *em_conf,return ret; } + RTE_ETH_FOREACH_DEV(portid) + if ((em_conf->eth_portmask & (1 << portid))) + nb_ports++; +if (em_conf->ext_params.event_vector) { socket_id =rte_lcore_to_socket_id (lcore_id); - nb_elem = (nb_bufs_in_pool / em_conf->ext_params.vector_size) - +1 ; + +if (em_conf->vector_pool_sz) { + nb_elem = em_conf->vector_pool_sz; + }else { + nb_elem = (nb_bufs_in_pool / + em_conf->ext_params.vector_size) +1 ; +if (per_port_pool) + nb_elem = nb_ports * nb_elem; + } vector_pool = rte_event_vector_pool_create( "vector_pool", nb_elem, 0,
examples/ipsec-secgw/event_helper.h +2 -0
@@ -183,6 +183,8 @@ struct eventmode_conf {/**< 64 bit field to specify extended params */ uint64_t vector_tmo_ns;/**< Max vector timeout in nanoseconds */ +uint64_t vector_pool_sz; +/**< Vector pool size */ };/**
examples/ipsec-secgw/ipsec-secgw.c +62 -20
185 lines not on this page · raw message
examples/ipsec-secgw/ipsec-secgw.h +2 -0
@@ -134,6 +134,8 @@ extern volatile bool force_quit;extern uint32_t nb_bufs_in_pool; +extern bool per_port_pool; +static inline uint8_t is_unprotected_port (uint16_t port_id) {
examples/ipsec-secgw/ipsec.h +1 -1
@@ -248,7 +248,7 @@ struct socket_ctx {struct sp_ctx *sp_ip6_out;struct rt_ctx *rt_ip4;struct rt_ctx *rt_ip6; -struct rte_mempool *mbuf_pool; +struct rte_mempool *mbuf_pool[RTE_MAX_ETHPORTS ];struct rte_mempool *mbuf_pool_indir;struct rte_mempool *session_pool;struct rte_mempool *session_priv_pool;
Signature · 1 line
2.8.4
Quoted 8 lines
Update error prints in data path to
RTE_LOG_DP(). Error prints in fast path are not good for performance as they slow down the application when few bad packets are received.Signed-off-by Nithin Dabilpuram <[email protected]>Acked-by Akhil Goyal <[email protected]>---
Series Applied to dpdk-next-crypto
Thanks.