summaryrefslogtreecommitdiff
path: root/drivers/net/sfc/sfc_rx.c
diff options
context:
space:
mode:
authorAndrew Rybchenko <arybchenko@solarflare.com>2019-06-01 09:42:43 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-06-13 23:54:29 +0900
commitf08d113d5511284c2e35dba21d69e91c0bc7dbf4 (patch)
tree1ed24bdd2c3c6301b188502afde0e3dbf7cba8f6 /drivers/net/sfc/sfc_rx.c
parentcd7bb0d442590ece3c493a7df263f7455a79b098 (diff)
downloaddpdk-f08d113d5511284c2e35dba21d69e91c0bc7dbf4.zip
dpdk-f08d113d5511284c2e35dba21d69e91c0bc7dbf4.tar.gz
dpdk-f08d113d5511284c2e35dba21d69e91c0bc7dbf4.tar.xz
net/sfc: advertise offload capabilities by Rx datapaths
Rx datapath feature bits were useful on migration from the old offload API to the new one. However, right now it just adds indirection which complicates code reading and understanding. Also addition of a new offloads requires addition of a new feature bits and makes patches longer and harder to understand. So, remove feature bits which correspond to Rx offloads and simply advertise device and per-queue offloads directly. Generic code could still mask some offloads if running HW or FW does not support it. Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Igor Romanov <igor.romanov@oktetlabs.ru> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Diffstat (limited to 'drivers/net/sfc/sfc_rx.c')
-rw-r--r--drivers/net/sfc/sfc_rx.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index f222111..70e7614 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -557,8 +557,9 @@ struct sfc_dp_rx sfc_efx_rx = {
.type = SFC_DP_RX,
.hw_fw_caps = 0,
},
- .features = SFC_DP_RX_FEAT_SCATTER |
- SFC_DP_RX_FEAT_CHECKSUM,
+ .features = 0,
+ .dev_offload_capa = DEV_RX_OFFLOAD_CHECKSUM,
+ .queue_offload_capa = DEV_RX_OFFLOAD_SCATTER,
.qsize_up_rings = sfc_efx_rx_qsize_up_rings,
.qcreate = sfc_efx_rx_qcreate,
.qdestroy = sfc_efx_rx_qdestroy,
@@ -806,36 +807,32 @@ sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
sfc_ev_qstop(rxq->evq);
}
-uint64_t
-sfc_rx_get_dev_offload_caps(struct sfc_adapter *sa)
+static uint64_t
+sfc_rx_get_offload_mask(struct sfc_adapter *sa)
{
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
- uint64_t caps = 0;
+ uint64_t no_caps = 0;
- caps |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+ if (encp->enc_tunnel_encapsulations_supported == 0)
+ no_caps |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
- if (sa->priv.dp_rx->features & SFC_DP_RX_FEAT_CHECKSUM) {
- caps |= DEV_RX_OFFLOAD_IPV4_CKSUM;
- caps |= DEV_RX_OFFLOAD_UDP_CKSUM;
- caps |= DEV_RX_OFFLOAD_TCP_CKSUM;
- }
+ return ~no_caps;
+}
- if (encp->enc_tunnel_encapsulations_supported &&
- (sa->priv.dp_rx->features & SFC_DP_RX_FEAT_TUNNELS))
- caps |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+uint64_t
+sfc_rx_get_dev_offload_caps(struct sfc_adapter *sa)
+{
+ uint64_t caps = sa->priv.dp_rx->dev_offload_capa;
+
+ caps |= DEV_RX_OFFLOAD_JUMBO_FRAME;
- return caps;
+ return caps & sfc_rx_get_offload_mask(sa);
}
uint64_t
sfc_rx_get_queue_offload_caps(struct sfc_adapter *sa)
{
- uint64_t caps = 0;
-
- if (sa->priv.dp_rx->features & SFC_DP_RX_FEAT_SCATTER)
- caps |= DEV_RX_OFFLOAD_SCATTER;
-
- return caps;
+ return sa->priv.dp_rx->queue_offload_capa & sfc_rx_get_offload_mask(sa);
}
static int
@@ -1047,7 +1044,8 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
EFX_RXQ_FLAG_SCATTER : EFX_RXQ_FLAG_NONE;
if ((encp->enc_tunnel_encapsulations_supported != 0) &&
- (sa->priv.dp_rx->features & SFC_DP_RX_FEAT_TUNNELS))
+ (sfc_dp_rx_offload_capa(sa->priv.dp_rx) &
+ DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) != 0)
rxq_info->type_flags |= EFX_RXQ_FLAG_INNER_CLASSES;
rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_RX, sw_index,