From 5e23c24988f2df5b7797e57eff93fd8af8ceeca7 Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Wed, 25 Apr 2018 18:51:42 +0100 Subject: [PATCH] net/sfc: remove conditional compilation for RSS RSS is one of the most valuable features in the driver, and one would hardly need to disable it at build time. This patch withdraws unnecessary conditionals for RSS snippets. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc.c | 10 ---------- drivers/net/sfc/sfc.h | 4 ---- drivers/net/sfc/sfc_ethdev.c | 6 ------ drivers/net/sfc/sfc_flow.c | 10 ---------- drivers/net/sfc/sfc_flow.h | 4 ---- drivers/net/sfc/sfc_rx.c | 25 ------------------------- drivers/net/sfc/sfc_rx.h | 2 -- 7 files changed, 61 deletions(-) diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index dcf5eb866c..41ebd0b4cc 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -623,7 +623,6 @@ sfc_mem_bar_fini(struct sfc_adapter *sa) memset(ebp, 0, sizeof(*ebp)); } -#if EFSYS_OPT_RX_SCALE /* * A fixed RSS key which has a property of being symmetric * (symmetrical flows are distributed to the same CPU) @@ -637,9 +636,7 @@ static const uint8_t default_rss_key[EFX_RSS_KEY_SIZE] = { 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, }; -#endif -#if EFSYS_OPT_RX_SCALE static int sfc_set_rss_defaults(struct sfc_adapter *sa) { @@ -688,13 +685,6 @@ fail_ev_init: fail_intr_init: return rc; } -#else -static int -sfc_set_rss_defaults(__rte_unused struct sfc_adapter *sa) -{ - return 0; -} -#endif int sfc_attach(struct sfc_adapter *sa) diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 65a4df24ae..805f211cc1 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -27,10 +27,8 @@ extern "C" { #endif -#if EFSYS_OPT_RX_SCALE /** RSS hash offloads mask */ #define SFC_RSS_OFFLOADS (ETH_RSS_IP | ETH_RSS_TCP) -#endif /* * +---------------+ @@ -227,13 +225,11 @@ struct sfc_adapter { unsigned int rss_channels; -#if EFSYS_OPT_RX_SCALE efx_rx_scale_context_type_t rss_support; efx_rx_hash_support_t hash_support; efx_rx_hash_type_t rss_hash_types; unsigned int rss_tbl[EFX_RSS_TBL_SIZE]; uint8_t rss_key[EFX_RSS_KEY_SIZE]; -#endif /* * Shared memory copy of the Rx datapath name to be used by diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 47d7a8609b..be6d449826 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -151,13 +151,11 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if (~sa->dp_tx->features & SFC_DP_TX_FEAT_REFCNT) dev_info->default_txconf.txq_flags |= ETH_TXQ_FLAGS_NOREFCOUNT; -#if EFSYS_OPT_RX_SCALE if (sa->rss_support != EFX_RX_SCALE_UNAVAILABLE) { dev_info->reta_size = EFX_RSS_TBL_SIZE; dev_info->hash_key_size = EFX_RSS_KEY_SIZE; dev_info->flow_type_rss_offloads = SFC_RSS_OFFLOADS; } -#endif /* Initialize to hardware limits */ dev_info->rx_desc_lim.nb_max = EFX_RXQ_MAXNDESCS; @@ -1357,7 +1355,6 @@ sfc_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, return sfc_dev_udp_tunnel_op(dev, tunnel_udp, SFC_UDP_TUNNEL_DEL_PORT); } -#if EFSYS_OPT_RX_SCALE static int sfc_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) @@ -1568,7 +1565,6 @@ bad_reta_entry: SFC_ASSERT(rc >= 0); return -rc; } -#endif static int sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, @@ -1663,12 +1659,10 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .mac_addr_set = sfc_mac_addr_set, .udp_tunnel_port_add = sfc_dev_udp_tunnel_port_add, .udp_tunnel_port_del = sfc_dev_udp_tunnel_port_del, -#if EFSYS_OPT_RX_SCALE .reta_update = sfc_dev_rss_reta_update, .reta_query = sfc_dev_rss_reta_query, .rss_hash_update = sfc_dev_rss_hash_update, .rss_hash_conf_get = sfc_dev_rss_hash_conf_get, -#endif .filter_ctrl = sfc_dev_filter_ctrl, .set_mc_addr_list = sfc_set_mc_addr_list, .rxq_info_get = sfc_rx_queue_info_get, diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index bcde2c2f74..9c09cdb2dd 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1248,7 +1248,6 @@ sfc_flow_parse_queue(struct sfc_adapter *sa, return 0; } -#if EFSYS_OPT_RX_SCALE static int sfc_flow_parse_rss(struct sfc_adapter *sa, const struct rte_flow_action_rss *rss, @@ -1324,7 +1323,6 @@ sfc_flow_parse_rss(struct sfc_adapter *sa, return 0; } -#endif /* EFSYS_OPT_RX_SCALE */ static int sfc_flow_spec_flush(struct sfc_adapter *sa, struct sfc_flow_spec *spec, @@ -1374,7 +1372,6 @@ static int sfc_flow_filter_insert(struct sfc_adapter *sa, struct rte_flow *flow) { -#if EFSYS_OPT_RX_SCALE struct sfc_flow_rss *rss = &flow->rss_conf; uint32_t efs_rss_context = EFX_RSS_CONTEXT_DEFAULT; unsigned int i; @@ -1451,9 +1448,6 @@ fail_scale_mode_set: fail_scale_context_alloc: return rc; -#else /* !EFSYS_OPT_RX_SCALE */ - return sfc_flow_spec_insert(sa, &flow->spec); -#endif /* EFSYS_OPT_RX_SCALE */ } static int @@ -1466,7 +1460,6 @@ sfc_flow_filter_remove(struct sfc_adapter *sa, if (rc != 0) return rc; -#if EFSYS_OPT_RX_SCALE if (flow->rss) { /* * All specifications for a given flow rule have the same RSS @@ -1477,7 +1470,6 @@ sfc_flow_filter_remove(struct sfc_adapter *sa, rc = efx_rx_scale_context_free(sa->nic, spec->efs_rss_context); } -#endif /* EFSYS_OPT_RX_SCALE */ return rc; } @@ -1524,7 +1516,6 @@ sfc_flow_parse_actions(struct sfc_adapter *sa, is_specified = B_TRUE; break; -#if EFSYS_OPT_RX_SCALE case RTE_FLOW_ACTION_TYPE_RSS: rc = sfc_flow_parse_rss(sa, actions->conf, flow); if (rc != 0) { @@ -1536,7 +1527,6 @@ sfc_flow_parse_actions(struct sfc_adapter *sa, is_specified = B_TRUE; break; -#endif /* EFSYS_OPT_RX_SCALE */ case RTE_FLOW_ACTION_TYPE_DROP: flow->spec.template.efs_dmaq_id = diff --git a/drivers/net/sfc/sfc_flow.h b/drivers/net/sfc/sfc_flow.h index 69dd6838fa..71ec18cb95 100644 --- a/drivers/net/sfc/sfc_flow.h +++ b/drivers/net/sfc/sfc_flow.h @@ -26,7 +26,6 @@ extern "C" { */ #define SF_FLOW_SPEC_NB_FILTERS_MAX 8 -#if EFSYS_OPT_RX_SCALE /* RSS configuration storage */ struct sfc_flow_rss { unsigned int rxq_hw_index_min; @@ -35,7 +34,6 @@ struct sfc_flow_rss { uint8_t rss_key[EFX_RSS_KEY_SIZE]; unsigned int rss_tbl[EFX_RSS_TBL_SIZE]; }; -#endif /* EFSYS_OPT_RX_SCALE */ /* Filter specification storage */ struct sfc_flow_spec { @@ -50,10 +48,8 @@ struct sfc_flow_spec { /* PMD-specific definition of the opaque type from rte_flow.h */ struct rte_flow { struct sfc_flow_spec spec; /* flow spec for hardware filter(s) */ -#if EFSYS_OPT_RX_SCALE boolean_t rss; /* RSS toggle */ struct sfc_flow_rss rss_conf; /* RSS configuration */ -#endif /* EFSYS_OPT_RX_SCALE */ TAILQ_ENTRY(rte_flow) entries; /* flow list entries */ }; diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index fca39311bd..c30f2309eb 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -184,7 +184,6 @@ sfc_efx_supported_ptypes_get(__rte_unused uint32_t tunnel_encaps) return ptypes; } -#if EFSYS_OPT_RX_SCALE static void sfc_efx_rx_set_rss_hash(struct sfc_efx_rxq *rxq, unsigned int flags, struct rte_mbuf *m) @@ -205,14 +204,6 @@ sfc_efx_rx_set_rss_hash(struct sfc_efx_rxq *rxq, unsigned int flags, m->ol_flags |= PKT_RX_RSS_HASH; } } -#else -static void -sfc_efx_rx_set_rss_hash(__rte_unused struct sfc_efx_rxq *rxq, - __rte_unused unsigned int flags, - __rte_unused struct rte_mbuf *m) -{ -} -#endif static uint16_t sfc_efx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) @@ -1068,10 +1059,8 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, info.batch_max = encp->enc_rx_batch_max; info.prefix_size = encp->enc_rx_prefix_size; -#if EFSYS_OPT_RX_SCALE if (sa->hash_support == EFX_RX_HASH_AVAILABLE && sa->rss_channels > 0) info.flags |= SFC_RXQ_FLAG_RSS_HASH; -#endif info.rxq_entries = rxq_info->entries; info.rxq_hw_ring = rxq->mem.esm_base; @@ -1141,7 +1130,6 @@ sfc_rx_qfini(struct sfc_adapter *sa, unsigned int sw_index) rte_free(rxq); } -#if EFSYS_OPT_RX_SCALE efx_rx_hash_type_t sfc_rte_to_efx_hash_type(uint64_t rss_hf) { @@ -1185,9 +1173,7 @@ sfc_efx_to_rte_hash_type(efx_rx_hash_type_t efx_hash_types) return rss_hf; } -#endif -#if EFSYS_OPT_RX_SCALE static int sfc_rx_process_adv_conf_rss(struct sfc_adapter *sa, struct rte_eth_rss_conf *conf) @@ -1248,13 +1234,6 @@ sfc_rx_rss_config(struct sfc_adapter *sa) finish: return rc; } -#else -static int -sfc_rx_rss_config(__rte_unused struct sfc_adapter *sa) -{ - return 0; -} -#endif int sfc_rx_start(struct sfc_adapter *sa) @@ -1337,14 +1316,12 @@ sfc_rx_check_mode(struct sfc_adapter *sa, struct rte_eth_rxmode *rxmode) case ETH_MQ_RX_NONE: /* No special checks are required */ break; -#if EFSYS_OPT_RX_SCALE case ETH_MQ_RX_RSS: if (sa->rss_support == EFX_RX_SCALE_UNAVAILABLE) { sfc_err(sa, "RSS is not available"); rc = EINVAL; } break; -#endif default: sfc_err(sa, "Rx multi-queue mode %u not supported", rxmode->mq_mode); @@ -1446,7 +1423,6 @@ sfc_rx_configure(struct sfc_adapter *sa) sa->rxq_count++; } -#if EFSYS_OPT_RX_SCALE sa->rss_channels = (dev_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) ? MIN(sa->rxq_count, EFX_MAXRSS) : 0; @@ -1462,7 +1438,6 @@ sfc_rx_configure(struct sfc_adapter *sa) if (rc != 0) goto fail_rx_process_adv_conf_rss; } -#endif done: return 0; diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 6706ee6fca..ea911be58a 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -152,10 +152,8 @@ unsigned int sfc_rx_qdesc_npending(struct sfc_adapter *sa, unsigned int sw_index); int sfc_rx_qdesc_done(struct sfc_dp_rxq *dp_rxq, unsigned int offset); -#if EFSYS_OPT_RX_SCALE efx_rx_hash_type_t sfc_rte_to_efx_hash_type(uint64_t rss_hf); uint64_t sfc_efx_to_rte_hash_type(efx_rx_hash_type_t efx_hash_types); -#endif #ifdef __cplusplus } -- 2.20.1