net/sfc: factor out function to report Rx capabilities
authorIvan Malov <ivan.malov@oktetlabs.ru>
Thu, 18 Jan 2018 09:44:28 +0000 (09:44 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sun, 21 Jan 2018 14:51:52 +0000 (15:51 +0100)
The patch adds a separate function to report supported
Rx capabilities because this function will be required
in more places across the code in the upcoming patches.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/sfc/sfc_ethdev.c
drivers/net/sfc/sfc_rx.c
drivers/net/sfc/sfc_rx.h

index af867a7..851b38b 100644 (file)
@@ -104,14 +104,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        /* By default packets are dropped if no descriptors are available */
        dev_info->default_rxconf.rx_drop_en = 1;
 
-       dev_info->rx_offload_capa =
-               DEV_RX_OFFLOAD_IPV4_CKSUM |
-               DEV_RX_OFFLOAD_UDP_CKSUM |
-               DEV_RX_OFFLOAD_TCP_CKSUM;
-
-       if ((encp->enc_tunnel_encapsulations_supported != 0) &&
-           (sa->dp_rx->features & SFC_DP_RX_FEAT_TUNNELS))
-               dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+       dev_info->rx_offload_capa = sfc_rx_get_dev_offload_caps(sa);
 
        dev_info->tx_offload_capa =
                DEV_TX_OFFLOAD_IPV4_CKSUM |
index 6fa56b4..d35f4f7 100644 (file)
@@ -762,6 +762,23 @@ 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)
+{
+       const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+       uint64_t caps = 0;
+
+       caps |= DEV_RX_OFFLOAD_IPV4_CKSUM;
+       caps |= DEV_RX_OFFLOAD_UDP_CKSUM;
+       caps |= DEV_RX_OFFLOAD_TCP_CKSUM;
+
+       if (encp->enc_tunnel_encapsulations_supported &&
+           (sa->dp_rx->features & SFC_DP_RX_FEAT_TUNNELS))
+               caps |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+
+       return caps;
+}
+
 static int
 sfc_rx_qcheck_conf(struct sfc_adapter *sa, unsigned int rxq_max_fill_level,
                   const struct rte_eth_rxconf *rx_conf)
index 2cf75bc..cc9245f 100644 (file)
@@ -142,6 +142,8 @@ void sfc_rx_qfini(struct sfc_adapter *sa, unsigned int sw_index);
 int sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index);
 void sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index);
 
+uint64_t sfc_rx_get_dev_offload_caps(struct sfc_adapter *sa);
+
 void sfc_rx_qflush_done(struct sfc_rxq *rxq);
 void sfc_rx_qflush_failed(struct sfc_rxq *rxq);