From 942a63649941dd63ab2e2d2d22979834db21079a Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 13 Oct 2020 14:45:42 +0100 Subject: [PATCH] net/sfc: support Tx VLAN insertion offload for EF100 Signed-off-by: Andrew Rybchenko --- doc/guides/nics/sfc_efx.rst | 4 ++-- drivers/net/sfc/sfc_ef100_tx.c | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index e108043f38..c89484d473 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -329,8 +329,8 @@ boolean parameters value. is even more faster then **ef10** but does not support multi-segment mbufs, disallows multiple mempools and neglects mbuf reference counters. **ef100** chooses EF100 native datapath which supports multi-segment - mbufs, inner/outer IPv4 and TCP/UDP checksum and TCP segmentation offloads - including VXLAN and GENEVE IPv4/IPv6 tunnels. + mbufs, VLAN insertion, inner/outer IPv4 and TCP/UDP checksum and TCP + segmentation offloads including VXLAN and GENEVE IPv4/IPv6 tunnels. - ``perf_profile`` [auto|throughput|low-latency] (default **throughput**) diff --git a/drivers/net/sfc/sfc_ef100_tx.c b/drivers/net/sfc/sfc_ef100_tx.c index 3c0c78edaa..9eb42c34d9 100644 --- a/drivers/net/sfc/sfc_ef100_tx.c +++ b/drivers/net/sfc/sfc_ef100_tx.c @@ -381,6 +381,16 @@ sfc_ef100_tx_qdesc_send_create(const struct rte_mbuf *m, efx_oword_t *tx_desc) ESF_GZ_TX_SEND_CSO_OUTER_L3, outer_l3, ESF_GZ_TX_SEND_CSO_OUTER_L4, outer_l4, ESF_GZ_TX_DESC_TYPE, ESE_GZ_TX_DESC_TYPE_SEND); + + if (m->ol_flags & PKT_TX_VLAN_PKT) { + efx_oword_t tx_desc_extra_fields; + + EFX_POPULATE_OWORD_2(tx_desc_extra_fields, + ESF_GZ_TX_SEND_VLAN_INSERT_EN, 1, + ESF_GZ_TX_SEND_VLAN_INSERT_TCI, m->vlan_tci); + + EFX_OR_OWORD(*tx_desc, tx_desc_extra_fields); + } } static void @@ -453,6 +463,14 @@ sfc_ef100_tx_qdesc_tso_create(const struct rte_mbuf *m, ESF_GZ_TX_DESC_TYPE, ESE_GZ_TX_DESC_TYPE_TSO); EFX_OR_OWORD(*tx_desc, tx_desc_extra_fields); + + if (m->ol_flags & PKT_TX_VLAN_PKT) { + EFX_POPULATE_OWORD_2(tx_desc_extra_fields, + ESF_GZ_TX_TSO_VLAN_INSERT_EN, 1, + ESF_GZ_TX_TSO_VLAN_INSERT_TCI, m->vlan_tci); + + EFX_OR_OWORD(*tx_desc, tx_desc_extra_fields); + } } static inline void @@ -923,7 +941,8 @@ struct sfc_dp_tx sfc_ef100_tx = { }, .features = SFC_DP_TX_FEAT_MULTI_PROCESS, .dev_offload_capa = 0, - .queue_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM | + .queue_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_OUTER_UDP_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM | -- 2.20.1