net/sfc: factor out function to report Rx capabilities

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>
This commit is contained in:
Ivan Malov 2018-01-18 09:44:28 +00:00 committed by Ferruh Yigit
parent 7482984419
commit cd8da5e83d
3 changed files with 20 additions and 8 deletions

View 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 |

View 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)

View 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);