net/octeontx2: add GRE TSO offload support
PATCH 1/1 net/octeontx2: add GRE TSO offload support
Extends existing TSO support to GRE tunnel on the
same SoC revisions.
---
Note: This patchset depends on "net/octeontx2: add TSO offload support" i.e "http://patches.dpdk.org/patch/59691/"
drivers/net/octeontx2/otx2_ethdev.c | 111 +++++++++++++++++++++++++++++++++++- drivers/net/octeontx2/otx2_ethdev.h | 1 + drivers/net/octeontx2/otx2_tx.h | 2 +- 3 files changed, 111 insertions(+), 3 deletions(-)
drivers/net/octeontx2/otx2_ethdev.c +109 -2
@@ -33,7 +33,8 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)if (otx2_dev_is_96xx_A0 (dev) ||otx2_dev_is_95xx_Ax (dev)) capa &= ~(DEV_TX_OFFLOAD_TCP_TSO |DEV_TX_OFFLOAD_VXLAN_TNL_TSO | -DEV_TX_OFFLOAD_GENEVE_TNL_TSO ); +DEV_TX_OFFLOAD_GENEVE_TNL_TSO | +DEV_TX_OFFLOAD_GRE_TNL_TSO );return capa; }
@@ -655,7 +656,8 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)/* Enable Inner and Outer checksum for Tunnel TSO */ if (conf & (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | -DEV_TX_OFFLOAD_GENEVE_TNL_TSO )) +DEV_TX_OFFLOAD_GENEVE_TNL_TSO | +DEV_TX_OFFLOAD_GRE_TNL_TSO )) flags |= (NIX_TX_OFFLOAD_TSO_F |NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |NIX_TX_OFFLOAD_L3_L4_CSUM_F );
@@ -1322,6 +1324,61 @@ nix_lso_udp_tun_tcp(struct nix_lso_format_cfg *req, field++; } +static void +nix_lso_tun_tcp (struct nix_lso_format_cfg *req, +bool outer_v4,bool inner_v4) +{ +volatile struct nix_lso_format *field; + + field = (volatile struct nix_lso_format *)&req->fields[0 ]; + req->field_mask =NIX_LSO_FIELD_MASK ; +/* Outer IPv4/IPv6 len */ + field->layer =NIX_TXLAYER_OL3 ; + field->offset = outer_v4 ?2 :4 ; + field->sizem1 =1 ;/* 2B */ + field->alg =NIX_LSOALG_ADD_PAYLEN ; + field++; +if (outer_v4) { +/* IPID */ + field->layer =NIX_TXLAYER_OL3 ; + field->offset =4 ; + field->sizem1 =1 ; +/* Incremented linearly per segment */ + field->alg =NIX_LSOALG_ADD_SEGNUM ; + field++; + } + +/* Inner IPv4/IPv6 */ + field->layer =NIX_TXLAYER_IL3 ; + field->offset = inner_v4 ?2 :4 ; + field->sizem1 =1 ;/* 2B */ + field->alg =NIX_LSOALG_ADD_PAYLEN ; + field++; +if (inner_v4) { +/* IPID field */ + field->layer =NIX_TXLAYER_IL3 ; + field->offset =4 ; + field->sizem1 =1 ; +/* Incremented linearly per segment */ + field->alg =NIX_LSOALG_ADD_SEGNUM ; + field++; + } + +/* TCP sequence number update */ + field->layer =NIX_TXLAYER_IL4 ; + field->offset =4 ; + field->sizem1 =3 ;/* 4 bytes */ + field->alg =NIX_LSOALG_ADD_OFFSET ; + field++; + +/* TCP flags field */ + field->layer =NIX_TXLAYER_IL4 ; + field->offset =12 ; + field->sizem1 =1 ; + field->alg =NIX_LSOALG_TCP_FLAGS ; + field++; +} +static int nix_setup_lso_formats (struct otx2_eth_dev *dev) {
@@ -1414,6 +1471,56 @@ nix_setup_lso_formats(struct otx2_eth_dev *dev)return -EFAULT ;otx2_nix_dbg ("udp tun v6v6 fmt=%u\n" , base +5 ); +/* +* IPv4/TUN HDR/IPv4/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, true, true); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +if (rsp->lso_format_idx != base +6 ) +return -EFAULT ; +otx2_nix_dbg ("tun v4v4 fmt=%u\n" , base +6 ); + +/* +* IPv4/TUN HDR/IPv6/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, true, false); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +if (rsp->lso_format_idx != base +7 ) +return -EFAULT ; +otx2_nix_dbg ("tun v4v6 fmt=%u\n" , base +7 ); + +/* +* IPv6/TUN HDR/IPv4/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, false, true); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +if (rsp->lso_format_idx != base +8 ) +return -EFAULT ; +otx2_nix_dbg ("tun v6v4 fmt=%u\n" , base +8 ); + +/* +* IPv6/TUN HDR/IPv6/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, false, false); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; +if (rsp->lso_format_idx != base +9 ) +return -EFAULT ; +otx2_nix_dbg ("tun v6v6 fmt=%u\n" , base +9 );return 0 ; }
drivers/net/octeontx2/otx2_ethdev.h +1 -0
@@ -130,6 +130,7 @@DEV_TX_OFFLOAD_TCP_TSO | \DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \ +DEV_TX_OFFLOAD_GRE_TNL_TSO | \DEV_TX_OFFLOAD_MULTI_SEGS | \ DEV_TX_OFFLOAD_IPV4_CKSUM)
drivers/net/octeontx2/otx2_tx.h +1 -1
@@ -342,7 +342,7 @@ otx2_nix_xmit_prepare(struct rte_mbuf *m, uint64_t *cmd, const uint16_t flags) w1.il4type =NIX_SENDL4TYPE_TCP_CKSUM ; w1.ol4type = is_udp_tun ?NIX_SENDL4TYPE_UDP_CKSUM :0 ;/* Update format for UDP tunneled packet */ - send_hdr_ext->w0.lso_format += (is_udp_tun <<1 ); + send_hdr_ext->w0.lso_format += is_udp_tun ?2 :6 ; send_hdr_ext->w0.lso_format += !!(ol_flags &PKT_TX_OUTER_IPV6 ) <<1 ;
Signature · 1 line
2.8.4
PATCH v2 1/1 net/octeontx2: add TSO offload support
Add support to below TCP segmentation offloads for 96XX A1 onwards and 95xx B0 onwards.
- TCPv4, TCPv6
- VXLAN[v4 | v6][v4 | v6]
- GENEVE[v4 | v6][v4 | v6]
This patch also modifies a fastpath function to be forced inline due to performance reasons for multi-seg mode.
---
v2:
* Remove duplicate NIX_LSO_FIELD_MAX define
doc/guides/nics/features/octeontx2.ini | 1 + drivers/common/octeontx2/hw/otx2_nix.h | 12 ++ drivers/common/octeontx2/otx2_common.h | 17 ++ drivers/common/octeontx2/otx2_mbox.h | 1 - drivers/event/octeontx2/otx2_evdev.c | 30 +-- drivers/event/octeontx2/otx2_evdev.h | 2 +- drivers/event/octeontx2/otx2_worker.c | 4 +- drivers/event/octeontx2/otx2_worker.h | 2 + drivers/event/octeontx2/otx2_worker_dual.c | 4 +- drivers/net/octeontx2/otx2_ethdev.c | 222 ++++++++++++++++++++- drivers/net/octeontx2/otx2_ethdev.h | 4 + drivers/net/octeontx2/otx2_tx.c | 55 ++++-- drivers/net/octeontx2/otx2_tx.h | 298 ++++++++++++++++++++++------- 13 files changed, 545 insertions(+), 107 deletions(-)
doc/guides/nics/features/octeontx2.ini +1 -0
@@ -17,6 +17,7 @@ Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y MTU update = Y +TSO = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
drivers/common/octeontx2/hw/otx2_nix.h +12 -0
@@ -1376,4 +1376,16 @@ struct nix_lso_format { uint64_t rsvd_19_63 : 45; }; +#define NIX_LSO_FIELD_MAX (8) +#define NIX_LSO_FIELD_ALG_MASK GENMASK(18, 16) +#define NIX_LSO_FIELD_SZ_MASK GENMASK(13, 12) +#define NIX_LSO_FIELD_LY_MASK GENMASK(9, 8) +#define NIX_LSO_FIELD_OFF_MASK GENMASK(7, 0) + +#define NIX_LSO_FIELD_MASK \ + (NIX_LSO_FIELD_OFF_MASK | \ + NIX_LSO_FIELD_LY_MASK | \ + NIX_LSO_FIELD_SZ_MASK | \ + NIX_LSO_FIELD_ALG_MASK) +#endif /* __OTX2_NIX_HW_H__ */
drivers/common/octeontx2/otx2_common.h +17 -0
@@ -31,6 +31,23 @@#define BIT (nr) (1UL << (nr))#endif +#ifndef BITS_PER_LONG +#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) +#endif +#ifndef BITS_PER_LONG_LONG +#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) +#endif + +#ifndef GENMASK +#define GENMASK (h, l) \ + (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#endif +#ifndef GENMASK_ULL +#define GENMASK_ULL (h, l) \ + (((~0ULL) - (1ULL << (l)) + 1) & \ + (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) +#endif +/* Compiler attributes */ #ifndef __hot#define __hot __attribute__((hot))
drivers/common/octeontx2/otx2_mbox.h +0 -1
@@ -869,7 +869,6 @@ struct nix_mark_format_cfg_rsp {struct nix_lso_format_cfg {struct mbox_msghdr hdr; uint64_t __otx2_io field_mask; -#define NIX_LSO_FIELD_MAX (8) uint64_t __otx2_io fields[NIX_LSO_FIELD_MAX]; };
drivers/event/octeontx2/otx2_evdev.c +18 -12
@@ -169,33 +169,35 @@ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC };/* Tx modes */ -const event_tx_adapter_enqueue ssogws_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f4, f3, f2, f1, f0, sz, flags) \ - [f4][f3][f2][f1][f0] = otx2_ssogws_tx_adptr_enq_ ## name, +const event_tx_adapter_enqueue ssogws_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f5][f4][f3][f2][f1][f0] = otx2_ssogws_tx_adptr_enq_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T };const event_tx_adapter_enqueue - ssogws_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f4, f3, f2, f1, f0, sz, flags) \ - [f4][f3][f2][f1][f0] = otx2_ssogws_tx_adptr_enq_seg_ ## name, + ssogws_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_tx_adptr_enq_seg_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T };const event_tx_adapter_enqueue - ssogws_dual_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f4, f3, f2, f1, f0, sz, flags) \ - [f4][f3][f2][f1][f0] = otx2_ssogws_dual_tx_adptr_enq_ ## name, + ssogws_dual_tx_adptr_enq[2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f5][f4][f3][f2][f1][f0] = \ + otx2_ssogws_dual_tx_adptr_enq_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T };const event_tx_adapter_enqueue - ssogws_dual_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ] = { -#define T(name, f4, f3, f2, f1, f0, sz, flags) \ - [f4][f3][f2][f1][f0] = \ + ssogws_dual_tx_adptr_enq_seg[2 ][2 ][2 ][2 ][2 ][2 ] = { +#define T(name, f5, f4, f3, f2, f1, f0, sz, flags) \ + [f5][f4][f3][f2][f1][f0] = \ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name,SSO_TX_ADPTR_ENQ_FASTPATH_FUNC #undef T
@@ -274,6 +276,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNCif (dev->tx_offloads &NIX_TX_MULTI_SEG_F ) {/* [TSMP] [MBUF_NOFF] [VLAN] [OL3_L4_CSUM] [L3_L4_CSUM] */ event_dev->txa_enqueue = ssogws_tx_adptr_enq_seg + [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_MBUF_NOFF_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_VLAN_QINQ_F )]
@@ -281,6 +284,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC [!!(dev->tx_offloads &NIX_TX_OFFLOAD_L3_L4_CSUM_F )]; }else { event_dev->txa_enqueue = ssogws_tx_adptr_enq + [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_MBUF_NOFF_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_VLAN_QINQ_F )]
@@ -406,6 +410,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNCif (dev->tx_offloads &NIX_TX_MULTI_SEG_F ) {/* [TSMP] [MBUF_NOFF] [VLAN] [OL3_L4_CSUM] [L3_L4_CSUM] */ event_dev->txa_enqueue = ssogws_dual_tx_adptr_enq_seg + [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_MBUF_NOFF_F )]
@@ -417,6 +422,7 @@ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC NIX_TX_OFFLOAD_L3_L4_CSUM_F)]; }else { event_dev->txa_enqueue = ssogws_dual_tx_adptr_enq + [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSO_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_TSTAMP_F )] [!!(dev->tx_offloads &NIX_TX_OFFLOAD_MBUF_NOFF_F )]
drivers/event/octeontx2/otx2_evdev.h +1 -1
@@ -331,7 +331,7 @@ uint16_t otx2_ssogws_dual_deq_seg_timeout_burst_ ##name(void *port, \ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC#undef R -#define T (name, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[],\ uint16_t nb_events); \ uint16_t otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, \
drivers/event/octeontx2/otx2_worker.c +2 -2
@@ -267,7 +267,7 @@ otx2_ssogws_enq_fwd_burst(void *port, const struct rte_event ev[],return 1 ; } -#define T (name, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[], \ uint16_t nb_events) \
@@ -281,7 +281,7 @@ otx2_ssogws_tx_adptr_enq_ ## name(void *port, struct rte_event ev[], \ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC#undef T -#define T (name, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_tx_adptr_enq_seg_ ## name(void *port, struct rte_event ev[],\ uint16_t nb_events) \
drivers/event/octeontx2/otx2_worker.h +2 -0
@@ -256,6 +256,8 @@ otx2_ssogws_event_tx(struct otx2_ssogws *ws, struct rte_event ev[],struct rte_mbuf *m = ev[0 ].mbuf;const struct otx2_eth_txq *txq =otx2_ssogws_xtract_meta (m); +/* Perform header writes before barrier for TSO */ +otx2_nix_xmit_prepare_tso (m, flags);otx2_ssogws_head_wait (ws, !ev->sched_type);otx2_ssogws_prepare_pkt (txq, m, cmd, flags);
drivers/event/octeontx2/otx2_worker_dual.c +2 -2
@@ -306,7 +306,7 @@ otx2_ssogws_dual_deq_seg_timeout_burst_ ##name(void *port, \ SSO_RX_ADPTR_ENQ_FASTPATH_FUNC#undef R -#define T (name, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port, \ struct rte_event ev[], \
@@ -323,7 +323,7 @@ otx2_ssogws_dual_tx_adptr_enq_ ## name(void *port, \ SSO_TX_ADPTR_ENQ_FASTPATH_FUNC#undef T -#define T (name, f4, f3, f2, f1, f0, sz, flags) \ +#define T (name, f5, f4, f3, f2, f1, f0, sz, flags) \ uint16_t __hot \ otx2_ssogws_dual_tx_adptr_enq_seg_ ## name(void *port, \ struct rte_event ev[], \
drivers/net/octeontx2/otx2_ethdev.c +220 -2
247 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev.h +4 -0
@@ -127,6 +127,9 @@DEV_TX_OFFLOAD_TCP_CKSUM | \DEV_TX_OFFLOAD_UDP_CKSUM | \DEV_TX_OFFLOAD_SCTP_CKSUM | \ +DEV_TX_OFFLOAD_TCP_TSO | \ +DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \ +DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \DEV_TX_OFFLOAD_MULTI_SEGS | \ DEV_TX_OFFLOAD_IPV4_CKSUM)
@@ -249,6 +252,7 @@ struct otx2_eth_dev {uint8_t tx_chan_cnt;uint8_t lso_tsov4_idx;uint8_t lso_tsov6_idx; +uint8_t lso_base_idx;uint8_t mac_addr[RTE_ETHER_ADDR_LEN ];uint8_t mkex_pfl_name[MKEX_NAME_LEN ];uint8_t max_mac_entries;
drivers/net/octeontx2/otx2_tx.c +39 -16
135 lines not on this page · raw message
drivers/net/octeontx2/otx2_tx.h +227 -71
335 lines not on this page · raw message
Signature · 1 line
2.8.4
Jerin Jacob
AppliedRe: [dpdk-dev] [PATCH v2] net/octeontx2: add TSO offload support
Quoted 7 lines · Nithin Dabilpuram
Add support to below TCP segmentation offloads for 96XX A1 onwards and 95xx B0 onwards.
- TCPv4, TCPv6
- VXLAN[v4 | v6][v4 | v6]
- GENEVE[v4 | v6][v4 | v6]
Quoted 6 lines
This patch also modifies a fastpath function to be forced inline due to performance reasons for multi-seg mode.
Signed-off-by Nithin Dabilpuram <[email protected]>---
Updated missing TSO support in doc/guides/nics/features/octeontx2_vf.ini. Only in vector mode, TSO is not supported.
Applied to dpdk-next-net-mrvl/master. Thanks
Jerin Jacob
AppliedQuoted 5 lines · Nithin Dabilpuram
Extends existing TSO support to GRE tunnel on the
same SoC revisions.Signed-off-by Nithin Dabilpuram <[email protected]>
Applied to dpdk-next-net-mrvl/master. Thanks
Quoted 180 lines
---
Note: This patchset depends on "net/octeontx2: add TSO offload support" i.e "http://patches.dpdk.org/patch/59691/"drivers/net/octeontx2/otx2_ethdev.c | 111 +++++++++++++++++++++++++++++++++++- drivers/net/octeontx2/otx2_ethdev.h | 1 + drivers/net/octeontx2/otx2_tx.h | 2 +- 3 files changed, 111 insertions(+), 3 deletions(-)drivers/net/octeontx2/otx2_ethdev.c +109
-2@@ -33,7 +33,8 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev)if (otx2_dev_is_96xx_A0 (dev) ||otx2_dev_is_95xx_Ax (dev)) capa &= ~(DEV_TX_OFFLOAD_TCP_TSO |DEV_TX_OFFLOAD_VXLAN_TNL_TSO | -DEV_TX_OFFLOAD_GENEVE_TNL_TSO ); +DEV_TX_OFFLOAD_GENEVE_TNL_TSO | +DEV_TX_OFFLOAD_GRE_TNL_TSO );return capa; }@@ -655,7 +656,8 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)/* Enable Inner and Outer checksum for Tunnel TSO */ if (conf & (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | -DEV_TX_OFFLOAD_GENEVE_TNL_TSO )) +DEV_TX_OFFLOAD_GENEVE_TNL_TSO | +DEV_TX_OFFLOAD_GRE_TNL_TSO )) flags |= (NIX_TX_OFFLOAD_TSO_F |NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |NIX_TX_OFFLOAD_L3_L4_CSUM_F );@@ -1322,6 +1324,61 @@ nix_lso_udp_tun_tcp(struct nix_lso_format_cfg *req, field++; } +static void +nix_lso_tun_tcp (struct nix_lso_format_cfg *req, +bool outer_v4,bool inner_v4) +{ +volatile struct nix_lso_format *field; + + field = (volatile struct nix_lso_format *)&req->fields[0 ]; + req->field_mask =NIX_LSO_FIELD_MASK ; +/* Outer IPv4/IPv6 len */ + field->layer =NIX_TXLAYER_OL3 ; + field->offset = outer_v4 ?2 :4 ; + field->sizem1 =1 ;/* 2B */ + field->alg =NIX_LSOALG_ADD_PAYLEN ; + field++; +if (outer_v4) { +/* IPID */ + field->layer =NIX_TXLAYER_OL3 ; + field->offset =4 ; + field->sizem1 =1 ; +/* Incremented linearly per segment */ + field->alg =NIX_LSOALG_ADD_SEGNUM ; + field++; + } + +/* Inner IPv4/IPv6 */ + field->layer =NIX_TXLAYER_IL3 ; + field->offset = inner_v4 ?2 :4 ; + field->sizem1 =1 ;/* 2B */ + field->alg =NIX_LSOALG_ADD_PAYLEN ; + field++; +if (inner_v4) { +/* IPID field */ + field->layer =NIX_TXLAYER_IL3 ; + field->offset =4 ; + field->sizem1 =1 ; +/* Incremented linearly per segment */ + field->alg =NIX_LSOALG_ADD_SEGNUM ; + field++; + } + +/* TCP sequence number update */ + field->layer =NIX_TXLAYER_IL4 ; + field->offset =4 ; + field->sizem1 =3 ;/* 4 bytes */ + field->alg =NIX_LSOALG_ADD_OFFSET ; + field++; + +/* TCP flags field */ + field->layer =NIX_TXLAYER_IL4 ; + field->offset =12 ; + field->sizem1 =1 ; + field->alg =NIX_LSOALG_TCP_FLAGS ; + field++; +} +static int nix_setup_lso_formats (struct otx2_eth_dev *dev) {@@ -1414,6 +1471,56 @@ nix_setup_lso_formats(struct otx2_eth_dev *dev)return -EFAULT ;otx2_nix_dbg ("udp tun v6v6 fmt=%u\n" , base +5 ); +/* +* IPv4/TUN HDR/IPv4/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, true, true); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +if (rsp->lso_format_idx != base +6 ) +return -EFAULT ; +otx2_nix_dbg ("tun v4v4 fmt=%u\n" , base +6 ); + +/* +* IPv4/TUN HDR/IPv6/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, true, false); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +if (rsp->lso_format_idx != base +7 ) +return -EFAULT ; +otx2_nix_dbg ("tun v4v6 fmt=%u\n" , base +7 ); + +/* +* IPv6/TUN HDR/IPv4/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, false, true); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; + +if (rsp->lso_format_idx != base +8 ) +return -EFAULT ; +otx2_nix_dbg ("tun v6v4 fmt=%u\n" , base +8 ); + +/* +* IPv6/TUN HDR/IPv6/TCP LSO +*/ + req =otx2_mbox_alloc_msg_nix_lso_format_cfg (mbox); +nix_lso_tun_tcp (req, false, false); + rc =otx2_mbox_process_msg (mbox, (void *)&rsp); +if (rc) +return rc; +if (rsp->lso_format_idx != base +9 ) +return -EFAULT ; +otx2_nix_dbg ("tun v6v6 fmt=%u\n" , base +9 );return 0 ; }drivers/net/octeontx2/otx2_ethdev.h +1
-0@@ -130,6 +130,7 @@DEV_TX_OFFLOAD_TCP_TSO | \DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \ +DEV_TX_OFFLOAD_GRE_TNL_TSO | \DEV_TX_OFFLOAD_MULTI_SEGS | \ DEV_TX_OFFLOAD_IPV4_CKSUM)drivers/net/octeontx2/otx2_tx.h +1
-2@@ -342,7 +342,7 @@ otx2_nix_xmit_prepare(struct rte_mbuf *m, uint64_t *cmd, const uint16_t flags) w1.il4type =NIX_SENDL4TYPE_TCP_CKSUM ; w1.ol4type = is_udp_tun ?NIX_SENDL4TYPE_UDP_CKSUM :0 ;/* Update format for UDP tunneled packet */ - send_hdr_ext->w0.lso_format += (is_udp_tun <<1 ); + send_hdr_ext->w0.lso_format += is_udp_tun ?2 :6 ; send_hdr_ext->w0.lso_format += !!(ol_flags &PKT_TX_OUTER_IPV6 ) <<1 ; --2.8.4