]> git.droids-corp.org - dpdk.git/commitdiff
net/sfc/base: rename API to check Rx scale and hash support
authorMark Spender <mspender@solarflare.com>
Wed, 30 Aug 2017 18:17:35 +0000 (19:17 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:47 +0000 (02:49 +0200)
Rename efx_rx_scale_support_get() to efx_rx_scale_default_support_get(),
and efx_rx_hash_support_get() to efx_rx_hash_default_support_get().

All these really report is whether an exclusive RSS context was
successfully acquired at efx_rx_init().

efx_rx_scale_support_get() sounds like it reports whether the device
supports RSS, and whether exclusive or shared contexts are supported,
but it doesn't do that. Renaming it to
efx_rx_scale_default_support_get() helps to reflect that it reports
what RSS support the client gets without trying to allocate RSS
contexts itself.

Also rename efx_rx_scale_support_t to efx_rx_scale_context_type_t, to
make the enum more suitable for specifying the type of an RSS context
to be allocated.

Signed-off-by: Mark Spender <mspender@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
drivers/net/sfc/base/ef10_rx.c
drivers/net/sfc/base/efx.h
drivers/net/sfc/base/efx_impl.h
drivers/net/sfc/base/efx_rx.c
drivers/net/sfc/sfc.c
drivers/net/sfc/sfc.h

index 661caa88bdd60b7e13504d91426680ce76560f3e..9bd5353af422b942905cd1e8fba086f9a602c572 100644 (file)
@@ -159,7 +159,7 @@ fail1:
 static __checkReturn   efx_rc_t
 efx_mcdi_rss_context_alloc(
        __in            efx_nic_t *enp,
-       __in            efx_rx_scale_support_t scale_support,
+       __in            efx_rx_scale_context_type_t type,
        __in            uint32_t num_queues,
        __out           uint32_t *rss_contextp)
 {
@@ -175,7 +175,7 @@ efx_mcdi_rss_context_alloc(
                goto fail1;
        }
 
-       switch (scale_support) {
+       switch (type) {
        case EFX_RX_SCALE_EXCLUSIVE:
                context_type = MC_CMD_RSS_CONTEXT_ALLOC_IN_TYPE_EXCLUSIVE;
                break;
@@ -461,7 +461,7 @@ ef10_rx_init(
                 * Allocated an exclusive RSS context, which allows both the
                 * indirection table and key to be modified.
                 */
-               enp->en_rss_support = EFX_RX_SCALE_EXCLUSIVE;
+               enp->en_rss_context_type = EFX_RX_SCALE_EXCLUSIVE;
                enp->en_hash_support = EFX_RX_HASH_AVAILABLE;
        } else {
                /*
@@ -469,7 +469,7 @@ ef10_rx_init(
                 * operation without support for RSS. The pseudo-header in
                 * received packets will not contain a Toeplitz hash value.
                 */
-               enp->en_rss_support = EFX_RX_SCALE_UNAVAILABLE;
+               enp->en_rss_context_type = EFX_RX_SCALE_UNAVAILABLE;
                enp->en_hash_support = EFX_RX_HASH_UNAVAILABLE;
        }
 
@@ -507,7 +507,7 @@ ef10_rx_scale_mode_set(
                goto fail1;
        }
 
-       if (enp->en_rss_support == EFX_RX_SCALE_UNAVAILABLE) {
+       if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
                rc = ENOTSUP;
                goto fail2;
        }
@@ -538,7 +538,7 @@ ef10_rx_scale_key_set(
 {
        efx_rc_t rc;
 
-       if (enp->en_rss_support == EFX_RX_SCALE_UNAVAILABLE) {
+       if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
                rc = ENOTSUP;
                goto fail1;
        }
@@ -567,7 +567,7 @@ ef10_rx_scale_tbl_set(
 {
        efx_rc_t rc;
 
-       if (enp->en_rss_support == EFX_RX_SCALE_UNAVAILABLE) {
+       if (enp->en_rss_context_type == EFX_RX_SCALE_UNAVAILABLE) {
                rc = ENOTSUP;
                goto fail1;
        }
@@ -964,11 +964,10 @@ ef10_rx_fini(
        __in    efx_nic_t *enp)
 {
 #if EFSYS_OPT_RX_SCALE
-       if (enp->en_rss_support != EFX_RX_SCALE_UNAVAILABLE) {
+       if (enp->en_rss_context_type != EFX_RX_SCALE_UNAVAILABLE)
                (void) efx_mcdi_rss_context_free(enp, enp->en_rss_context);
-       }
        enp->en_rss_context = 0;
-       enp->en_rss_support = EFX_RX_SCALE_UNAVAILABLE;
+       enp->en_rss_context_type = EFX_RX_SCALE_UNAVAILABLE;
 #else
        _NOTE(ARGUNUSED(enp))
 #endif /* EFSYS_OPT_RX_SCALE */
index c4ea4e1db76330a79e6ed9d101dad435ff94f4d2..7d370f4513452e300046f67f0bdc3358e99067a1 100644 (file)
@@ -1909,22 +1909,22 @@ typedef enum efx_rx_hash_support_e {
 #define        EFX_MAXRSS              64      /* RX indirection entry range */
 #define        EFX_MAXRSS_LEGACY       16      /* See bug16611 and bug17213 */
 
-typedef enum efx_rx_scale_support_e {
-       EFX_RX_SCALE_UNAVAILABLE = 0,   /* Not supported */
+typedef enum efx_rx_scale_context_type_e {
+       EFX_RX_SCALE_UNAVAILABLE = 0,   /* No RX scale context */
        EFX_RX_SCALE_EXCLUSIVE,         /* Writable key/indirection table */
        EFX_RX_SCALE_SHARED             /* Read-only key/indirection table */
-} efx_rx_scale_support_t;
+} efx_rx_scale_context_type_t;
 
 extern __checkReturn   efx_rc_t
-efx_rx_hash_support_get(
+efx_rx_hash_default_support_get(
        __in            efx_nic_t *enp,
        __out           efx_rx_hash_support_t *supportp);
 
 
 extern __checkReturn   efx_rc_t
-efx_rx_scale_support_get(
+efx_rx_scale_default_support_get(
        __in            efx_nic_t *enp,
-       __out           efx_rx_scale_support_t *supportp);
+       __out           efx_rx_scale_context_type_t *typep);
 
 extern __checkReturn   efx_rc_t
 efx_rx_scale_mode_set(
index 43add6d9908dfc44956b5639edcbabded01fe51e..f20c97f9bb0d9a352d7af62b10026e8224fc6a72 100644 (file)
@@ -648,9 +648,9 @@ struct efx_nic_s {
        const efx_vpd_ops_t     *en_evpdop;
 #endif /* EFSYS_OPT_VPD */
 #if EFSYS_OPT_RX_SCALE
-       efx_rx_hash_support_t   en_hash_support;
-       efx_rx_scale_support_t  en_rss_support;
-       uint32_t                en_rss_context;
+       efx_rx_hash_support_t           en_hash_support;
+       efx_rx_scale_context_type_t     en_rss_context_type;
+       uint32_t                        en_rss_context;
 #endif /* EFSYS_OPT_RX_SCALE */
        uint32_t                en_vport_id;
 #if EFSYS_OPT_LICENSING
index c81563418df265f72758a7655d5590f6b0699d40..41fc17e6c9cd609e140e1eb4f45219cbd6206510 100644 (file)
@@ -304,7 +304,7 @@ fail1:
 
 #if EFSYS_OPT_RX_SCALE
        __checkReturn   efx_rc_t
-efx_rx_hash_support_get(
+efx_rx_hash_default_support_get(
        __in            efx_nic_t *enp,
        __out           efx_rx_hash_support_t *supportp)
 {
@@ -318,7 +318,10 @@ efx_rx_hash_support_get(
                goto fail1;
        }
 
-       /* Report if resources are available to insert RX hash value */
+       /*
+        * Report the hashing support the client gets by default if it
+        * does not allocate an RSS context itself.
+        */
        *supportp = enp->en_hash_support;
 
        return (0);
@@ -330,22 +333,25 @@ fail1:
 }
 
        __checkReturn   efx_rc_t
-efx_rx_scale_support_get(
+efx_rx_scale_default_support_get(
        __in            efx_nic_t *enp,
-       __out           efx_rx_scale_support_t *supportp)
+       __out           efx_rx_scale_context_type_t *typep)
 {
        efx_rc_t rc;
 
        EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
        EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_RX);
 
-       if (supportp == NULL) {
+       if (typep == NULL) {
                rc = EINVAL;
                goto fail1;
        }
 
-       /* Report if resources are available to support RSS */
-       *supportp = enp->en_rss_support;
+       /*
+        * Report the RSS support the client gets by default if it
+        * does not allocate an RSS context itself.
+        */
+       *typep = enp->en_rss_context_type;
 
        return (0);
 
@@ -654,7 +660,7 @@ siena_rx_init(
 
 #if EFSYS_OPT_RX_SCALE
        /* The RSS key and indirection table are writable. */
-       enp->en_rss_support = EFX_RX_SCALE_EXCLUSIVE;
+       enp->en_rss_context_type = EFX_RX_SCALE_EXCLUSIVE;
 
        /* Hardware can insert RX hash with/without RSS */
        enp->en_hash_support = EFX_RX_HASH_AVAILABLE;
index 7849a1c289187f72bd5dd2571f6ab2b1a4254423..08f20dda851df6b80ed396879173cc1fc45a0e2c 100644 (file)
@@ -528,11 +528,11 @@ sfc_set_rss_defaults(struct sfc_adapter *sa)
        if (rc != 0)
                goto fail_rx_init;
 
-       rc = efx_rx_scale_support_get(sa->nic, &sa->rss_support);
+       rc = efx_rx_scale_default_support_get(sa->nic, &sa->rss_support);
        if (rc != 0)
                goto fail_scale_support_get;
 
-       rc = efx_rx_hash_support_get(sa->nic, &sa->hash_support);
+       rc = efx_rx_hash_default_support_get(sa->nic, &sa->hash_support);
        if (rc != 0)
                goto fail_hash_support_get;
 
index 286d1ac1d8865e80ff8bedc85651d1e173eb71f4..e41e79eaa22bd074748cdc850044e77b5f138fda 100644 (file)
@@ -225,7 +225,7 @@ struct sfc_adapter {
        unsigned int                    rss_channels;
 
 #if EFSYS_OPT_RX_SCALE
-       efx_rx_scale_support_t          rss_support;
+       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];