for (idx_sa = 0; idx_sa < nb_sa_out; idx_sa++) {
rule = &sa_out[idx_sa];
rule_type = ipsec_get_action_type(rule);
- switch (rule_type) {
- case RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL:
- /* 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->portid == port_id) {
+ if (rule->portid == port_id) {
+ switch (rule_type) {
+ case RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL:
+ /* 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.
+ */
*tx_offloads |= RTE_ETH_TX_OFFLOAD_SECURITY;
if (rule->mss)
*tx_offloads |= (RTE_ETH_TX_OFFLOAD_TCP_TSO |
RTE_ETH_TX_OFFLOAD_IPV4_CKSUM);
- }
- break;
- case RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO:
- if (rule->portid == port_id) {
+ break;
+ case RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO:
*tx_offloads |= RTE_ETH_TX_OFFLOAD_SECURITY;
if (rule->mss)
*tx_offloads |=
RTE_ETH_TX_OFFLOAD_TCP_TSO;
- *tx_offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
+ if (dev_info.tx_offload_capa &
+ RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
+ *tx_offloads |=
+ RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
+ break;
+ default:
+ /* Enable IPv4 checksum offload even if
+ * one of lookaside SA's are present.
+ */
+ if (dev_info.tx_offload_capa &
+ RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
+ *tx_offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
+ break;
}
- break;
- default:
- /* Enable IPv4 checksum offload even if one of lookaside
- * SA's are present.
- */
+ } else {
if (dev_info.tx_offload_capa &
RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
*tx_offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
- break;
}
}
return 0;