From: Andrew Rybchenko Date: Mon, 20 Mar 2017 10:15:15 +0000 (+0000) Subject: net/sfc: make VLAN insertion a datapath-dependent feature X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=45cbb96c06cc7f9f0c686b6090dd4baeaf7915da;p=dpdk.git net/sfc: make VLAN insertion a datapath-dependent feature Signed-off-by: Andrew Rybchenko --- diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h index 1f922e5976..1a6d6c1492 100644 --- a/drivers/net/sfc/sfc_dp_tx.h +++ b/drivers/net/sfc/sfc_dp_tx.h @@ -116,6 +116,8 @@ typedef void (sfc_dp_tx_qreap_t)(struct sfc_dp_txq *dp_txq); struct sfc_dp_tx { struct sfc_dp dp; + unsigned int features; +#define SFC_DP_TX_FEAT_VLAN_INSERT 0x1 sfc_dp_tx_qcreate_t *qcreate; sfc_dp_tx_qdestroy_t *qdestroy; sfc_dp_tx_qstart_t *qstart; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 38ee2f823d..301b835025 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -135,7 +135,8 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_TCP_CKSUM; dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOXSUMSCTP; - if (!encp->enc_hw_tx_insert_vlan_enabled) + if ((~sa->dp_tx->features & SFC_DP_TX_FEAT_VLAN_INSERT) || + !encp->enc_hw_tx_insert_vlan_enabled) dev_info->default_txconf.txq_flags |= ETH_TXQ_FLAGS_NOVLANOFFL; else dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT; diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c index e716f2ff79..9beb6f3e6c 100644 --- a/drivers/net/sfc/sfc_tx.c +++ b/drivers/net/sfc/sfc_tx.c @@ -84,10 +84,16 @@ sfc_tx_qcheck_conf(struct sfc_adapter *sa, uint16_t nb_tx_desc, rc = EINVAL; } - if (!encp->enc_hw_tx_insert_vlan_enabled && - (flags & ETH_TXQ_FLAGS_NOVLANOFFL) == 0) { - sfc_err(sa, "VLAN offload is not supported"); - rc = EINVAL; + if ((flags & ETH_TXQ_FLAGS_NOVLANOFFL) == 0) { + if (!encp->enc_hw_tx_insert_vlan_enabled) { + sfc_err(sa, "VLAN offload is not supported"); + rc = EINVAL; + } else if (~sa->dp_tx->features & SFC_DP_TX_FEAT_VLAN_INSERT) { + sfc_err(sa, + "VLAN offload is not supported by %s datapath", + sa->dp_tx->dp.name); + rc = EINVAL; + } } if ((flags & ETH_TXQ_FLAGS_NOXSUMSCTP) == 0) { @@ -923,6 +929,7 @@ struct sfc_dp_tx sfc_efx_tx = { .type = SFC_DP_TX, .hw_fw_caps = 0, }, + .features = SFC_DP_TX_FEAT_VLAN_INSERT, .qcreate = sfc_efx_tx_qcreate, .qdestroy = sfc_efx_tx_qdestroy, .qstart = sfc_efx_tx_qstart,