* [dpdk-dev] [PATCH 1/2] net/cxgbe: use C11 atomics instead of rte_atomic ops
2021-06-02 21:57 [dpdk-dev] [PATCH 0/2] net/cxgbe: add RAW MAC matchall filter support Rahul Lakkireddy
@ 2021-06-02 21:57 ` Rahul Lakkireddy
2021-06-02 21:57 ` [dpdk-dev] [PATCH 2/2] net/cxgbe: add MAC matchall to track promisc traffic Rahul Lakkireddy
2021-06-29 9:42 ` [dpdk-dev] [PATCH 0/2] net/cxgbe: add RAW MAC matchall filter support Andrew Rybchenko
2 siblings, 0 replies; 4+ messages in thread
From: Rahul Lakkireddy @ 2021-06-02 21:57 UTC (permalink / raw)
To: dev
Replace rte_atomic ops with C11 atomics.
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
drivers/net/cxgbe/base/t4_hw.c | 1 -
drivers/net/cxgbe/clip_tbl.c | 13 +++++++------
drivers/net/cxgbe/clip_tbl.h | 2 +-
drivers/net/cxgbe/cxgbe_ethdev.c | 1 -
drivers/net/cxgbe/cxgbe_main.c | 23 ++++++++++++-----------
drivers/net/cxgbe/cxgbe_ofld.h | 6 +++---
drivers/net/cxgbe/l2t.c | 14 +++++++-------
drivers/net/cxgbe/l2t.h | 2 +-
drivers/net/cxgbe/mps_tcam.c | 12 ++++++------
drivers/net/cxgbe/mps_tcam.h | 2 +-
drivers/net/cxgbe/sge.c | 1 -
drivers/net/cxgbe/smt.c | 14 +++++++-------
drivers/net/cxgbe/smt.h | 2 +-
13 files changed, 46 insertions(+), 47 deletions(-)
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 7ebf4a9a70..b60bcdc3bc 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -9,7 +9,6 @@
#include <rte_log.h>
#include <rte_debug.h>
#include <rte_pci.h>
-#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_memory.h>
#include <rte_tailq.h>
diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c
index a0ab2a6ac8..072fc74f68 100644
--- a/drivers/net/cxgbe/clip_tbl.c
+++ b/drivers/net/cxgbe/clip_tbl.c
@@ -55,7 +55,7 @@ void cxgbe_clip_release(struct rte_eth_dev *dev, struct clip_entry *ce)
int ret;
t4_os_lock(&ce->lock);
- if (rte_atomic32_dec_and_test(&ce->refcnt)) {
+ if (__atomic_sub_fetch(&ce->refcnt, 1, __ATOMIC_RELAXED) == 0) {
ret = clip6_release_mbox(dev, ce->addr);
if (ret)
dev_debug(adap, "CLIP FW DEL CMD failed: %d", ret);
@@ -79,7 +79,7 @@ static struct clip_entry *find_or_alloc_clipe(struct clip_tbl *c,
unsigned int clipt_size = c->clipt_size;
for (e = &c->cl_list[0], end = &c->cl_list[clipt_size]; e != end; ++e) {
- if (rte_atomic32_read(&e->refcnt) == 0) {
+ if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) == 0) {
if (!first_free)
first_free = e;
} else {
@@ -114,11 +114,12 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,
ce = find_or_alloc_clipe(ctbl, lip);
if (ce) {
t4_os_lock(&ce->lock);
- if (!rte_atomic32_read(&ce->refcnt)) {
+ if (__atomic_load_n(&ce->refcnt, __ATOMIC_RELAXED) == 0) {
rte_memcpy(ce->addr, lip, sizeof(ce->addr));
if (v6) {
ce->type = FILTER_TYPE_IPV6;
- rte_atomic32_set(&ce->refcnt, 1);
+ __atomic_store_n(&ce->refcnt, 1,
+ __ATOMIC_RELAXED);
ret = clip6_get_mbox(dev, lip);
if (ret)
dev_debug(adap,
@@ -128,7 +129,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,
ce->type = FILTER_TYPE_IPV4;
}
} else {
- rte_atomic32_inc(&ce->refcnt);
+ __atomic_add_fetch(&ce->refcnt, 1, __ATOMIC_RELAXED);
}
t4_os_unlock(&ce->lock);
}
@@ -177,7 +178,7 @@ struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,
for (i = 0; i < ctbl->clipt_size; i++) {
t4_os_lock_init(&ctbl->cl_list[i].lock);
- rte_atomic32_set(&ctbl->cl_list[i].refcnt, 0);
+ ctbl->cl_list[i].refcnt = 0;
}
return ctbl;
diff --git a/drivers/net/cxgbe/clip_tbl.h b/drivers/net/cxgbe/clip_tbl.h
index 737ccc6911..d7689f4b7a 100644
--- a/drivers/net/cxgbe/clip_tbl.h
+++ b/drivers/net/cxgbe/clip_tbl.h
@@ -13,7 +13,7 @@ struct clip_entry {
enum filter_type type; /* entry type */
u32 addr[4]; /* IPV4 or IPV6 address */
rte_spinlock_t lock; /* entry lock */
- rte_atomic32_t refcnt; /* entry reference count */
+ u32 refcnt; /* entry reference count */
};
struct clip_tbl {
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index a12a98157c..b88f80fd3e 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -21,7 +21,6 @@
#include <rte_debug.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
-#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_memory.h>
#include <rte_tailq.h>
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index c759d97f8c..b14ce283ed 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -20,7 +20,6 @@
#include <rte_log.h>
#include <rte_debug.h>
#include <rte_pci.h>
-#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_memory.h>
#include <rte_tailq.h>
@@ -417,13 +416,15 @@ void cxgbe_remove_tid(struct tid_info *t, unsigned int chan, unsigned int tid,
if (t->tid_tab[tid]) {
t->tid_tab[tid] = NULL;
- rte_atomic32_dec(&t->conns_in_use);
+ __atomic_sub_fetch(&t->conns_in_use, 1, __ATOMIC_RELAXED);
if (t->hash_base && tid >= t->hash_base) {
if (family == FILTER_TYPE_IPV4)
- rte_atomic32_dec(&t->hash_tids_in_use);
+ __atomic_sub_fetch(&t->hash_tids_in_use, 1,
+ __ATOMIC_RELAXED);
} else {
if (family == FILTER_TYPE_IPV4)
- rte_atomic32_dec(&t->tids_in_use);
+ __atomic_sub_fetch(&t->tids_in_use, 1,
+ __ATOMIC_RELAXED);
}
}
@@ -445,13 +446,15 @@ void cxgbe_insert_tid(struct tid_info *t, void *data, unsigned int tid,
t->tid_tab[tid] = data;
if (t->hash_base && tid >= t->hash_base) {
if (family == FILTER_TYPE_IPV4)
- rte_atomic32_inc(&t->hash_tids_in_use);
+ __atomic_add_fetch(&t->hash_tids_in_use, 1,
+ __ATOMIC_RELAXED);
} else {
if (family == FILTER_TYPE_IPV4)
- rte_atomic32_inc(&t->tids_in_use);
+ __atomic_add_fetch(&t->tids_in_use, 1,
+ __ATOMIC_RELAXED);
}
- rte_atomic32_inc(&t->conns_in_use);
+ __atomic_add_fetch(&t->conns_in_use, 1, __ATOMIC_RELAXED);
}
/**
@@ -504,10 +507,8 @@ static int tid_init(struct tid_info *t)
t->afree = NULL;
t->atids_in_use = 0;
- rte_atomic32_init(&t->tids_in_use);
- rte_atomic32_set(&t->tids_in_use, 0);
- rte_atomic32_init(&t->conns_in_use);
- rte_atomic32_set(&t->conns_in_use, 0);
+ t->tids_in_use = 0;
+ t->conns_in_use = 0;
/* Setup the free list for atid_tab and clear the stid bitmap. */
if (natids) {
diff --git a/drivers/net/cxgbe/cxgbe_ofld.h b/drivers/net/cxgbe/cxgbe_ofld.h
index 50931ed048..33697c7628 100644
--- a/drivers/net/cxgbe/cxgbe_ofld.h
+++ b/drivers/net/cxgbe/cxgbe_ofld.h
@@ -60,10 +60,10 @@ struct tid_info {
unsigned int atids_in_use;
/* TIDs in the TCAM */
- rte_atomic32_t tids_in_use;
+ u32 tids_in_use;
/* TIDs in the HASH */
- rte_atomic32_t hash_tids_in_use;
- rte_atomic32_t conns_in_use;
+ u32 hash_tids_in_use;
+ u32 conns_in_use;
rte_spinlock_t atid_lock __rte_cache_aligned;
rte_spinlock_t ftid_lock;
diff --git a/drivers/net/cxgbe/l2t.c b/drivers/net/cxgbe/l2t.c
index f9d651fe09..66f578908a 100644
--- a/drivers/net/cxgbe/l2t.c
+++ b/drivers/net/cxgbe/l2t.c
@@ -14,8 +14,8 @@
*/
void cxgbe_l2t_release(struct l2t_entry *e)
{
- if (rte_atomic32_read(&e->refcnt) != 0)
- rte_atomic32_dec(&e->refcnt);
+ if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) != 0)
+ __atomic_sub_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
}
/**
@@ -112,7 +112,7 @@ static struct l2t_entry *find_or_alloc_l2e(struct l2t_data *d, u16 vlan,
struct l2t_entry *first_free = NULL;
for (e = &d->l2tab[0], end = &d->l2tab[d->l2t_size]; e != end; ++e) {
- if (rte_atomic32_read(&e->refcnt) == 0) {
+ if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) == 0) {
if (!first_free)
first_free = e;
} else {
@@ -151,18 +151,18 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev,
e = find_or_alloc_l2e(d, vlan, port, eth_addr);
if (e) {
t4_os_lock(&e->lock);
- if (!rte_atomic32_read(&e->refcnt)) {
+ if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) == 0) {
e->state = L2T_STATE_SWITCHING;
e->vlan = vlan;
e->lport = port;
rte_memcpy(e->dmac, eth_addr, RTE_ETHER_ADDR_LEN);
- rte_atomic32_set(&e->refcnt, 1);
+ __atomic_store_n(&e->refcnt, 1, __ATOMIC_RELAXED);
ret = write_l2e(dev, e, 0, !L2T_LPBK, !L2T_ARPMISS);
if (ret < 0)
dev_debug(adap, "Failed to write L2T entry: %d",
ret);
} else {
- rte_atomic32_inc(&e->refcnt);
+ __atomic_add_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
}
t4_os_unlock(&e->lock);
}
@@ -213,7 +213,7 @@ struct l2t_data *t4_init_l2t(unsigned int l2t_start, unsigned int l2t_end)
d->l2tab[i].idx = i;
d->l2tab[i].state = L2T_STATE_UNUSED;
t4_os_lock_init(&d->l2tab[i].lock);
- rte_atomic32_set(&d->l2tab[i].refcnt, 0);
+ d->l2tab[i].refcnt = 0;
}
return d;
diff --git a/drivers/net/cxgbe/l2t.h b/drivers/net/cxgbe/l2t.h
index 2c489e4aa2..9845c9f981 100644
--- a/drivers/net/cxgbe/l2t.h
+++ b/drivers/net/cxgbe/l2t.h
@@ -30,7 +30,7 @@ struct l2t_entry {
u8 lport; /* destination port */
u8 dmac[RTE_ETHER_ADDR_LEN]; /* destination MAC address */
rte_spinlock_t lock; /* entry lock */
- rte_atomic32_t refcnt; /* entry reference count */
+ u32 refcnt; /* entry reference count */
};
struct l2t_data {
diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c
index 6e5fae9928..178921b701 100644
--- a/drivers/net/cxgbe/mps_tcam.c
+++ b/drivers/net/cxgbe/mps_tcam.c
@@ -75,7 +75,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr,
t4_os_write_lock(&mpstcam->lock);
entry = cxgbe_mpstcam_lookup(adap->mpstcam, eth_addr, mask);
if (entry) {
- rte_atomic32_add(&entry->refcnt, 1);
+ __atomic_add_fetch(&entry->refcnt, 1, __ATOMIC_RELAXED);
t4_os_write_unlock(&mpstcam->lock);
return entry->idx;
}
@@ -97,7 +97,7 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr,
entry = &mpstcam->entry[ret];
memcpy(entry->eth_addr, eth_addr, RTE_ETHER_ADDR_LEN);
memcpy(entry->mask, mask, RTE_ETHER_ADDR_LEN);
- rte_atomic32_set(&entry->refcnt, 1);
+ __atomic_store_n(&entry->refcnt, 1, __ATOMIC_RELAXED);
entry->state = MPS_ENTRY_USED;
if (cxgbe_update_free_idx(mpstcam))
@@ -146,7 +146,7 @@ int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr)
* provided value is -1
*/
if (entry->state == MPS_ENTRY_UNUSED) {
- rte_atomic32_set(&entry->refcnt, 1);
+ __atomic_store_n(&entry->refcnt, 1, __ATOMIC_RELAXED);
entry->state = MPS_ENTRY_USED;
}
@@ -164,7 +164,7 @@ static inline void reset_mpstcam_entry(struct mps_tcam_entry *entry)
{
memset(entry->eth_addr, 0, RTE_ETHER_ADDR_LEN);
memset(entry->mask, 0, RTE_ETHER_ADDR_LEN);
- rte_atomic32_clear(&entry->refcnt);
+ __atomic_store_n(&entry->refcnt, 0, __ATOMIC_RELAXED);
entry->state = MPS_ENTRY_UNUSED;
}
@@ -189,12 +189,12 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx)
return -EINVAL;
}
- if (rte_atomic32_read(&entry->refcnt) == 1)
+ if (__atomic_load_n(&entry->refcnt, __ATOMIC_RELAXED) == 1)
ret = t4_free_raw_mac_filt(adap, pi->viid, entry->eth_addr,
entry->mask, idx, 1, pi->port_id,
false);
else
- ret = rte_atomic32_sub_return(&entry->refcnt, 1);
+ ret = __atomic_sub_fetch(&entry->refcnt, 1, __ATOMIC_RELAXED);
if (ret == 0) {
reset_mpstcam_entry(entry);
diff --git a/drivers/net/cxgbe/mps_tcam.h b/drivers/net/cxgbe/mps_tcam.h
index 3d1e8d3dbf..998c2b59df 100644
--- a/drivers/net/cxgbe/mps_tcam.h
+++ b/drivers/net/cxgbe/mps_tcam.h
@@ -28,7 +28,7 @@ struct mps_tcam_entry {
u8 mask[RTE_ETHER_ADDR_LEN];
struct mpstcam_table *mpstcam; /* backptr */
- rte_atomic32_t refcnt;
+ u32 refcnt;
};
struct mpstcam_table {
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index 56b8ec1f33..e5f7721dc4 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -20,7 +20,6 @@
#include <rte_log.h>
#include <rte_debug.h>
#include <rte_pci.h>
-#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_memory.h>
#include <rte_memzone.h>
diff --git a/drivers/net/cxgbe/smt.c b/drivers/net/cxgbe/smt.c
index b7b5a4a025..810c757184 100644
--- a/drivers/net/cxgbe/smt.c
+++ b/drivers/net/cxgbe/smt.c
@@ -119,7 +119,7 @@ static struct smt_entry *find_or_alloc_smte(struct smt_data *s, u8 *smac)
struct smt_entry *e, *end, *first_free = NULL;
for (e = &s->smtab[0], end = &s->smtab[s->smt_size]; e != end; ++e) {
- if (!rte_atomic32_read(&e->refcnt)) {
+ if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) == 0) {
if (!first_free)
first_free = e;
} else {
@@ -156,7 +156,7 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev,
e = find_or_alloc_smte(s, smac);
if (e) {
t4_os_lock(&e->lock);
- if (!rte_atomic32_read(&e->refcnt)) {
+ if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) == 0) {
e->pfvf = pfvf;
rte_memcpy(e->src_mac, smac, RTE_ETHER_ADDR_LEN);
ret = write_smt_entry(dev, e);
@@ -168,9 +168,9 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev,
goto out_write_unlock;
}
e->state = SMT_STATE_SWITCHING;
- rte_atomic32_set(&e->refcnt, 1);
+ __atomic_store_n(&e->refcnt, 1, __ATOMIC_RELAXED);
} else {
- rte_atomic32_inc(&e->refcnt);
+ __atomic_add_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
}
t4_os_unlock(&e->lock);
}
@@ -195,8 +195,8 @@ struct smt_entry *cxgbe_smt_alloc_switching(struct rte_eth_dev *dev, u8 *smac)
void cxgbe_smt_release(struct smt_entry *e)
{
- if (rte_atomic32_read(&e->refcnt))
- rte_atomic32_dec(&e->refcnt);
+ if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) != 0)
+ __atomic_sub_fetch(&e->refcnt, 1, __ATOMIC_RELAXED);
}
/**
@@ -221,7 +221,7 @@ struct smt_data *t4_init_smt(u32 smt_start_idx, u32 smt_size)
s->smtab[i].state = SMT_STATE_UNUSED;
memset(&s->smtab[i].src_mac, 0, RTE_ETHER_ADDR_LEN);
t4_os_lock_init(&s->smtab[i].lock);
- rte_atomic32_set(&s->smtab[i].refcnt, 0);
+ s->smtab[i].refcnt = 0;
}
return s;
}
diff --git a/drivers/net/cxgbe/smt.h b/drivers/net/cxgbe/smt.h
index 92c63c8760..e6e8aea964 100644
--- a/drivers/net/cxgbe/smt.h
+++ b/drivers/net/cxgbe/smt.h
@@ -23,7 +23,7 @@ struct smt_entry {
u16 pfvf;
u16 hw_idx;
u8 src_mac[RTE_ETHER_ADDR_LEN];
- rte_atomic32_t refcnt;
+ u32 refcnt;
rte_spinlock_t lock;
};
--
2.27.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/cxgbe: add MAC matchall to track promisc traffic
2021-06-02 21:57 [dpdk-dev] [PATCH 0/2] net/cxgbe: add RAW MAC matchall filter support Rahul Lakkireddy
2021-06-02 21:57 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: use C11 atomics instead of rte_atomic ops Rahul Lakkireddy
@ 2021-06-02 21:57 ` Rahul Lakkireddy
2021-06-29 9:42 ` [dpdk-dev] [PATCH 0/2] net/cxgbe: add RAW MAC matchall filter support Andrew Rybchenko
2 siblings, 0 replies; 4+ messages in thread
From: Rahul Lakkireddy @ 2021-06-02 21:57 UTC (permalink / raw)
To: dev
Chelsio T6 ASIC doesn't track Rx promisc traffic dropped due to lack
of Rx buffers and hence the imissed counter doesn't increment. Add
support for RAW MAC filter to insert a wildcard matchall rule at
the end of MPS TCAM to make MPS track the promisc traffic. This
rule will only be added/removed when promisc mode is turned on/off
on the interface.
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
doc/guides/nics/cxgbe.rst | 14 ++---
drivers/net/cxgbe/base/common.h | 3 +
drivers/net/cxgbe/base/t4fw_interface.h | 2 +
drivers/net/cxgbe/cxgbe_ethdev.c | 14 +++++
drivers/net/cxgbe/cxgbe_main.c | 14 +++++
drivers/net/cxgbe/mps_tcam.c | 75 ++++++++++++++++++++++++-
drivers/net/cxgbe/mps_tcam.h | 4 +-
7 files changed, 115 insertions(+), 11 deletions(-)
diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst
index 4a8fef07b8..a1d30c488b 100644
--- a/doc/guides/nics/cxgbe.rst
+++ b/doc/guides/nics/cxgbe.rst
@@ -70,7 +70,7 @@ in :ref:`t5-nics` and :ref:`t6-nics`.
Prerequisites
-------------
-- Requires firmware version **1.25.4.0** and higher. Visit
+- Requires firmware version **1.25.6.0** and higher. Visit
`Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware
bundled with the latest Chelsio Unified Wire package.
@@ -404,7 +404,7 @@ Unified Wire package for Linux operating system are as follows:
.. code-block:: console
- firmware-version: 1.25.4.0, TP 0.1.23.2
+ firmware-version: 1.25.6.0, TP 0.1.23.2
Running testpmd
~~~~~~~~~~~~~~~
@@ -462,7 +462,7 @@ devices managed by librte_net_cxgbe in Linux operating system.
EAL: PCI memory mapped at 0x7fd7c0200000
EAL: PCI memory mapped at 0x7fd77cdfd000
EAL: PCI memory mapped at 0x7fd7c10b7000
- PMD: rte_cxgbe_pmd: fw: 1.25.4.0, TP: 0.1.23.2
+ PMD: rte_cxgbe_pmd: fw: 1.25.6.0, TP: 0.1.23.2
PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
Interactive-mode selected
Configuring Port 0 (socket 0)
@@ -568,7 +568,7 @@ virtual functions.
[...]
EAL: PCI device 0000:02:01.0 on NUMA socket 0
EAL: probe driver: 1425:5803 net_cxgbevf
- PMD: rte_cxgbe_pmd: Firmware version: 1.25.4.0
+ PMD: rte_cxgbe_pmd: Firmware version: 1.25.6.0
PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2
PMD: rte_cxgbe_pmd: Chelsio rev 0
PMD: rte_cxgbe_pmd: No bootstrap loaded
@@ -576,7 +576,7 @@ virtual functions.
PMD: rte_cxgbe_pmd: 0000:02:01.0 Chelsio rev 0 1G/10GBASE-SFP
EAL: PCI device 0000:02:01.1 on NUMA socket 0
EAL: probe driver: 1425:5803 net_cxgbevf
- PMD: rte_cxgbe_pmd: Firmware version: 1.25.4.0
+ PMD: rte_cxgbe_pmd: Firmware version: 1.25.6.0
PMD: rte_cxgbe_pmd: TP Microcode version: 0.1.23.2
PMD: rte_cxgbe_pmd: Chelsio rev 0
PMD: rte_cxgbe_pmd: No bootstrap loaded
@@ -654,7 +654,7 @@ Unified Wire package for FreeBSD operating system are as follows:
.. code-block:: console
- dev.t5nex.0.firmware_version: 1.25.4.0
+ dev.t5nex.0.firmware_version: 1.25.6.0
Running testpmd
~~~~~~~~~~~~~~~
@@ -772,7 +772,7 @@ devices managed by librte_net_cxgbe in FreeBSD operating system.
EAL: PCI memory mapped at 0x8007ec000
EAL: PCI memory mapped at 0x842800000
EAL: PCI memory mapped at 0x80086c000
- PMD: rte_cxgbe_pmd: fw: 1.25.4.0, TP: 0.1.23.2
+ PMD: rte_cxgbe_pmd: fw: 1.25.6.0, TP: 0.1.23.2
PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter
Interactive-mode selected
Configuring Port 0 (socket 0)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 2f8569cbbc..58d7d7a8f2 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -266,6 +266,9 @@ struct adapter_params {
u32 viid_smt_extn_support:1; /* FW returns vin and smt index */
u32 max_tx_coalesce_num; /* Max # of Tx packets that can be coalesced */
u8 vi_enable_rx; /* FW support for enable/disable VI Rx at runtime */
+
+ u16 rawf_start; /* FW supports RAW MAC match-all filters */
+ u16 rawf_size;
};
/* Firmware Port Capabilities types.
diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h
index 0310a7ce8b..a0a9292c0c 100644
--- a/drivers/net/cxgbe/base/t4fw_interface.h
+++ b/drivers/net/cxgbe/base/t4fw_interface.h
@@ -703,6 +703,8 @@ enum fw_params_param_dev {
FW_PARAMS_PARAM_DEV_HASHFILTER_WITH_OFLD = 0x28,
FW_PARAMS_PARAM_DEV_FILTER = 0x2E,
FW_PARAMS_PARAM_DEV_VI_ENABLE_INGRESS_AFTER_LINKUP = 0x32,
+ FW_PARAMS_PARAM_PFVF_RAWF_START = 0x36,
+ FW_PARAMS_PARAM_PFVF_RAWF_END = 0x37,
};
/*
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index b88f80fd3e..550843b4d7 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -152,6 +152,13 @@ int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
{
struct port_info *pi = eth_dev->data->dev_private;
struct adapter *adapter = pi->adapter;
+ int ret;
+
+ if (adapter->params.rawf_size != 0) {
+ ret = cxgbe_mpstcam_rawf_enable(pi);
+ if (ret < 0)
+ return ret;
+ }
return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
1, -1, 1, -1, false);
@@ -161,6 +168,13 @@ int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
{
struct port_info *pi = eth_dev->data->dev_private;
struct adapter *adapter = pi->adapter;
+ int ret;
+
+ if (adapter->params.rawf_size != 0) {
+ ret = cxgbe_mpstcam_rawf_disable(pi);
+ if (ret < 0)
+ return ret;
+ }
return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
0, -1, 1, -1, false);
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index b14ce283ed..6dd1bf1f83 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1501,6 +1501,20 @@ static int adap_init0(struct adapter *adap)
ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, params, val);
adap->params.vi_enable_rx = (ret == 0 && val[0] != 0);
+ /* Read the RAW MPS entries. In T6, the last 2 TCAM entries
+ * are reserved for RAW MAC addresses (rawf = 2, one per port).
+ */
+ if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) {
+ params[0] = CXGBE_FW_PARAM_PFVF(RAWF_START);
+ params[1] = CXGBE_FW_PARAM_PFVF(RAWF_END);
+ ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2,
+ params, val);
+ if (ret == 0) {
+ adap->params.rawf_start = val[0];
+ adap->params.rawf_size = val[1] - val[0] + 1;
+ }
+ }
+
/*
* The MTU/MSS Table is initialized by now, so load their values. If
* we're initializing the adapter, then we'll make any modifications
diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c
index 178921b701..abbf06e1a1 100644
--- a/drivers/net/cxgbe/mps_tcam.c
+++ b/drivers/net/cxgbe/mps_tcam.c
@@ -49,7 +49,8 @@ cxgbe_mpstcam_lookup(struct mpstcam_table *t, const u8 *eth_addr,
return NULL;
for (i = 0; i < t->size; i++) {
- if (entry[i].state == MPS_ENTRY_UNUSED)
+ if (entry[i].state == MPS_ENTRY_UNUSED ||
+ entry[i].state == MPS_ENTRY_RAWF)
continue; /* entry is not being used */
if (match_entry(&entry[i], eth_addr, mask))
return &entry[i];
@@ -184,7 +185,7 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx)
return -EOPNOTSUPP;
t4_os_write_lock(&t->lock);
entry = &t->entry[idx];
- if (entry->state == MPS_ENTRY_UNUSED) {
+ if (entry->state != MPS_ENTRY_USED) {
t4_os_write_unlock(&t->lock);
return -EINVAL;
}
@@ -206,11 +207,73 @@ int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx)
return ret;
}
+int cxgbe_mpstcam_rawf_enable(struct port_info *pi)
+{
+ struct adapter *adap = pi->adapter;
+ struct mps_tcam_entry *entry;
+ struct mpstcam_table *t;
+ u16 rawf_idx;
+ int ret = 0;
+
+ t = adap->mpstcam;
+ if (adap->params.rawf_size == 0 || t == NULL)
+ return -EOPNOTSUPP;
+
+ t4_os_write_lock(&t->lock);
+ rawf_idx = adap->params.rawf_start + pi->port_id;
+ entry = &t->entry[rawf_idx];
+ if (__atomic_load_n(&entry->refcnt, __ATOMIC_RELAXED) == 1)
+ goto out_unlock;
+
+ ret = t4_alloc_raw_mac_filt(adap, pi->viid, entry->eth_addr,
+ entry->mask, rawf_idx, 0, pi->port_id,
+ false);
+ if (ret < 0)
+ goto out_unlock;
+
+ __atomic_store_n(&entry->refcnt, 1, __ATOMIC_RELAXED);
+
+out_unlock:
+ t4_os_write_unlock(&t->lock);
+ return ret;
+}
+
+int cxgbe_mpstcam_rawf_disable(struct port_info *pi)
+{
+ struct adapter *adap = pi->adapter;
+ struct mps_tcam_entry *entry;
+ struct mpstcam_table *t;
+ u16 rawf_idx;
+ int ret = 0;
+
+ t = adap->mpstcam;
+ if (adap->params.rawf_size == 0 || t == NULL)
+ return -EOPNOTSUPP;
+
+ t4_os_write_lock(&t->lock);
+ rawf_idx = adap->params.rawf_start + pi->port_id;
+ entry = &t->entry[rawf_idx];
+ if (__atomic_load_n(&entry->refcnt, __ATOMIC_RELAXED) != 1)
+ goto out_unlock;
+
+ ret = t4_free_raw_mac_filt(adap, pi->viid, entry->eth_addr,
+ entry->mask, rawf_idx, 0, pi->port_id,
+ false);
+ if (ret < 0)
+ goto out_unlock;
+
+ __atomic_store_n(&entry->refcnt, 0, __ATOMIC_RELAXED);
+
+out_unlock:
+ t4_os_write_unlock(&t->lock);
+ return ret;
+}
+
struct mpstcam_table *t4_init_mpstcam(struct adapter *adap)
{
+ u16 size = adap->params.arch.mps_tcam_size;
struct mpstcam_table *t;
int i;
- u16 size = adap->params.arch.mps_tcam_size;
t = t4_os_alloc(sizeof(*t) + size * sizeof(struct mps_tcam_entry));
if (!t)
@@ -226,6 +289,12 @@ struct mpstcam_table *t4_init_mpstcam(struct adapter *adap)
t->entry[i].idx = i;
}
+ /* RAW MAC entries are reserved for match-all wildcard to
+ * match all promiscuous traffic. So, mark them special.
+ */
+ for (i = 0; i < adap->params.rawf_size; i++)
+ t->entry[adap->params.rawf_start + i].state = MPS_ENTRY_RAWF;
+
/* first entry is used by chip. this is overwritten only
* in t4_cleanup_mpstcam()
*/
diff --git a/drivers/net/cxgbe/mps_tcam.h b/drivers/net/cxgbe/mps_tcam.h
index 998c2b59df..a359f52442 100644
--- a/drivers/net/cxgbe/mps_tcam.h
+++ b/drivers/net/cxgbe/mps_tcam.h
@@ -17,6 +17,7 @@ enum {
* for a specific entry
*/
MPS_ENTRY_USED,
+ MPS_ENTRY_RAWF, /* Reserved for RAW MAC Filters */
};
struct mps_tcam_entry {
@@ -48,5 +49,6 @@ void t4_cleanup_mpstcam(struct adapter *adap);
int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *mac, const u8 *mask);
int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx);
int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr);
-
+int cxgbe_mpstcam_rawf_enable(struct port_info *pi);
+int cxgbe_mpstcam_rawf_disable(struct port_info *pi);
#endif /* _CXGBE_MPSTCAM_H_ */
--
2.27.0
^ permalink raw reply [flat|nested] 4+ messages in thread