From: Ivan Malov <ivan.ma...@oktetlabs.ru>

Unused variables will be found in several places if RSS
support is disabled at build time; the patch is to fix it

Fixes: 4ec1fc3ba881 ("net/sfc: add basic stubs for RSS support on driver 
attach")
Fixes: d9ff551fc974 ("net/sfc: support RSS hash offload")
Cc: sta...@dpdk.org

Signed-off-by: Ivan Malov <ivan.ma...@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybche...@solarflare.com>
---
 drivers/net/sfc/sfc.c    |  8 ++++++--
 drivers/net/sfc/sfc_rx.c | 24 +++++++++++++++++++-----
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 6cecfc0..7849a1c 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -510,10 +510,10 @@
 };
 #endif
 
+#if EFSYS_OPT_RX_SCALE
 static int
 sfc_set_rss_defaults(struct sfc_adapter *sa)
 {
-#if EFSYS_OPT_RX_SCALE
        int rc;
 
        rc = efx_intr_init(sa->nic, sa->intr.type, NULL);
@@ -556,10 +556,14 @@
 
 fail_intr_init:
        return rc;
+}
 #else
+static int
+sfc_set_rss_defaults(__rte_unused struct sfc_adapter *sa)
+{
        return 0;
-#endif
 }
+#endif
 
 int
 sfc_attach(struct sfc_adapter *sa)
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 364f718..be46b23 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -207,11 +207,11 @@
        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)
 {
-#if EFSYS_OPT_RX_SCALE
        uint8_t *mbuf_data;
 
 
@@ -227,8 +227,15 @@
 
                m->ol_flags |= PKT_RX_RSS_HASH;
        }
-#endif
 }
+#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)
@@ -1050,12 +1057,12 @@ struct sfc_dp_rx sfc_efx_rx = {
 }
 #endif
 
+#if EFSYS_OPT_RX_SCALE
 static int
 sfc_rx_rss_config(struct sfc_adapter *sa)
 {
        int rc = 0;
 
-#if EFSYS_OPT_RX_SCALE
        if (sa->rss_channels > 0) {
                rc = efx_rx_scale_mode_set(sa->nic, EFX_RX_HASHALG_TOEPLITZ,
                                           sa->rss_hash_types, B_TRUE);
@@ -1072,9 +1079,15 @@ struct sfc_dp_rx sfc_efx_rx = {
        }
 
 finish:
-#endif
        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)
@@ -1243,7 +1256,6 @@ struct sfc_dp_rx sfc_efx_rx = {
 {
        struct rte_eth_conf *dev_conf = &sa->eth_dev->data->dev_conf;
        const unsigned int nb_rx_queues = sa->eth_dev->data->nb_rx_queues;
-       unsigned int sw_index;
        int rc;
 
        sfc_log_init(sa, "nb_rx_queues=%u (old %u)",
@@ -1296,6 +1308,8 @@ struct sfc_dp_rx sfc_efx_rx = {
                           MIN(sa->rxq_count, EFX_MAXRSS) : 0;
 
        if (sa->rss_channels > 0) {
+               unsigned int sw_index;
+
                for (sw_index = 0; sw_index < EFX_RSS_TBL_SIZE; ++sw_index)
                        sa->rss_tbl[sw_index] = sw_index % sa->rss_channels;
        }
-- 
1.8.2.3

Reply via email to