Page MenuHomeFreeBSD

D59809.diff
No OneTemporary

D59809.diff

Index: sys/dev/bnxt/bnxt_en/bnxt.h
===================================================================
--- sys/dev/bnxt/bnxt_en/bnxt.h
+++ sys/dev/bnxt/bnxt_en/bnxt.h
@@ -581,6 +581,7 @@
uint16_t rss_id;
uint32_t rss_hash_type;
uint8_t rss_hash_key[HW_HASH_KEY_SIZE];
+ bool rss_configured;
struct iflib_dma_info rss_hash_key_tbl;
struct iflib_dma_info rss_grp_tbl;
SLIST_HEAD(vlan_head, bnxt_vlan_tag) vlan_tags;
Index: sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
===================================================================
--- sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
+++ sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
@@ -2406,6 +2406,8 @@
struct hwrm_vnic_rss_cfg_input req = {0};
int rc;
+ /* A failed live update leaves the effective configuration unknown. */
+ vnic->rss_configured = false;
/* Publish both live key changes and policy cached while stopped. */
memcpy(vnic->rss_hash_key_tbl.idi_vaddr, vnic->rss_hash_key,
HW_HASH_KEY_SIZE);
@@ -2430,6 +2432,7 @@
rc = hwrm_send_message(softc, &req, sizeof(req));
bus_dmamap_sync(vnic->rss_hash_key_tbl.idi_tag,
vnic->rss_hash_key_tbl.idi_map, BUS_DMASYNC_POSTWRITE);
+ vnic->rss_configured = (rc == 0);
return (rc);
}
Index: sys/dev/bnxt/bnxt_en/if_bnxt.c
===================================================================
--- sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -229,6 +229,8 @@
static int bnxt_media_change(if_ctx_t ctx);
static int bnxt_promisc_set(if_ctx_t ctx, int flags);
static uint64_t bnxt_get_counter(if_ctx_t, ift_counter);
+static int bnxt_get_rss_key(if_ctx_t, struct ifrsskey *);
+static int bnxt_get_rss_hash(if_ctx_t, struct ifrsshash *);
static void bnxt_update_admin_status(if_ctx_t ctx);
static void bnxt_if_timer(if_ctx_t ctx, uint16_t qid);
@@ -358,6 +360,8 @@
DEVMETHOD(ifdi_media_change, bnxt_media_change),
DEVMETHOD(ifdi_promisc_set, bnxt_promisc_set),
DEVMETHOD(ifdi_get_counter, bnxt_get_counter),
+ DEVMETHOD(ifdi_get_rss_key, bnxt_get_rss_key),
+ DEVMETHOD(ifdi_get_rss_hash, bnxt_get_rss_hash),
DEVMETHOD(ifdi_update_admin_status, bnxt_update_admin_status),
DEVMETHOD(ifdi_timer, bnxt_if_timer),
@@ -4058,6 +4062,66 @@
return rc;
}
+static int
+bnxt_rss_query_status(struct bnxt_softc *softc)
+{
+
+ sx_assert(iflib_ctx_lock_get(softc->ctx), SA_XLOCKED);
+ if (!iflib_is_running(softc->ctx) || !softc->is_dev_init ||
+ !bnxt_control_ready(softc) || !softc->vnic_info.rss_configured)
+ return (ENXIO);
+ return (0);
+}
+
+static int
+bnxt_get_rss_key(if_ctx_t ctx, struct ifrsskey *ifrk)
+{
+ struct bnxt_softc *softc = iflib_get_softc(ctx);
+ struct bnxt_vnic_info *vnic = &softc->vnic_info;
+ int error;
+
+ error = bnxt_rss_query_status(softc);
+ if (error != 0)
+ return (error);
+ ifrk->ifrk_func = vnic->rss_hash_type == 0 ? RSS_FUNC_NONE :
+ RSS_FUNC_TOEPLITZ;
+ ifrk->ifrk_keylen = vnic->rss_hash_type == 0 ? 0 :
+ sizeof(vnic->rss_hash_key);
+ _Static_assert(sizeof(ifrk->ifrk_key) >= sizeof(vnic->rss_hash_key),
+ "RSS query buffer too small");
+ bzero(ifrk->ifrk_key, sizeof(ifrk->ifrk_key));
+ memcpy(ifrk->ifrk_key, vnic->rss_hash_key, ifrk->ifrk_keylen);
+ return (0);
+}
+
+static int
+bnxt_get_rss_hash(if_ctx_t ctx, struct ifrsshash *ifrh)
+{
+ struct bnxt_softc *softc = iflib_get_softc(ctx);
+ uint32_t types;
+ int error;
+
+ error = bnxt_rss_query_status(softc);
+ if (error != 0)
+ return (error);
+ types = softc->vnic_info.rss_hash_type;
+ ifrh->ifrh_func = types == 0 ? RSS_FUNC_NONE : RSS_FUNC_TOEPLITZ;
+ ifrh->ifrh_types = 0;
+ if (types & HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4)
+ ifrh->ifrh_types |= RSS_TYPE_IPV4;
+ if (types & HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4)
+ ifrh->ifrh_types |= RSS_TYPE_TCP_IPV4;
+ if (types & HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4)
+ ifrh->ifrh_types |= RSS_TYPE_UDP_IPV4;
+ if (types & HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6)
+ ifrh->ifrh_types |= RSS_TYPE_IPV6;
+ if (types & HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6)
+ ifrh->ifrh_types |= RSS_TYPE_TCP_IPV6;
+ if (types & HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6)
+ ifrh->ifrh_types |= RSS_TYPE_UDP_IPV6;
+ return (0);
+}
+
static uint64_t
bnxt_get_counter(if_ctx_t ctx, ift_counter cnt)
{
@@ -5399,6 +5463,7 @@
{
int i;
+ softc->vnic_info.rss_configured = false;
softc->def_cp_ring.stats_ctx_id = HWRM_NA_SIGNATURE;
softc->def_cp_ring.ring.phys_id = (uint16_t)HWRM_NA_SIGNATURE;
softc->def_nq_ring.stats_ctx_id = HWRM_NA_SIGNATURE;

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 25, 3:36 AM (4 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39567795
Default Alt Text
D59809.diff (4 KB)

Event Timeline