Re: [dpdk-dev] [PATCH 2/2] net/cxgbe: remove queue stats from basic stats
Hi Andrew, On Thursday, July 07/01/21, 2021 at 17:50:19 +0300, Andrew Rybchenko wrote: > On 6/3/21 6:30 PM, Rahul Lakkireddy wrote: > > Remove queue stats from basic stats because they're now available > > via xstats API. Also remove RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS flag. > > > > Signed-off-by: Rahul Lakkireddy > > --- > > drivers/net/cxgbe/cxgbe_ethdev.c | 18 +++--- > > 1 file changed, 3 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c > > b/drivers/net/cxgbe/cxgbe_ethdev.c > > index 8dee3fc3b6..141a2de808 100644 > > --- a/drivers/net/cxgbe/cxgbe_ethdev.c > > +++ b/drivers/net/cxgbe/cxgbe_ethdev.c > > @@ -747,22 +747,12 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev > > *eth_dev, > > eth_stats->oerrors = ps.tx_error_frames; > > > > for (i = 0; i < pi->n_rx_qsets; i++) { > > - struct sge_eth_rxq *rxq = > > - &s->ethrxq[pi->first_rxqset + i]; > > + struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_rxqset + i]; > > > > - eth_stats->q_ipackets[i] = rxq->stats.pkts; > > - eth_stats->q_ibytes[i] = rxq->stats.rx_bytes; > > - eth_stats->ipackets += eth_stats->q_ipackets[i]; > > - eth_stats->ibytes += eth_stats->q_ibytes[i]; > > + eth_stats->ipackets += rxq->stats.pkts; > > + eth_stats->ibytes += rxq->stats.rx_bytes; > > } > > > > - for (i = 0; i < pi->n_tx_qsets; i++) { > > - struct sge_eth_txq *txq = > > - &s->ethtxq[pi->first_txqset + i]; > > - > > - eth_stats->q_opackets[i] = txq->stats.pkts; > > - eth_stats->q_obytes[i] = txq->stats.tx_bytes; > > - } > > return 0; > > } > > > > @@ -1697,8 +1687,6 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev > > *eth_dev) > > return 0; > > } > > > > - eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > > - > > snprintf(name, sizeof(name), "cxgbeadapter%d", eth_dev->data->port_id); > > adapter = rte_zmalloc(name, sizeof(*adapter), 0); > > if (!adapter) > > > > As I understand it is correct to remove > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS to avoid duplication of per-queue > stats in xstats. But I don't understand why per-queue > stats are removed from basic stats. It still makes sense and > useful. Am I missing something? The per-queue stats are being removed from basic stats here because these will be removed from rte_eth_stats, as per the below deprecation notice. * ethdev: Queue specific stats fields will be removed from ``struct rte_eth_stats``. Mentioned fields are: ``q_ipackets``, ``q_opackets``, ``q_ibytes``, ``q_obytes``, ``q_errors``. Instead queue stats will be received via xstats API. Current method support will be limited to maximum 256 queues. Also compile time flag ``RTE_ETHDEV_QUEUE_STAT_CNTRS`` will be removed. Thanks, Rahul
[dpdk-dev] [PATCH v2 0/2] net/cxgbe: add support for xstats API
This series of patches add support to fetch port and queue stats via xstats API. Patch 1 adds support to fetch port and queue stats via xstats API. Patch 2 removes queue stats from basic stats since they're available via xstats API. Also removes RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS flag. --- v2: - Perform explicit checks for NULL in conditions. - Use rte_strlcpy() instead of strcpy(). Rahul Lakkireddy (2): net/cxgbe: add support for xstats API net/cxgbe: remove queue stats from basic stats drivers/net/cxgbe/cxgbe_ethdev.c | 321 --- 1 file changed, 297 insertions(+), 24 deletions(-) -- 2.27.0
[dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API
Add support to fetch port and queue stats via xstats API. Signed-off-by: Rahul Lakkireddy --- v2: - Perform explicit checks for NULL in conditions. - Use rte_strlcpy() instead of strcpy(). drivers/net/cxgbe/cxgbe_ethdev.c | 303 ++- 1 file changed, 294 insertions(+), 9 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 550843b4d7..5bbf7f28af 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -778,24 +778,304 @@ static int cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev) cxgbe_stats_reset(pi); for (i = 0; i < pi->n_rx_qsets; i++) { - struct sge_eth_rxq *rxq = - &s->ethrxq[pi->first_rxqset + i]; + struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_rxqset + i]; - rxq->stats.pkts = 0; - rxq->stats.rx_bytes = 0; + memset(&rxq->stats, 0, sizeof(rxq->stats)); } for (i = 0; i < pi->n_tx_qsets; i++) { - struct sge_eth_txq *txq = - &s->ethtxq[pi->first_txqset + i]; + struct sge_eth_txq *txq = &s->ethtxq[pi->first_txqset + i]; - txq->stats.pkts = 0; - txq->stats.tx_bytes = 0; - txq->stats.mapping_err = 0; + memset(&txq->stats, 0, sizeof(txq->stats)); } return 0; } +/* Store extended statistics names and its offset in stats structure */ +struct cxgbe_dev_xstats_name_off { + char name[RTE_ETH_XSTATS_NAME_SIZE]; + unsigned int offset; +}; + +static const struct cxgbe_dev_xstats_name_off cxgbe_dev_rxq_stats_strings[] = { + {"packets", offsetof(struct sge_eth_rx_stats, pkts)}, + {"bytes", offsetof(struct sge_eth_rx_stats, rx_bytes)}, + {"checksum_offloads", offsetof(struct sge_eth_rx_stats, rx_cso)}, + {"vlan_extractions", offsetof(struct sge_eth_rx_stats, vlan_ex)}, + {"dropped_packets", offsetof(struct sge_eth_rx_stats, rx_drops)}, +}; + +static const struct cxgbe_dev_xstats_name_off cxgbe_dev_txq_stats_strings[] = { + {"packets", offsetof(struct sge_eth_tx_stats, pkts)}, + {"bytes", offsetof(struct sge_eth_tx_stats, tx_bytes)}, + {"tso_requests", offsetof(struct sge_eth_tx_stats, tso)}, + {"checksum_offloads", offsetof(struct sge_eth_tx_stats, tx_cso)}, + {"vlan_insertions", offsetof(struct sge_eth_tx_stats, vlan_ins)}, + {"packet_mapping_errors", +offsetof(struct sge_eth_tx_stats, mapping_err)}, + {"coalesced_wrs", offsetof(struct sge_eth_tx_stats, coal_wr)}, + {"coalesced_packets", offsetof(struct sge_eth_tx_stats, coal_pkts)}, +}; + +static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = { + {"tx_bytes", offsetof(struct port_stats, tx_octets)}, + {"tx_packets", offsetof(struct port_stats, tx_frames)}, + {"tx_broadcast_packets", offsetof(struct port_stats, tx_bcast_frames)}, + {"tx_multicast_packets", offsetof(struct port_stats, tx_mcast_frames)}, + {"tx_unicast_packets", offsetof(struct port_stats, tx_ucast_frames)}, + {"tx_error_packets", offsetof(struct port_stats, tx_error_frames)}, + {"tx_size_64_packets", offsetof(struct port_stats, tx_frames_64)}, + {"tx_size_65_to_127_packets", +offsetof(struct port_stats, tx_frames_65_127)}, + {"tx_size_128_to_255_packets", +offsetof(struct port_stats, tx_frames_128_255)}, + {"tx_size_256_to_511_packets", +offsetof(struct port_stats, tx_frames_256_511)}, + {"tx_size_512_to_1023_packets", +offsetof(struct port_stats, tx_frames_512_1023)}, + {"tx_size_1024_to_1518_packets", +offsetof(struct port_stats, tx_frames_1024_1518)}, + {"tx_size_1519_to_max_packets", +offsetof(struct port_stats, tx_frames_1519_max)}, + {"tx_drop_packets", offsetof(struct port_stats, tx_drop)}, + {"tx_pause_frames", offsetof(struct port_stats, tx_pause)}, + {"tx_ppp_pri0_packets", offsetof(struct port_stats, tx_ppp0)}, + {"tx_ppp_pri1_packets", offsetof(struct port_stats, tx_ppp1)}, + {"tx_ppp_pri2_packets", offsetof(struct port_stats, tx_ppp2)}, + {"tx_ppp_pri3_packets", offsetof(struct port_stats, tx_ppp3)}, + {"tx_ppp_pri4_packets", offsetof(struct port_stats, tx_ppp4)}, + {"tx_ppp_pri5_packets", offsetof(struct port_stats, tx_ppp5)}, + {"tx_ppp_pri6_packets", offsetof(struct port_stats, tx_pp
[dpdk-dev] [PATCH v2 2/2] net/cxgbe: remove queue stats from basic stats
Remove queue stats from basic stats because they're now available via xstats API. Also remove RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS flag. Signed-off-by: Rahul Lakkireddy --- v2: - No change. drivers/net/cxgbe/cxgbe_ethdev.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 5bbf7f28af..57888fdc12 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -747,22 +747,12 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, eth_stats->oerrors = ps.tx_error_frames; for (i = 0; i < pi->n_rx_qsets; i++) { - struct sge_eth_rxq *rxq = - &s->ethrxq[pi->first_rxqset + i]; + struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_rxqset + i]; - eth_stats->q_ipackets[i] = rxq->stats.pkts; - eth_stats->q_ibytes[i] = rxq->stats.rx_bytes; - eth_stats->ipackets += eth_stats->q_ipackets[i]; - eth_stats->ibytes += eth_stats->q_ibytes[i]; + eth_stats->ipackets += rxq->stats.pkts; + eth_stats->ibytes += rxq->stats.rx_bytes; } - for (i = 0; i < pi->n_tx_qsets; i++) { - struct sge_eth_txq *txq = - &s->ethtxq[pi->first_txqset + i]; - - eth_stats->q_opackets[i] = txq->stats.pkts; - eth_stats->q_obytes[i] = txq->stats.tx_bytes; - } return 0; } @@ -1698,8 +1688,6 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) return 0; } - eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; - snprintf(name, sizeof(name), "cxgbeadapter%d", eth_dev->data->port_id); adapter = rte_zmalloc(name, sizeof(*adapter), 0); if (!adapter) -- 2.27.0
[PATCH] net/cxgbe: fix warnings when using optimization=1 flag
Initialize maddr and mtype to fix following warnings when using optimization=1 compilation flag. In file included from ../drivers/net/cxgbe/base/common.h:13, from ../drivers/net/cxgbe/cxgbe_main.c:37: ../drivers/net/cxgbe/cxgbe_main.c: In function ‘cxgbe_probe’: ../drivers/net/cxgbe/base/t4fw_interface.h:656:7: warning: ‘maddr’ may be used uninitialized in this function [-Wmaybe-uninitialized] ((x) << S_FW_CAPS_CONFIG_CMD_MEMADDR64K_CF) ^~ ../drivers/net/cxgbe/cxgbe_main.c::40: note: ‘maddr’ was declared here u32 finiver, finicsum, cfcsum, mtype, maddr, param, val; ^ In file included from ../drivers/net/cxgbe/base/common.h:13, from ../drivers/net/cxgbe/cxgbe_main.c:37: ../drivers/net/cxgbe/base/t4fw_interface.h:648:7: warning: ‘mtype’ may be used uninitialized in this function [-Wmaybe-uninitialized] ((x) << S_FW_CAPS_CONFIG_CMD_MEMTYPE_CF) ^~ ../drivers/net/cxgbe/cxgbe_main.c::33: note: ‘mtype’ was declared here u32 finiver, finicsum, cfcsum, mtype, maddr, param, val; ^ Bugzilla ID: 1029 Fixes: 6d7d651bbc15 ("net/cxgbe: read firmware configuration file from filesystem") Reported-by: Daxue Gao Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index 7b162af3e7..3c02c98b3d 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -1108,9 +1108,10 @@ static int cxgbe_load_fw_config_from_filesystem(struct adapter *adap, static int cxgbe_load_fw_config(struct adapter *adap) { - u32 finiver, finicsum, cfcsum, mtype, maddr, param, val; struct fw_caps_config_cmd caps_cmd = { 0 }; + u32 finiver, finicsum, cfcsum, param, val; const char *config_name = NULL; + u32 mtype = 0, maddr = 0; int ret; ret = cxgbe_load_fw_config_from_filesystem(adap, &config_name, -- 2.27.0
[PATCH] app/flow-perf: fix logic to add comma every three digits
Add comma after 1 in 1000 too, like 1,000. Also, since max uint64_t is a 20 digit number, increase space in temporary array to hold 20 digits. Fixes following warnings when using optimization=1 build flag with GCC 11. ../app/test-flow-perf/main.c: In function ‘pretty_number’: ../app/test-flow-perf/main.c:1737:28: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=] sprintf(p[i++], "%d", (int)n); ^ ../app/test-flow-perf/main.c:1737:9: note: ‘sprintf’ output between 2 and 5 bytes into a destination of size 4 sprintf(p[i++], "%d", (int)n); ^ Bugzilla ID: 1029 Fixes: 15c431864000 ("app/flow-perf: add packet forwarding support") Cc: sta...@dpdk.org Reported-by: Daxue Gao Signed-off-by: Rahul Lakkireddy --- app/test-flow-perf/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 56d43734e3..594507a85e 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -1724,11 +1724,11 @@ do_tx(struct lcore_info *li, uint16_t cnt, uint16_t tx_port, static char * pretty_number(uint64_t n, char *buf) { - char p[6][4]; + char p[7][4]; int i = 0; int off = 0; - while (n > 1000) { + while (n >= 1000) { sprintf(p[i], "%03d", (int)(n % 1000)); n /= 1000; i += 1; -- 2.27.0
[PATCH] test/crypto: fix warnings for optimization=1 build
Skip IPSec ESN and antireplay cases, if there are no packets. Fixes following warning when using optimization=1 build flag with GCC 11. ../app/test/test_cryptodev.c: In function ‘test_ipsec_pkt_replay’: ../app/test/test_cryptodev.c:10074:15: warning: ‘td_outb’ may be used uninitialized [-Wmaybe-uninitialized] ret = test_ipsec_proto_process(td_outb, td_inb, nb_pkts, true, ^~~~ &flags); ~~~ ../app/test/test_cryptodev.c:9150:1: note: by argument 1 of type ‘const struct ipsec_test_data[]’ to ‘test_ipsec_proto_process’ declared here test_ipsec_proto_process(const struct ipsec_test_data td[], ^~~~ ../app/test/test_cryptodev.c:10056:32: note: ‘td_outb’ declared here struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX]; ^~~ Fixes: d02c6bfcb99a ("test/crypto: add ESN and antireplay cases") Cc: sta...@dpdk.org Signed-off-by: Rahul Lakkireddy --- app/test/test_cryptodev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 524019ce0e..47ce3d8420 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -10058,6 +10058,9 @@ test_ipsec_pkt_replay(const void *test_data, const uint64_t esn[], struct ipsec_test_flags flags; uint32_t i = 0, ret = 0; + if (nb_pkts == 0) + return TEST_SKIPPED; + memset(&flags, 0, sizeof(flags)); flags.antireplay = true; -- 2.27.0
[PATCH v2] test/crypto: fix warnings for optimization=1 build
Fail IPSec ESN and antireplay cases, if there are no packets. Fixes following warning when using optimization=1 build flag with GCC 11. ../app/test/test_cryptodev.c: In function ‘test_ipsec_pkt_replay’: ../app/test/test_cryptodev.c:10074:15: warning: ‘td_outb’ may be used uninitialized [-Wmaybe-uninitialized] ret = test_ipsec_proto_process(td_outb, td_inb, nb_pkts, true, ^~~~ &flags); ~~~ ../app/test/test_cryptodev.c:9150:1: note: by argument 1 of type ‘const struct ipsec_test_data[]’ to ‘test_ipsec_proto_process’ declared here test_ipsec_proto_process(const struct ipsec_test_data td[], ^~~~ ../app/test/test_cryptodev.c:10056:32: note: ‘td_outb’ declared here struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX]; ^~~ Bugzilla ID: 1032 Fixes: d02c6bfcb99a ("test/crypto: add ESN and antireplay cases") Cc: sta...@dpdk.org Reported-by: Daxue Gao Signed-off-by: Rahul Lakkireddy --- v2: - Return TEST_FAILED, instead of TEST_SKIPPED - Add the new Bugzilla ID in commit message app/test/test_cryptodev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 524019ce0e..2766e0cc10 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -10058,6 +10058,9 @@ test_ipsec_pkt_replay(const void *test_data, const uint64_t esn[], struct ipsec_test_flags flags; uint32_t i = 0, ret = 0; + if (nb_pkts == 0) + return TEST_FAILED; + memset(&flags, 0, sizeof(flags)); flags.antireplay = true; -- 2.27.0
Re: [PATCH] app/flow-perf: fix logic to add comma every three digits
On Friday, June 06/10/22, 2022 at 16:45:22 -0700, Stephen Hemminger wrote: > On Sat, 11 Jun 2022 03:36:43 +0530 > Rahul Lakkireddy wrote: > > > Add comma after 1 in 1000 too, like 1,000. Also, since max uint64_t is > > a 20 digit number, increase space in temporary array to hold 20 digits. > > Fixes following warnings when using optimization=1 build flag with > > GCC 11. > > > > ../app/test-flow-perf/main.c: In function ‘pretty_number’: > > ../app/test-flow-perf/main.c:1737:28: warning: ‘sprintf’ may write a > > terminating nul past the end of the destination [-Wformat-overflow=] > > sprintf(p[i++], "%d", (int)n); > > ^ > > ../app/test-flow-perf/main.c:1737:9: note: ‘sprintf’ output between 2 and 5 > > bytes into a destination of size 4 > > sprintf(p[i++], "%d", (int)n); > > ^ > > > > Bugzilla ID: 1029 > > Fixes: 15c431864000 ("app/flow-perf: add packet forwarding support") > > Cc: sta...@dpdk.org > > > > Reported-by: Daxue Gao > > Signed-off-by: Rahul Lakkireddy > > There was a better alternative proposed here: > > https://patchwork.dpdk.org/project/dpdk/patch/20220518101657.1230416-12-david.march...@redhat.com/ Thanks Stephen. I missed this earlier patch from David. My patch can be dropped. Thanks, Rahul
[PATCH] net/cxgbe: rework mailbox access to fix gcc12 -Wdangling-pointer
Rework mailbox access serialization to dynamically allocate and free mbox entry. Also remove unnecessary temp memory and macros. Observed with: gcc-12.0 (GCC) 12.0.1 20220118 (experimental) In file included from ../lib/eal/linux/include/rte_os.h:14, from ../lib/eal/include/rte_common.h:28, from ../lib/eal/include/rte_log.h:25, from ../lib/ethdev/rte_ethdev.h:164, from ../lib/ethdev/ethdev_driver.h:18, from ../drivers/net/cxgbe/base/t4vf_hw.c:6: In function ‘t4_os_atomic_add_tail’, inlined from ‘t4vf_wr_mbox_core’ at ../drivers/net/cxgbe/base/t4vf_hw.c:115:2: ../drivers/net/cxgbe/base/adapter.h:742:9: warning: storing the address of local variable ‘entry’ in ‘((struct mbox_list *)adapter)[96].tqh_last’ [-Wdangling-pointer=] 742 | TAILQ_INSERT_TAIL(head, entry, next); | ^ ../drivers/net/cxgbe/base/t4vf_hw.c: In function ‘t4vf_wr_mbox_core’: ../drivers/net/cxgbe/base/t4vf_hw.c:86:27: note: ‘entry’ declared here 86 | struct mbox_entry entry; | ^ ../drivers/net/cxgbe/base/t4vf_hw.c:86:27: note: ‘adapter’ declared here Reported-by: Ferruh Yigit Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/adapter.h | 2 - drivers/net/cxgbe/base/t4_hw.c | 83 drivers/net/cxgbe/base/t4vf_hw.c | 28 +++ 3 files changed, 49 insertions(+), 64 deletions(-) diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 1c7c8afe16..97963422bf 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -291,8 +291,6 @@ struct sge { u32 fl_starve_thres;/* Free List starvation threshold */ }; -#define T4_OS_NEEDS_MBOX_LOCKING 1 - /* * OS Lock/List primitives for those interfaces in the Common Code which * need this. diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index cdcd7e5510..645833765a 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -263,17 +263,6 @@ static void fw_asrt(struct adapter *adap, u32 mbox_addr) #define X_CIM_PF_NOACCESS 0x -/* - * If the Host OS Driver needs locking arround accesses to the mailbox, this - * can be turned on via the T4_OS_NEEDS_MBOX_LOCKING CPP define ... - */ -/* makes single-statement usage a bit cleaner ... */ -#ifdef T4_OS_NEEDS_MBOX_LOCKING -#define T4_OS_MBOX_LOCKING(x) x -#else -#define T4_OS_MBOX_LOCKING(x) do {} while (0) -#endif - /** * t4_wr_mbox_meat_timeout - send a command to FW through the given mailbox * @adap: the adapter @@ -314,28 +303,17 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, 1, 1, 3, 5, 10, 10, 20, 50, 100 }; - u32 v; - u64 res; - int i, ms; - unsigned int delay_idx; - __be64 *temp = (__be64 *)malloc(size * sizeof(char)); - __be64 *p = temp; u32 data_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_DATA); u32 ctl_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_CTRL); - u32 ctl; - struct mbox_entry entry; - u32 pcie_fw = 0; - - if (!temp) - return -ENOMEM; + struct mbox_entry *entry; + u32 v, ctl, pcie_fw = 0; + unsigned int delay_idx; + const __be64 *p; + int i, ms, ret; + u64 res; - if ((size & 15) || size > MBOX_LEN) { - free(temp); + if ((size & 15) != 0 || size > MBOX_LEN) return -EINVAL; - } - - memset(p, 0, size); - memcpy(p, (const __be64 *)cmd, size); /* * If we have a negative timeout, that implies that we can't sleep. @@ -345,14 +323,17 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, timeout = -timeout; } -#ifdef T4_OS_NEEDS_MBOX_LOCKING + entry = t4_os_alloc(sizeof(*entry)); + if (entry == NULL) + return -ENOMEM; + /* * Queue ourselves onto the mailbox access list. When our entry is at * the front of the list, we have rights to access the mailbox. So we * wait [for a while] till we're at the front [or bail out with an * EBUSY] ... */ - t4_os_atomic_add_tail(&entry, &adap->mbox_list, &adap->mbox_lock); + t4_os_atomic_add_tail(entry, &adap->mbox_list, &adap->mbox_lock); delay_idx = 0; ms = delay[0]; @@ -367,18 +348,18 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, */ pcie_fw = t4_read_reg(adap, A_PCIE_FW); if (i > 4 * timeout || (pcie_fw & F_PCIE_FW_ERR)) { - t4_os_atomic_list_del(&entry, &adap->mbox_list, + t4_os_atomic_list_del(entry, &adap->mbox_list,
Re: [PATCH] net/cxgbe: fix dangling pointer for gcc12
Hi Ferruh, On Monday, January 01/17/22, 2022 at 14:36:30 +, Ferruh Yigit wrote: > Observed with: gcc (GCC) 12.0.0 20220116 (experimental) > > In file included from ../lib/eal/linux/include/rte_os.h:14, > from ../lib/eal/include/rte_common.h:28, > from ../lib/eal/include/rte_log.h:25, > from ../lib/ethdev/rte_ethdev.h:164, > from ../lib/ethdev/ethdev_driver.h:18, > from ../drivers/net/cxgbe/base/t4vf_hw.c:6: > In function ‘t4_os_atomic_add_tail’, > inlined from ‘t4vf_wr_mbox_core’ at > ../drivers/net/cxgbe/base/t4vf_hw.c:115:2: > ../drivers/net/cxgbe/base/adapter.h:742:9: error: storing the address of > local variable ‘entry’ in ‘((struct mbox_list *)adapter)[96].tqh_last’ > [-Werror=dangling-pointer=] > 742 | TAILQ_INSERT_TAIL(head, entry, next); > | ^ > ../drivers/net/cxgbe/base/t4vf_hw.c: In function ‘t4vf_wr_mbox_core’: > ../drivers/net/cxgbe/base/t4vf_hw.c:86:27: note: ‘entry’ declared here >86 | struct mbox_entry entry; > | ^ > ../drivers/net/cxgbe/base/t4vf_hw.c:86:27: note: ‘adapter’ declared here > > It is a valid compiler warning, make local variable a global one. > > Signed-off-by: Ferruh Yigit > > --- > > Fix is done in a quickest way, mainly to report the issue, > please feel free to suggest another solution for the build error. > --- Thanks for reporting this issue. The intention of this code is to use the address of the local variable stored on stack to serialize access from multiple threads. This address is used only within the scope of this function and is not accessed from outside. I'm also stumped on why this warning is not showing up inside t4_wr_mbox_meat_timeout() in t4_hw.c, which also has similar code. Nevertheless, I've sent a patch at [1] to dynamically allocate/free the memory instead and fix the warning. [1] https://mails.dpdk.org/archives/dev/2022-January/232816.html Thanks, Rahul > drivers/net/cxgbe/base/t4vf_hw.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/cxgbe/base/t4vf_hw.c > b/drivers/net/cxgbe/base/t4vf_hw.c > index 561d759dbc0d..b42c4e78eba9 100644 > --- a/drivers/net/cxgbe/base/t4vf_hw.c > +++ b/drivers/net/cxgbe/base/t4vf_hw.c > @@ -83,7 +83,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, > > u32 mbox_ctl = T4VF_CIM_BASE_ADDR + A_CIM_VF_EXT_MAILBOX_CTRL; > __be64 cmd_rpl[MBOX_LEN / 8]; > - struct mbox_entry entry; > + static struct mbox_entry entry; > unsigned int delay_idx; > u32 v, mbox_data; > const __be64 *p; > -- > 2.34.1 >
Re: [PATCH 4/5] net/cxgbe: track packets dropped by TP due to congestion
On Thursday, May 05/05/22, 2022 at 17:28:55 +0100, Ferruh Yigit wrote: > On 4/18/2022 11:24 PM, Rahul Lakkireddy wrote: > > Rx packets can get dropped at TP due to congestion and this info > > will not get propagated to MPS. Track these Rx dropped packets > > in imissed counter. Also add xstats for these counters. > > > > Signed-off-by: Rahul Lakkireddy > > What 'TP' stands for? As far as I understand it is a kind of FW (TP > Microcode) but I didn't able to find any reference to it. Transport Processor (TP) on the NIC delivers the incoming packets from the wire to NIC's DMA engine to place the packets in Rx buffers. TP sends signal towards the Multi-Port Switch (MPS) near the MAC when the Rxqs run out of Rx buffers posted by driver. These MPS buffer drop stats are already accounted for in imissed counters. However, if a large number of Rxqs run out of Rx buffers simultaneously, then the TP can start dropping packets by itself without informing to the MPS if there is heavy congestion on the channel. These packets dropped by TP that could not be informed to MPS are now being accounted for in imissed counters in this patch. Thanks, Rahul
Re: [PATCH 5/5] net/cxgbe: read firmware configuration file from filesystem
On Thursday, May 05/05/22, 2022 at 17:36:06 +0100, Ferruh Yigit wrote: > On 5/5/2022 5:29 PM, Ferruh Yigit wrote: > > On 4/18/2022 11:24 PM, Rahul Lakkireddy wrote: > > > Add support to read firmware configuration file from > > > /lib/firmware/cxgb4/ path in the filesystem. > > > > > > > Hi Rahul, > > > > Can you please document the FW config file in the driver documentation? > > Please add: > > - Path of the config file > > - Content of the config file. As far as I can see from the code the > > config file directly sent to the FW, does this mean config file is > > binary? > > - What happens when config file is not found > > > > Also are these values overlap with the devargs that PMD has? If so what > > happens in that case, which one is used, devargs one or config file one? > > > > Previously there was 'cxgbtool' tool to send the config file, is this > > method replacing it? Why not keep using 'cxgbtool'? > > The Chelsio FW config file contains a list of register=value pairs to change configuration of the NIC before firmware is initialized. It closely resembles the INI file format. It is mainly used to aid in debugging FW initialization failures and to optimally partition NIC hardware resources for specific requirements. Partitioning generally involves moving resources on unused Physical Functions (PFs) to the main PF, like redistributing queues, hardware TCAMs, etc., before firmware begins initialization. Once the configuration looks good, then the final FW config file is flashed onto the NIC using the cxgbtool. The FW config file can then be removed from the /lib/firmware/cxgb4/ directory and the FW will begin initializing with the flashed FW config file on the NIC from next time onwards. With this patch, the FW config file is selected in following order. 1) Check and select FW config file present in /lib/firmware/cxgb4/ directory. 2) Otherwise, check and select FW config file flashed onto the NIC. 3) Otherwise, select the default FW config file embedded within the FW binary on the NIC. Since this is pretty low-level hardware configuration, the users are not expected to change this file without expert guidance. So, exporting such a low-level configuration via devargs API does not feel like the right fit for this specific requirement. Once FW is up and running with the FW config file, some of the driver and FW runtime features can be enabled/disabled via devargs API during driver probe. To summarize, the FW config file is intended to debug FW initialization failures and/or aid in resources partitioning before FW starts initialization. Once the FW is running, the whole or smaller slices of these partitioned resources can be further redistributed across the multiple physical ports controlled by the same underlying PF. > > cc'ed more folks. > > This patch introduces a userspace config file for runtime FW config. > > What do you think about this approach? > Should we formalize this method more, like introducing an ethdev level > config option to hold the config file, which can be used for driver and/or > FW. And perhaps with a defined syntax (yaml?). > Can this be an alternative to PMD devargs? > > Cheers, > ferruh Thanks, Rahul
[PATCH v2] net/cxgbe: track packets dropped by TP due to congestion
Transport Processor (TP) on the NIC delivers the incoming packets from the wire to NIC's DMA engine to place the packets in Rx buffers. TP sends signal towards the Multi-Port Switch (MPS) near the MAC when the Rxqs run out of Rx buffers posted by driver. These MPS buffer drop stats are already accounted for in imissed counters. However, if a large number of Rxqs run out of Rx buffers simultaneously, then the TP can start dropping packets by itself when there is heavy congestion on the channel and hence could not inform to the MPS. So, track these packets dropped by TP in imissed counters. Also add xstats for these counters. Signed-off-by: Rahul Lakkireddy --- v2: - Update commit message with more info about the TP counters. drivers/net/cxgbe/base/common.h | 2 ++ drivers/net/cxgbe/base/t4_hw.c | 14 -- drivers/net/cxgbe/base/t4_regs.h | 4 drivers/net/cxgbe/cxgbe_ethdev.c | 11 +++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 980d78e4a4..4482ddbf56 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -101,6 +101,8 @@ struct port_stats { u64 rx_trunc1;/* buffer-group 1 truncated packets */ u64 rx_trunc2;/* buffer-group 2 truncated packets */ u64 rx_trunc3;/* buffer-group 3 truncated packets */ + + u64 rx_tp_tnl_cong_drops[NCHAN]; /* TP frame drops due to congestion */ }; struct sge_params { diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 84c4316e68..384080e6d3 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -3040,8 +3040,10 @@ unsigned int t4_get_tp_ch_map(struct adapter *adapter, unsigned int pidx) */ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { - u32 bgmap = t4_get_mps_bg_map(adap, idx); u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); + u32 bgmap = t4_get_mps_bg_map(adap, idx); + u32 val[NCHAN] = { 0 }; + u8 i; #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -3129,6 +3131,11 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) p->rx_trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_MAC_TRUNC_FRAME) : 0; p->rx_trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_MAC_TRUNC_FRAME) : 0; + t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &val[idx], 1, +A_TP_MIB_TNL_CNG_DROP_0 + idx); + + for (i = 0; i < NCHAN; i++) + p->rx_tp_tnl_cong_drops[i] = val[i]; #undef GET_STAT #undef GET_STAT_COM } @@ -3163,9 +3170,10 @@ void t4_get_port_stats_offset(struct adapter *adap, int idx, */ void t4_clr_port_stats(struct adapter *adap, int idx) { - unsigned int i; u32 bgmap = t4_get_mps_bg_map(adap, idx); u32 port_base_addr; + unsigned int i; + u32 val = 0; if (is_t4(adap->params.chip)) port_base_addr = PORT_BASE(idx); @@ -3187,6 +3195,8 @@ void t4_clr_port_stats(struct adapter *adap, int idx) A_MPS_STAT_RX_BG_0_MAC_TRUNC_FRAME_L + i * 8, 0); } + t4_write_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, + &val, 1, A_TP_MIB_TNL_CNG_DROP_0 + idx); } /** diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h index 8a14d09a15..ff60dc1bb3 100644 --- a/drivers/net/cxgbe/base/t4_regs.h +++ b/drivers/net/cxgbe/base/t4_regs.h @@ -525,6 +525,8 @@ #define A_TP_PIO_ADDR 0x7e40 #define A_TP_PIO_DATA 0x7e44 +#define A_TP_MIB_INDEX 0x7e50 +#define A_TP_MIB_DATA 0x7e54 #define A_TP_RSS_SECRET_KEY0 0x40 @@ -587,6 +589,8 @@ #define S_RM_OVLAN 9 #define V_RM_OVLAN(x) ((x) << S_RM_OVLAN) +#define A_TP_MIB_TNL_CNG_DROP_0 0x18 + /* registers for module MA */ #define A_MA_EDRAM0_BAR 0x77c0 diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index e7ea76180f..cf9a2fdc19 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -709,6 +709,9 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, ps.rx_ovflow2 + ps.rx_ovflow3 + ps.rx_trunc0 + ps.rx_trunc1 + ps.rx_trunc2 + ps.rx_trunc3; + for (i = 0; i < NCHAN; i++) + eth_stats->imissed += ps.rx_tp_tnl_cong_drops[i]; + eth_stats->ierrors = ps.rx_symbol_err + ps.rx_fcs_err + ps.rx_jabber + ps.rx_too_long + ps.rx_runt + ps.rx_len_err; @@ -851,6 +854,14 @@ static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = { {"rx_bg1_truncated_packets", offsetof(struct port_stats, rx_t
Re: [PATCH 5/5] net/cxgbe: read firmware configuration file from filesystem
On Tuesday, May 05/10/22, 2022 at 11:02:05 +0200, Thomas Monjalon wrote: > 06/05/2022 13:36, Rahul Lakkireddy: > > The Chelsio FW config file contains a list of register=value pairs to > > change configuration of the NIC before firmware is initialized. > > It closely resembles the INI file format. It is mainly used to aid > > in debugging FW initialization failures and to optimally partition > > NIC hardware resources for specific requirements. Partitioning > > generally involves moving resources on unused Physical Functions > > (PFs) to the main PF, like redistributing queues, hardware TCAMs, > > etc., before firmware begins initialization. Once the configuration > > looks good, then the final FW config file is flashed onto the NIC > > using the cxgbtool. The FW config file can then be removed from the > > /lib/firmware/cxgb4/ directory and the FW will begin initializing > > with the flashed FW config file on the NIC from next time onwards. > > > > With this patch, the FW config file is selected in following order. > > > > 1) Check and select FW config file present in /lib/firmware/cxgb4/ > >directory. > > > > 2) Otherwise, check and select FW config file flashed onto the > >NIC. > > > > 3) Otherwise, select the default FW config file embedded within the > >FW binary on the NIC. > > > > Since this is pretty low-level hardware configuration, the users are > > not expected to change this file without expert guidance. So, > > exporting such a low-level configuration via devargs API does not > > feel like the right fit for this specific requirement. > > > > Once FW is up and running with the FW config file, some of the driver > > and FW runtime features can be enabled/disabled via devargs API during > > driver probe. > > > > To summarize, the FW config file is intended to debug FW initialization > > failures and/or aid in resources partitioning before FW starts > > initialization. Once the FW is running, the whole or smaller slices > > of these partitioned resources can be further redistributed across > > the multiple physical ports controlled by the same underlying PF. > > Sorry it is not clear to me. > The FW file is used by cxgbtool to flash it, right? > The PMD may use the same FW file for debug diagnostics? There are 2 FW related files in /lib/firmware/cxgb4 directory that can be written into the NIC flash (at different locations in the flash) using cxgbtool: 1) FW config file (t6-config.txt): This file contains register=value pairs to configure some HW registers before initializing FW (t6fw.bin). These register=value pairs are very low level and specific to HW. The FW config file can be used to enable/disable some paths in HW to debug FW initialization issues. Since it can disable some paths in HW, it can also be used to partition and redistribute resources from other unused PFs to main PF, before FW initialization. 2) FW binary (t6fw.bin): This contains the actual FW. This binary also has an embedded "default" FW config file that will be used if no FW config file (t6-config.txt) is present in NIC "flash" or in the "/lib/firmware/cxgb4/" directory. > How is it used by the kernel? > In kernel cxgb4 driver also, we follow the same sequence when initializing FW. If any FW config file (t6-config.txt) is present in "/lib/firmware/cxgb4" directory, then it is picked up first. Otherwise, a FW config file that has been "flashed" onto the NIC using cxgbtool, is picked up next. Otherwise, FW will init with the "default" FW config file embedded inside the FW binary (t6fw.bin). Currently, the DPDK cxgbe PMD only picks up the FW config file from NIC "flash" or the "default" one inside the FW binary. This patch adds a way to pick FW config file from "lib/firmware/cxgb4" directory when a FW config file is placed there. Thanks, Rahul
Re: [PATCH 5/5] net/cxgbe: read firmware configuration file from filesystem
On Tuesday, May 05/10/22, 2022 at 16:30:59 +0200, Thomas Monjalon wrote: > 10/05/2022 16:11, Rahul Lakkireddy: > > On Tuesday, May 05/10/22, 2022 at 11:02:05 +0200, Thomas Monjalon wrote: > > > 06/05/2022 13:36, Rahul Lakkireddy: > > > > The Chelsio FW config file contains a list of register=value pairs to > > > > change configuration of the NIC before firmware is initialized. > > > > It closely resembles the INI file format. It is mainly used to aid > > > > in debugging FW initialization failures and to optimally partition > > > > NIC hardware resources for specific requirements. Partitioning > > > > generally involves moving resources on unused Physical Functions > > > > (PFs) to the main PF, like redistributing queues, hardware TCAMs, > > > > etc., before firmware begins initialization. Once the configuration > > > > looks good, then the final FW config file is flashed onto the NIC > > > > using the cxgbtool. The FW config file can then be removed from the > > > > /lib/firmware/cxgb4/ directory and the FW will begin initializing > > > > with the flashed FW config file on the NIC from next time onwards. > > > > > > > > With this patch, the FW config file is selected in following order. > > > > > > > > 1) Check and select FW config file present in /lib/firmware/cxgb4/ > > > >directory. > > > > > > > > 2) Otherwise, check and select FW config file flashed onto the > > > >NIC. > > > > > > > > 3) Otherwise, select the default FW config file embedded within the > > > >FW binary on the NIC. > > > > > > > > Since this is pretty low-level hardware configuration, the users are > > > > not expected to change this file without expert guidance. So, > > > > exporting such a low-level configuration via devargs API does not > > > > feel like the right fit for this specific requirement. > > > > > > > > Once FW is up and running with the FW config file, some of the driver > > > > and FW runtime features can be enabled/disabled via devargs API during > > > > driver probe. > > > > > > > > To summarize, the FW config file is intended to debug FW initialization > > > > failures and/or aid in resources partitioning before FW starts > > > > initialization. Once the FW is running, the whole or smaller slices > > > > of these partitioned resources can be further redistributed across > > > > the multiple physical ports controlled by the same underlying PF. > > > > > > Sorry it is not clear to me. > > > The FW file is used by cxgbtool to flash it, right? > > > The PMD may use the same FW file for debug diagnostics? > > > > > > There are 2 FW related files in /lib/firmware/cxgb4 directory that > > can be written into the NIC flash (at different locations in the flash) > > using cxgbtool: > > > > 1) FW config file (t6-config.txt): This file contains register=value > >pairs to configure some HW registers before initializing FW > >(t6fw.bin). These register=value pairs are very low level and > >specific to HW. The FW config file can be used to enable/disable > >some paths in HW to debug FW initialization issues. Since it > >can disable some paths in HW, it can also be used to partition > >and redistribute resources from other unused PFs to main PF, > >before FW initialization. > > > > 2) FW binary (t6fw.bin): This contains the actual FW. This binary also > >has an embedded "default" FW config file that will be used if no > >FW config file (t6-config.txt) is present in NIC "flash" or in the > >"/lib/firmware/cxgb4/" directory. > > > > > How is it used by the kernel? > > > > > > > In kernel cxgb4 driver also, we follow the same sequence when > > initializing FW. If any FW config file (t6-config.txt) is present > > in "/lib/firmware/cxgb4" directory, then it is picked up first. > > Otherwise, a FW config file that has been "flashed" onto the NIC > > using cxgbtool, is picked up next. Otherwise, FW will init with > > the "default" FW config file embedded inside the FW binary (t6fw.bin). > > > > Currently, the DPDK cxgbe PMD only picks up the FW config file from > > NIC "flash" or the "default" one inside the FW binary. This patch adds > > a way to pick FW config file from "lib/firmware/cxgb4" directory when > > a FW config file is placed there. > > OK, so both Linux and DPDK drivers read the FW config file > to provide better diagnostics. Am I right? > Yes, both use the FW config file to enable/disable specific paths in HW to get better diagnostics for FW init failures. Thanks, Rahul
[PATCH v2] net/cxgbe: read firmware configuration file from filesystem
Add support to read firmware configuration file from /lib/firmware/cxgb4/ path in the filesystem. The firmware config file is used to enable or disable NIC features before firmware initialization to help retrieve better debug data to analyze firmware init failures. The config file can also be used to redistribute resources, like queues, TCAMs, etc., from disabled physical functions (PFs) to main PF, before firmware init. Signed-off-by: Rahul Lakkireddy --- v2: - Update cxgbe pmd doc about the firmware config file - Update commit message to explain more about firmware config file doc/guides/nics/cxgbe.rst | 28 ++ drivers/net/cxgbe/base/t4fw_interface.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 329 3 files changed, 245 insertions(+), 113 deletions(-) diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst index a1d30c488b..fc8a5751f1 100644 --- a/doc/guides/nics/cxgbe.rst +++ b/doc/guides/nics/cxgbe.rst @@ -838,3 +838,31 @@ to configure the mtu of all the ports with a single command. testpmd> port stop all testpmd> port config all max-pkt-len 9000 + +Hardware Configuration and Debugging + + +Firmware Configuration File +~~~ + +To enable or disable Chelsio NIC features before firmware initialization, +the Chelsio firmware configuration file can be placed in following +directory. The CXGBE PMD will search and pick up the firmware +configuration file during the Chelsio NIC probe, before initializing +the firmware. + +.. code-block:: console + + cp /t6-config.txt /lib/firmware/cxgb4/t6-config.txt + +The firmware configuration file is mainly intended to be used to debug +firmware initialization failures. It can also be used to redistribute +NIC resources from disabled physical functions (PFs) to main PF before +initializing firmware. + +.. warning:: + + Note that the Chelsio firmware configuration file contains very low + level details that is specific to the Chelsio NIC. Hence, the + firmware configuration file must not be modified without expert + guidance from Chelsio support team. diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h index a0a9292c0c..76f58d7c77 100644 --- a/drivers/net/cxgbe/base/t4fw_interface.h +++ b/drivers/net/cxgbe/base/t4fw_interface.h @@ -697,6 +697,7 @@ enum fw_params_param_dev { */ FW_PARAMS_PARAM_DEV_FWREV = 0x0B, /* fw version */ FW_PARAMS_PARAM_DEV_TPREV = 0x0C, /* tp version */ + FW_PARAMS_PARAM_DEV_CF = 0x0D, FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL = 0x17, FW_PARAMS_PARAM_DEV_FILTER2_WR = 0x1D, FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27, diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index e2a2ccb781..7b162af3e7 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -11,6 +12,7 @@ #include #include #include +#include #include #include @@ -1006,6 +1008,218 @@ static int configure_filter_mode_mask(struct adapter *adap) params, val); } +#define CXGBE_FW_CONFIG_PATH_T5 "/lib/firmware/cxgb4/t5-config.txt" +#define CXGBE_FW_CONFIG_PATH_T6 "/lib/firmware/cxgb4/t6-config.txt" + +/* + * Load firmware configuration from file in /lib/firmware/cxgb4/ path, + * if it is present. + */ +static int cxgbe_load_fw_config_from_filesystem(struct adapter *adap, + const char **config_name, + u32 *mem_type, u32 *mem_addr) +{ + u32 param, val, mtype, maddr; + const char *fw_cfg_path; + char *fw_cfg = NULL; + struct stat st; + int ret, fd; + + switch (CHELSIO_CHIP_VERSION(adap->params.chip)) { + case CHELSIO_T5: + fw_cfg_path = CXGBE_FW_CONFIG_PATH_T5; + break; + case CHELSIO_T6: + fw_cfg_path = CXGBE_FW_CONFIG_PATH_T6; + break; + default: + return -ENOENT; + } + + ret = open(fw_cfg_path, O_RDONLY); + if (ret < 0) { + dev_debug(adap, "Couldn't open FW config file\n"); + return ret; + } + + fd = ret; + + ret = fstat(fd, &st); + if (ret < 0) { + dev_debug(adap, "Couldn't get FW config file size\n"); + goto out_err; + } + + if (st.st_size >= FLASH_CFG_MAX_SIZE) { + dev_debug(adap, "FW config file size >= max(%u)\n", + FLASH_CFG_MAX_SIZE); + ret = -ENOMEM; + goto out_err; + } + + fw_cfg = rte_zmalloc(NULL, st.st_size, 0); +
Re: [PATCH v2] net/cxgbe: read firmware configuration file from filesystem
On Monday, May 05/16/22, 2022 at 12:06:01 +0100, Ferruh Yigit wrote: > On 5/16/2022 11:27 AM, Rahul Lakkireddy wrote: > > Add support to read firmware configuration file from > > /lib/firmware/cxgb4/ path in the filesystem. The firmware > > config file is used to enable or disable NIC features before > > firmware initialization to help retrieve better debug data to > > analyze firmware init failures. The config file can also > > be used to redistribute resources, like queues, TCAMs, etc., > > from disabled physical functions (PFs) to main PF, before > > firmware init. > > Hi Rahul, > > Please find comments below. > > Also can you please send a new version for both 4/5 and 5/5 (this patch) > from original series? > I had already posted v2 for 4/5 from original series at below location. https://patches.dpdk.org/project/dpdk/patch/61ae717665c2f4e38712652bec2f9d0fe5ca7d32.1651842841.git.rahul.lakkire...@chelsio.com/ Do you want me to send a new patch series with 4/5 and 5/5 in a single patch series? > > > > Signed-off-by: Rahul Lakkireddy > > --- > > v2: > > - Update cxgbe pmd doc about the firmware config file > > - Update commit message to explain more about firmware config file > > > > doc/guides/nics/cxgbe.rst | 28 ++ > > drivers/net/cxgbe/base/t4fw_interface.h | 1 + > > drivers/net/cxgbe/cxgbe_main.c | 329 > > 3 files changed, 245 insertions(+), 113 deletions(-) > > > > diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst > > index a1d30c488b..fc8a5751f1 100644 > > --- a/doc/guides/nics/cxgbe.rst > > +++ b/doc/guides/nics/cxgbe.rst > > @@ -838,3 +838,31 @@ to configure the mtu of all the ports with a single > > command. > >testpmd> port stop all > >testpmd> port config all max-pkt-len 9000 > > + > > +Hardware Configuration and Debugging > > + > > + > > +Firmware Configuration File > > +~~~ > > + > > +To enable or disable Chelsio NIC features before firmware initialization, > > +the Chelsio firmware configuration file can be placed in following > > +directory. The CXGBE PMD will search and pick up the firmware > > +configuration file during the Chelsio NIC probe, before initializing > > +the firmware. > > + > > Does it worth to mention what happens if the FW config file doesn't exist? > Or mention from FW config file load order, as you described in mail list, to > understand the relation with 'cxgbtool'? > Will do. > > +.. code-block:: console > > + > > + cp /t6-config.txt /lib/firmware/cxgb4/t6-config.txt > > + > > There is also 't5-config.txt' in the code. > Yes, t5-config.txt is for Chelsio T5 NIC series and t6-config.txt is for Chelsio T6 NIC series. Will update t5-config.txt as well. > > +The firmware configuration file is mainly intended to be used to debug > > +firmware initialization failures. It can also be used to redistribute > > +NIC resources from disabled physical functions (PFs) to main PF before > > +initializing firmware. > > + > > +.. warning:: > > + > > + Note that the Chelsio firmware configuration file contains very low > > + level details that is specific to the Chelsio NIC. Hence, the > > + firmware configuration file must not be modified without expert > > + guidance from Chelsio support team. > > Will it be too much detail to document what config can be changed via this > FW config? > Yes, this will be difficult to document. The config file just looks like register=value pairs and are often dependent on each other based on the selected configuration. A portion of sample config file is given below. I'm not sure how to document this kind of info. [global] reg[0x100c] = 0x reg[0x10a0] = 0x01040810 reg[0x1044] = 4096 reg[0x1048] = 65536 reg[0x104c] = 1536 reg[0x1050] = 9024 reg[0x1054] = 9216 reg[0x1058] = 2048 reg[0x105c] = 128 reg[0x1060] = 8192 reg[0x1064] = 16384 [...] Thanks, Rahul
[PATCH v3] net/cxgbe: read firmware configuration file from filesystem
Add support to read firmware configuration file from /lib/firmware/cxgb4/ path in the filesystem. The firmware config file is used to enable or disable NIC features before firmware initialization to help retrieve better debug data to analyze firmware init failures. The config file can also be used to redistribute resources, like queues, TCAMs, etc., from disabled physical functions (PFs) to main PF, before firmware init. Signed-off-by: Rahul Lakkireddy --- v3: - Update cxgbe pmd doc about copying t5-config.txt to /lib/firmware/cxgb4/ directory. - Update cxgbe pmd doc about firmware config file search and selection order. v2: - Update cxgbe pmd doc about the firmware config file - Update commit message to explain more about firmware config file doc/guides/nics/cxgbe.rst | 48 drivers/net/cxgbe/base/t4fw_interface.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 329 3 files changed, 265 insertions(+), 113 deletions(-) diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst index a1d30c488b..6d20384b70 100644 --- a/doc/guides/nics/cxgbe.rst +++ b/doc/guides/nics/cxgbe.rst @@ -838,3 +838,51 @@ to configure the mtu of all the ports with a single command. testpmd> port stop all testpmd> port config all max-pkt-len 9000 + +Hardware Configuration and Debugging + + +Firmware Configuration File +~~~ + +To enable or disable Chelsio NIC features before firmware initialization, +the Chelsio firmware configuration file can be placed in following +directory. + +.. code-block:: console + + # For Chelsio T5 NIC series + cp /t5-config.txt /lib/firmware/cxgb4/t5-config.txt + + # For Chelsio T6 NIC series + cp /t6-config.txt /lib/firmware/cxgb4/t6-config.txt + +The firmware configuration file is mainly intended to be used to debug +firmware initialization failures. It can also be used to redistribute +NIC resources from disabled physical functions (PFs) to main PF before +initializing firmware. + +The CXGBE PMD will search and pick up the firmware configuration file +during the Chelsio NIC probe, in following order. + +#. If the firmware configuration file is present in /lib/firmware/cxgb4/ + directory, then this file is downloaded to temporary location in + NIC's on-chip RAM. When firmware is initializing, it picks up the + file from the temporary on-chip RAM location. + +#. Otherwise, if the firmware configuration file has been written + onto the NIC persistent flash area using cxgbtool, then this + file is picked up from the persistent flash area during + firmware initialization. + +#. If no firmware configuration file is found at /lib/firmware/cxgb4/ + directory or on the NIC persistent flash area, then the firmware + will initialize with the default configuration file embedded inside + the firmware binary. + +.. warning:: + + Note that the Chelsio firmware configuration file contains very low + level details that is specific to the Chelsio NIC. Hence, the + firmware configuration file must not be modified without expert + guidance from Chelsio support team. diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h index a0a9292c0c..76f58d7c77 100644 --- a/drivers/net/cxgbe/base/t4fw_interface.h +++ b/drivers/net/cxgbe/base/t4fw_interface.h @@ -697,6 +697,7 @@ enum fw_params_param_dev { */ FW_PARAMS_PARAM_DEV_FWREV = 0x0B, /* fw version */ FW_PARAMS_PARAM_DEV_TPREV = 0x0C, /* tp version */ + FW_PARAMS_PARAM_DEV_CF = 0x0D, FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL = 0x17, FW_PARAMS_PARAM_DEV_FILTER2_WR = 0x1D, FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27, diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index e2a2ccb781..7b162af3e7 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -11,6 +12,7 @@ #include #include #include +#include #include #include @@ -1006,6 +1008,218 @@ static int configure_filter_mode_mask(struct adapter *adap) params, val); } +#define CXGBE_FW_CONFIG_PATH_T5 "/lib/firmware/cxgb4/t5-config.txt" +#define CXGBE_FW_CONFIG_PATH_T6 "/lib/firmware/cxgb4/t6-config.txt" + +/* + * Load firmware configuration from file in /lib/firmware/cxgb4/ path, + * if it is present. + */ +static int cxgbe_load_fw_config_from_filesystem(struct adapter *adap, + const char **config_name, + u32 *mem_type, u32 *mem_addr) +{ + u32 param, val, mtype, maddr; + const char *fw_cfg_path; + char *fw_cfg = NULL; + struct stat st; + int ret, fd; + + switch (CHELSIO
[dpdk-dev] [PATCH] net/cxgbe: avoid sending link params change from VF
From: Nikhil Vasoya VFs are not allowed to change physical link params when a port module change is detected. The firmware already returns appropriate permission error when VF tries to change physical link params. But, make sure to avoid sending the command to firmware from VF in the first place and prevent flooding firmware debug logs with permission errors. Fixes: a83041b1e998 ("net/cxgbe: rework and simplify link handling") Cc: sta...@dpdk.org Signed-off-by: Nikhil Vasoya Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/t4_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index b60bcdc3bc..cdcd7e5510 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -4597,7 +4597,7 @@ static void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl) t4_os_link_changed(adapter, pi->pidx); } - if (mod_changed) { + if (mod_changed != 0 && is_pf4(adapter) != 0) { u32 mod_caps = lc->admin_caps; int ret; -- 2.27.0
[dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version
This series of patches add following features. Patch 1 adds support to fetch port and queue stats via xstats API for VF. Patch 2 adds support to get firmware version. Thanks, Rahul Nikhil Vasoya (2): net/cxgbe: add support for xstats API for the VF net/cxgbe: add support to get firmware version drivers/net/cxgbe/cxgbe_ethdev.c | 94 -- drivers/net/cxgbe/cxgbe_pfvf.h | 13 + drivers/net/cxgbe/cxgbevf_ethdev.c | 21 +++ 3 files changed, 96 insertions(+), 32 deletions(-) -- 2.27.0
[dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF
From: Nikhil Vasoya Add support to fetch port and queue stats via xstats API. Also remove queue stats from basic stats because they're now available via xstats API for the VF. Signed-off-by: Nikhil Vasoya Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_ethdev.c | 68 +- drivers/net/cxgbe/cxgbe_pfvf.h | 11 + drivers/net/cxgbe/cxgbevf_ethdev.c | 20 +++-- 3 files changed, 67 insertions(+), 32 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 177eca3976..a6b5c0110a 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -881,15 +881,37 @@ static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = { {"rx_bg3_truncated_packets", offsetof(struct port_stats, rx_trunc3)}, }; +static const struct cxgbe_dev_xstats_name_off +cxgbevf_dev_port_stats_strings[] = { + {"tx_bytes", offsetof(struct port_stats, tx_octets)}, + {"tx_broadcast_packets", offsetof(struct port_stats, tx_bcast_frames)}, + {"tx_multicast_packets", offsetof(struct port_stats, tx_mcast_frames)}, + {"tx_unicast_packets", offsetof(struct port_stats, tx_ucast_frames)}, + {"tx_drop_packets", offsetof(struct port_stats, tx_drop)}, + {"rx_broadcast_packets", offsetof(struct port_stats, rx_bcast_frames)}, + {"rx_multicast_packets", offsetof(struct port_stats, rx_mcast_frames)}, + {"rx_unicast_packets", offsetof(struct port_stats, rx_ucast_frames)}, + {"rx_length_error_packets", offsetof(struct port_stats, rx_len_err)}, +}; + #define CXGBE_NB_RXQ_STATS RTE_DIM(cxgbe_dev_rxq_stats_strings) #define CXGBE_NB_TXQ_STATS RTE_DIM(cxgbe_dev_txq_stats_strings) #define CXGBE_NB_PORT_STATS RTE_DIM(cxgbe_dev_port_stats_strings) +#define CXGBEVF_NB_PORT_STATS RTE_DIM(cxgbevf_dev_port_stats_strings) static u16 cxgbe_dev_xstats_count(struct port_info *pi) { - return CXGBE_NB_PORT_STATS + - (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) + - (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS); + u16 count; + + count = (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) + + (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS); + + if (is_pf4(pi->adapter) != 0) + count += CXGBE_NB_PORT_STATS; + else + count += CXGBEVF_NB_PORT_STATS; + + return count; } static int cxgbe_dev_xstats(struct rte_eth_dev *dev, @@ -900,20 +922,28 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev, struct port_info *pi = dev->data->dev_private; struct adapter *adap = pi->adapter; struct sge *s = &adap->sge; + u16 count, i, qid, nstats; struct port_stats ps; - u16 count, i, qid; u64 *stats_ptr; count = cxgbe_dev_xstats_count(pi); if (size < count) return count; - /* port stats */ - cxgbe_stats_get(pi, &ps); + if (is_pf4(adap) != 0) { + /* port stats for PF*/ + cxgbe_stats_get(pi, &ps); + xstats_str = cxgbe_dev_port_stats_strings; + nstats = CXGBE_NB_PORT_STATS; + } else { + /* port stats for VF*/ + cxgbevf_stats_get(pi, &ps); + xstats_str = cxgbevf_dev_port_stats_strings; + nstats = CXGBEVF_NB_PORT_STATS; + } count = 0; - xstats_str = cxgbe_dev_port_stats_strings; - for (i = 0; i < CXGBE_NB_PORT_STATS; i++, count++) { + for (i = 0; i < nstats; i++, count++) { if (xstats_names != NULL) snprintf(xstats_names[count].name, sizeof(xstats_names[count].name), @@ -970,9 +1000,9 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev, } /* Get port extended statistics by ID. */ -static int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, - const uint64_t *ids, uint64_t *values, - unsigned int n) +int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, + const uint64_t *ids, uint64_t *values, + unsigned int n) { struct port_info *pi = dev->data->dev_private; struct rte_eth_xstat *xstats_copy; @@ -1005,9 +1035,9 @@ static int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, } /* Get names of port extended statistics by ID. */ -static int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, - struct rte_eth_xstat_name *xnames, - const uint64_t *ids, unsigned int n) +int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, +struct rte_eth_xst
[dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version
From: Nikhil Vasoya Implement eth_dev_ops callback to get firmware version. Signed-off-by: Nikhil Vasoya Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_ethdev.c | 26 ++ drivers/net/cxgbe/cxgbe_pfvf.h | 2 ++ drivers/net/cxgbe/cxgbevf_ethdev.c | 1 + 3 files changed, 29 insertions(+) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index a6b5c0110a..304fafed25 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1620,6 +1620,31 @@ static int cxgbe_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa) return ret; } +int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, +size_t fw_size) +{ + struct port_info *pi = dev->data->dev_private; + struct adapter *adapter = pi->adapter; + int ret; + + if (adapter->params.fw_vers == 0) + return -EIO; + + ret = snprintf(fw_version, fw_size, "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(adapter->params.fw_vers), + G_FW_HDR_FW_VER_MINOR(adapter->params.fw_vers), + G_FW_HDR_FW_VER_MICRO(adapter->params.fw_vers), + G_FW_HDR_FW_VER_BUILD(adapter->params.fw_vers)); + if (ret < 0) + return -EINVAL; + + ret += 1; + if (fw_size < (size_t)ret) + return ret; + + return 0; +} + static const struct eth_dev_ops cxgbe_eth_dev_ops = { .dev_start = cxgbe_dev_start, .dev_stop = cxgbe_dev_stop, @@ -1665,6 +1690,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { .fec_get_capability = cxgbe_fec_get_capability, .fec_get= cxgbe_fec_get, .fec_set= cxgbe_fec_set, + .fw_version_get = cxgbe_fw_version_get, }; /* diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 3c7aee0ae7..81d0fce2e5 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -63,4 +63,6 @@ int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev, unsigned int n); int cxgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned int n); +int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, +size_t fw_size); #endif /* _CXGBE_PFVF_H_ */ diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c index 4c809991b7..a62c56c2b9 100644 --- a/drivers/net/cxgbe/cxgbevf_ethdev.c +++ b/drivers/net/cxgbe/cxgbevf_ethdev.c @@ -92,6 +92,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = { .xstats_get_names = cxgbe_dev_xstats_get_names, .xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id, .mac_addr_set = cxgbe_mac_addr_set, + .fw_version_get = cxgbe_fw_version_get, }; /* -- 2.27.0
[dpdk-dev] [PATCH v2 0/2] net/cxgbe: add VF xstats and firmware version
This series of patches add following features. Patch 1 adds support to fetch port and queue stats via xstats API for VF. Patch 2 adds support to get firmware version. Thanks, Rahul --- v2: - Update Extended Stats and FW version features in cxgbe.ini and cxgbevf.ini Nikhil Vasoya (2): net/cxgbe: add support for xstats API for the VF net/cxgbe: add support to get firmware version doc/guides/nics/features/cxgbe.ini | 2 + doc/guides/nics/features/cxgbevf.ini | 2 + drivers/net/cxgbe/cxgbe_ethdev.c | 94 ++-- drivers/net/cxgbe/cxgbe_pfvf.h | 13 drivers/net/cxgbe/cxgbevf_ethdev.c | 21 +++ 5 files changed, 100 insertions(+), 32 deletions(-) -- 2.27.0
[dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API for the VF
From: Nikhil Vasoya Add support to fetch port and queue stats via xstats API. Also remove queue stats from basic stats because they're now available via xstats API for the VF. Signed-off-by: Nikhil Vasoya Signed-off-by: Rahul Lakkireddy --- v2: - Update Extended Stats feature in cxgbe.ini and cxgbevf.ini doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/nics/features/cxgbevf.ini | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 68 drivers/net/cxgbe/cxgbe_pfvf.h | 11 + drivers/net/cxgbe/cxgbevf_ethdev.c | 20 +++- 5 files changed, 69 insertions(+), 32 deletions(-) diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini index a3ecf12aad..6721740fbd 100644 --- a/doc/guides/nics/features/cxgbe.ini +++ b/doc/guides/nics/features/cxgbe.ini @@ -24,6 +24,7 @@ L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y Basic stats = Y +Extended stats = Y Stats per queue = Y EEPROM dump = Y Registers dump = Y diff --git a/doc/guides/nics/features/cxgbevf.ini b/doc/guides/nics/features/cxgbevf.ini index 303d6f2337..c8a25c9a8b 100644 --- a/doc/guides/nics/features/cxgbevf.ini +++ b/doc/guides/nics/features/cxgbevf.ini @@ -20,6 +20,7 @@ L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y Basic stats = Y +Extended stats = Y Stats per queue = Y Multiprocess aware = Y Linux= Y diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 177eca3976..a6b5c0110a 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -881,15 +881,37 @@ static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = { {"rx_bg3_truncated_packets", offsetof(struct port_stats, rx_trunc3)}, }; +static const struct cxgbe_dev_xstats_name_off +cxgbevf_dev_port_stats_strings[] = { + {"tx_bytes", offsetof(struct port_stats, tx_octets)}, + {"tx_broadcast_packets", offsetof(struct port_stats, tx_bcast_frames)}, + {"tx_multicast_packets", offsetof(struct port_stats, tx_mcast_frames)}, + {"tx_unicast_packets", offsetof(struct port_stats, tx_ucast_frames)}, + {"tx_drop_packets", offsetof(struct port_stats, tx_drop)}, + {"rx_broadcast_packets", offsetof(struct port_stats, rx_bcast_frames)}, + {"rx_multicast_packets", offsetof(struct port_stats, rx_mcast_frames)}, + {"rx_unicast_packets", offsetof(struct port_stats, rx_ucast_frames)}, + {"rx_length_error_packets", offsetof(struct port_stats, rx_len_err)}, +}; + #define CXGBE_NB_RXQ_STATS RTE_DIM(cxgbe_dev_rxq_stats_strings) #define CXGBE_NB_TXQ_STATS RTE_DIM(cxgbe_dev_txq_stats_strings) #define CXGBE_NB_PORT_STATS RTE_DIM(cxgbe_dev_port_stats_strings) +#define CXGBEVF_NB_PORT_STATS RTE_DIM(cxgbevf_dev_port_stats_strings) static u16 cxgbe_dev_xstats_count(struct port_info *pi) { - return CXGBE_NB_PORT_STATS + - (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) + - (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS); + u16 count; + + count = (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) + + (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS); + + if (is_pf4(pi->adapter) != 0) + count += CXGBE_NB_PORT_STATS; + else + count += CXGBEVF_NB_PORT_STATS; + + return count; } static int cxgbe_dev_xstats(struct rte_eth_dev *dev, @@ -900,20 +922,28 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev, struct port_info *pi = dev->data->dev_private; struct adapter *adap = pi->adapter; struct sge *s = &adap->sge; + u16 count, i, qid, nstats; struct port_stats ps; - u16 count, i, qid; u64 *stats_ptr; count = cxgbe_dev_xstats_count(pi); if (size < count) return count; - /* port stats */ - cxgbe_stats_get(pi, &ps); + if (is_pf4(adap) != 0) { + /* port stats for PF*/ + cxgbe_stats_get(pi, &ps); + xstats_str = cxgbe_dev_port_stats_strings; + nstats = CXGBE_NB_PORT_STATS; + } else { + /* port stats for VF*/ + cxgbevf_stats_get(pi, &ps); + xstats_str = cxgbevf_dev_port_stats_strings; + nstats = CXGBEVF_NB_PORT_STATS; + } count = 0; - xstats_str = cxgbe_dev_port_stats_strings; - for (i = 0; i < CXGBE_NB_PORT_STATS; i++, count++) { + for (i = 0; i < nstats; i++, count++) { if (xstats_names != NULL) snprintf(xstats_names[count].name, sizeof(xstats_names[count].name), @@ -970,9 +1000,9 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev
[dpdk-dev] [PATCH v2 2/2] net/cxgbe: add support to get firmware version
From: Nikhil Vasoya Implement eth_dev_ops callback to get firmware version. Signed-off-by: Nikhil Vasoya Signed-off-by: Rahul Lakkireddy --- v2: - Update FW version feature in cxgbe.ini and cxgbevf.ini doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/nics/features/cxgbevf.ini | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 26 ++ drivers/net/cxgbe/cxgbe_pfvf.h | 2 ++ drivers/net/cxgbe/cxgbevf_ethdev.c | 1 + 5 files changed, 31 insertions(+) diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini index 6721740fbd..f41fc14825 100644 --- a/doc/guides/nics/features/cxgbe.ini +++ b/doc/guides/nics/features/cxgbe.ini @@ -26,6 +26,7 @@ Packet type parsing = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y EEPROM dump = Y Registers dump = Y Multiprocess aware = Y diff --git a/doc/guides/nics/features/cxgbevf.ini b/doc/guides/nics/features/cxgbevf.ini index c8a25c9a8b..a3174ef399 100644 --- a/doc/guides/nics/features/cxgbevf.ini +++ b/doc/guides/nics/features/cxgbevf.ini @@ -22,6 +22,7 @@ Packet type parsing = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y Multiprocess aware = Y Linux= Y x86-32 = Y diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index a6b5c0110a..304fafed25 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1620,6 +1620,31 @@ static int cxgbe_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa) return ret; } +int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, +size_t fw_size) +{ + struct port_info *pi = dev->data->dev_private; + struct adapter *adapter = pi->adapter; + int ret; + + if (adapter->params.fw_vers == 0) + return -EIO; + + ret = snprintf(fw_version, fw_size, "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(adapter->params.fw_vers), + G_FW_HDR_FW_VER_MINOR(adapter->params.fw_vers), + G_FW_HDR_FW_VER_MICRO(adapter->params.fw_vers), + G_FW_HDR_FW_VER_BUILD(adapter->params.fw_vers)); + if (ret < 0) + return -EINVAL; + + ret += 1; + if (fw_size < (size_t)ret) + return ret; + + return 0; +} + static const struct eth_dev_ops cxgbe_eth_dev_ops = { .dev_start = cxgbe_dev_start, .dev_stop = cxgbe_dev_stop, @@ -1665,6 +1690,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { .fec_get_capability = cxgbe_fec_get_capability, .fec_get= cxgbe_fec_get, .fec_set= cxgbe_fec_set, + .fw_version_get = cxgbe_fw_version_get, }; /* diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 3c7aee0ae7..81d0fce2e5 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -63,4 +63,6 @@ int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev, unsigned int n); int cxgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned int n); +int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, +size_t fw_size); #endif /* _CXGBE_PFVF_H_ */ diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c index 4c809991b7..a62c56c2b9 100644 --- a/drivers/net/cxgbe/cxgbevf_ethdev.c +++ b/drivers/net/cxgbe/cxgbevf_ethdev.c @@ -92,6 +92,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = { .xstats_get_names = cxgbe_dev_xstats_get_names, .xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id, .mac_addr_set = cxgbe_mac_addr_set, + .fw_version_get = cxgbe_fw_version_get, }; /* -- 2.27.0
Re: [dpdk-dev] [PATCH] net/cxgbe: remove useless address check
On Monday, October 10/04/21, 2021 at 18:27:54 +0100, Ferruh Yigit wrote: > reported by "gcc (GCC) 12.0.0 20211003 (experimental)": > > ../drivers/net/cxgbe/cxgbe_ethdev.c: > In function ‘cxgbe_dev_rx_queue_setup’: > ../drivers/net/cxgbe/cxgbe_ethdev.c:682:24: > error: the comparison will always evaluate as ‘true’ for the > address of ‘fl’ will never be NULL [-Werror=address] > 682 | if ((&rxq->fl) != NULL) > |^~ > > Fixing it by removing useless check. > > Signed-off-by: Ferruh Yigit Looks good. Thanks for fixing it up. Reviewed-by: Rahul Lakkireddy
[dpdk-dev] [PATCH] net/cxgbe: disable Rx path during port link down
When link goes down, disable the port's Rx path to drop the incoming traffic closer to the wire, instead of accepting them in for further Rx processing, only to eventually drop them at the port's Rxqs. This prevents unnecessary congestion in the Rx path. The port's Rx path will be re-enabled once the link up event is received in the firmware event queue. Signed-off-by: Rahul Lakkireddy --- doc/guides/nics/cxgbe.rst | 14 +++ drivers/net/cxgbe/base/adapter.h| 4 ++ drivers/net/cxgbe/base/common.h | 1 + drivers/net/cxgbe/base/t4_hw.c | 1 + drivers/net/cxgbe/base/t4fw_interface.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 52 + 6 files changed, 58 insertions(+), 15 deletions(-) diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst index 4b9913669..4a8fef07b 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.24.17.0** and higher. Visit +- Requires firmware version **1.25.4.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.24.17.0, TP 0.1.23.2 + firmware-version: 1.25.4.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 0x7fd7c020 EAL: PCI memory mapped at 0x7fd77cdfd000 EAL: PCI memory mapped at 0x7fd7c10b7000 - PMD: rte_cxgbe_pmd: fw: 1.24.17.0, TP: 0.1.23.2 + PMD: rte_cxgbe_pmd: fw: 1.25.4.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 :02:01.0 on NUMA socket 0 EAL: probe driver: 1425:5803 net_cxgbevf - PMD: rte_cxgbe_pmd: Firmware version: 1.24.17.0 + PMD: rte_cxgbe_pmd: Firmware version: 1.25.4.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: :02:01.0 Chelsio rev 0 1G/10GBASE-SFP EAL: PCI device :02:01.1 on NUMA socket 0 EAL: probe driver: 1425:5803 net_cxgbevf - PMD: rte_cxgbe_pmd: Firmware version: 1.24.17.0 + PMD: rte_cxgbe_pmd: Firmware version: 1.25.4.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.24.17.0 + dev.t5nex.0.firmware_version: 1.25.4.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 0x84280 EAL: PCI memory mapped at 0x80086c000 - PMD: rte_cxgbe_pmd: fw: 1.24.17.0, TP: 0.1.23.2 + PMD: rte_cxgbe_pmd: fw: 1.25.4.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/adapter.h b/drivers/net/cxgbe/base/adapter.h index a5a3313c2..01a2a9d14 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -58,6 +58,9 @@ struct port_info { */ u8 vin; u8 vivld; + + u8 vi_en_rx; /* Enable/disable VI Rx */ + u8 vi_en_tx; /* Enable/disable VI Tx */ }; enum { /* adapter flags */ @@ -792,6 +795,7 @@ void t4_free_mem(void *addr); #define t4_os_free(_ptr) t4_free_mem((_ptr)) void t4_os_portmod_changed(const struct adapter *adap, int port_id); +void t4_os_link_changed(struct adapter *adap, int port_id); void reclaim_completed_tx(struct sge_txq *q); void t4_free_sge_resources(struct adapter *adap); diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 202a2f4ba..8225717ae 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -265,6 +265,7 @@ struct adapter_params { u8 filter2_wr_support;/* FW support for FILTER2_WR */ 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 */ }; /* Firmware Port Capabilities types.
[dpdk-dev] [PATCH 0/2] net/cxgbe: add RAW MAC matchall filter support
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. Patch 1 converts all deprecated rte_atomic ops to C11 atomics. Patch 2 queries firmware for RAW MAC matchall filter support and enables it when available. Rahul Lakkireddy (2): net/cxgbe: use C11 atomics instead of rte_atomic ops net/cxgbe: add MAC matchall to track promisc traffic doc/guides/nics/cxgbe.rst | 14 ++-- drivers/net/cxgbe/base/common.h | 3 + drivers/net/cxgbe/base/t4_hw.c | 1 - drivers/net/cxgbe/base/t4fw_interface.h | 2 + drivers/net/cxgbe/clip_tbl.c| 13 ++-- drivers/net/cxgbe/clip_tbl.h| 2 +- drivers/net/cxgbe/cxgbe_ethdev.c| 15 - drivers/net/cxgbe/cxgbe_main.c | 37 +++ 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| 87 ++--- drivers/net/cxgbe/mps_tcam.h| 6 +- drivers/net/cxgbe/sge.c | 1 - drivers/net/cxgbe/smt.c | 14 ++-- drivers/net/cxgbe/smt.h | 2 +- 16 files changed, 161 insertions(+), 58 deletions(-) -- 2.27.0
[dpdk-dev] [PATCH 1/2] net/cxgbe: use C11 atomics instead of rte_atomic ops
Replace rte_atomic ops with C11 atomics. Signed-off-by: Rahul Lakkireddy --- 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 #include #include -#include #include #include #include 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 #include #include -#include #include #include #include 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 #include #include -#include #include #include #include @@ -417,13 +416,15 @@ void cxgbe_remove_tid(struct tid
[dpdk-dev] [PATCH 2/2] net/cxgbe: add MAC matchall to track promisc traffic
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 --- 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 0x7fd7c020 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 :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: :02:01.0 Chelsio rev 0 1G/10GBASE-SFP EAL: PCI device :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 0x84280 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/d
[dpdk-dev] [PATCH 0/2] net/cxgbe: add support for xstats API
This series of patches add support to fetch port and queue stats via xstats API. Patch 1 adds support to fetch port and queue stats via xstats API. Patch 2 removes queue stats from basic stats since they're available via xstats API. Also removes RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS flag. Rahul Lakkireddy (2): net/cxgbe: add support for xstats API net/cxgbe: remove queue stats from basic stats drivers/net/cxgbe/cxgbe_ethdev.c | 320 --- 1 file changed, 296 insertions(+), 24 deletions(-) -- 2.27.0
[dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API
Add support to fetch port and queue stats via xstats API. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_ethdev.c | 302 ++- 1 file changed, 293 insertions(+), 9 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 550843b4d7..8dee3fc3b6 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -778,24 +778,303 @@ static int cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev) cxgbe_stats_reset(pi); for (i = 0; i < pi->n_rx_qsets; i++) { - struct sge_eth_rxq *rxq = - &s->ethrxq[pi->first_rxqset + i]; + struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_rxqset + i]; - rxq->stats.pkts = 0; - rxq->stats.rx_bytes = 0; + memset(&rxq->stats, 0, sizeof(rxq->stats)); } for (i = 0; i < pi->n_tx_qsets; i++) { - struct sge_eth_txq *txq = - &s->ethtxq[pi->first_txqset + i]; + struct sge_eth_txq *txq = &s->ethtxq[pi->first_txqset + i]; - txq->stats.pkts = 0; - txq->stats.tx_bytes = 0; - txq->stats.mapping_err = 0; + memset(&txq->stats, 0, sizeof(txq->stats)); } return 0; } +/* Store extended statistics names and its offset in stats structure */ +struct cxgbe_dev_xstats_name_off { + char name[RTE_ETH_XSTATS_NAME_SIZE]; + unsigned int offset; +}; + +static const struct cxgbe_dev_xstats_name_off cxgbe_dev_rxq_stats_strings[] = { + {"packets", offsetof(struct sge_eth_rx_stats, pkts)}, + {"bytes", offsetof(struct sge_eth_rx_stats, rx_bytes)}, + {"checksum_offloads", offsetof(struct sge_eth_rx_stats, rx_cso)}, + {"vlan_extractions", offsetof(struct sge_eth_rx_stats, vlan_ex)}, + {"dropped_packets", offsetof(struct sge_eth_rx_stats, rx_drops)}, +}; + +static const struct cxgbe_dev_xstats_name_off cxgbe_dev_txq_stats_strings[] = { + {"packets", offsetof(struct sge_eth_tx_stats, pkts)}, + {"bytes", offsetof(struct sge_eth_tx_stats, tx_bytes)}, + {"tso_requests", offsetof(struct sge_eth_tx_stats, tso)}, + {"checksum_offloads", offsetof(struct sge_eth_tx_stats, tx_cso)}, + {"vlan_insertions", offsetof(struct sge_eth_tx_stats, vlan_ins)}, + {"packet_mapping_errors", +offsetof(struct sge_eth_tx_stats, mapping_err)}, + {"coalesced_wrs", offsetof(struct sge_eth_tx_stats, coal_wr)}, + {"coalesced_packets", offsetof(struct sge_eth_tx_stats, coal_pkts)}, +}; + +static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = { + {"tx_bytes", offsetof(struct port_stats, tx_octets)}, + {"tx_packets", offsetof(struct port_stats, tx_frames)}, + {"tx_broadcast_packets", offsetof(struct port_stats, tx_bcast_frames)}, + {"tx_multicast_packets", offsetof(struct port_stats, tx_mcast_frames)}, + {"tx_unicast_packets", offsetof(struct port_stats, tx_ucast_frames)}, + {"tx_error_packets", offsetof(struct port_stats, tx_error_frames)}, + {"tx_size_64_packets", offsetof(struct port_stats, tx_frames_64)}, + {"tx_size_65_to_127_packets", +offsetof(struct port_stats, tx_frames_65_127)}, + {"tx_size_128_to_255_packets", +offsetof(struct port_stats, tx_frames_128_255)}, + {"tx_size_256_to_511_packets", +offsetof(struct port_stats, tx_frames_256_511)}, + {"tx_size_512_to_1023_packets", +offsetof(struct port_stats, tx_frames_512_1023)}, + {"tx_size_1024_to_1518_packets", +offsetof(struct port_stats, tx_frames_1024_1518)}, + {"tx_size_1519_to_max_packets", +offsetof(struct port_stats, tx_frames_1519_max)}, + {"tx_drop_packets", offsetof(struct port_stats, tx_drop)}, + {"tx_pause_frames", offsetof(struct port_stats, tx_pause)}, + {"tx_ppp_pri0_packets", offsetof(struct port_stats, tx_ppp0)}, + {"tx_ppp_pri1_packets", offsetof(struct port_stats, tx_ppp1)}, + {"tx_ppp_pri2_packets", offsetof(struct port_stats, tx_ppp2)}, + {"tx_ppp_pri3_packets", offsetof(struct port_stats, tx_ppp3)}, + {"tx_ppp_pri4_packets", offsetof(struct port_stats, tx_ppp4)}, + {"tx_ppp_pri5_packets", offsetof(struct port_stats, tx_ppp5)}, + {"tx_ppp_pri6_packets", offsetof(struct port_stats, tx_ppp6)}, + {"tx_ppp_pri7_packets", offsetof(struct port_stats, tx_ppp7)}, + {"rx_b
[dpdk-dev] [PATCH 2/2] net/cxgbe: remove queue stats from basic stats
Remove queue stats from basic stats because they're now available via xstats API. Also remove RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS flag. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_ethdev.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 8dee3fc3b6..141a2de808 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -747,22 +747,12 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, eth_stats->oerrors = ps.tx_error_frames; for (i = 0; i < pi->n_rx_qsets; i++) { - struct sge_eth_rxq *rxq = - &s->ethrxq[pi->first_rxqset + i]; + struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_rxqset + i]; - eth_stats->q_ipackets[i] = rxq->stats.pkts; - eth_stats->q_ibytes[i] = rxq->stats.rx_bytes; - eth_stats->ipackets += eth_stats->q_ipackets[i]; - eth_stats->ibytes += eth_stats->q_ibytes[i]; + eth_stats->ipackets += rxq->stats.pkts; + eth_stats->ibytes += rxq->stats.rx_bytes; } - for (i = 0; i < pi->n_tx_qsets; i++) { - struct sge_eth_txq *txq = - &s->ethtxq[pi->first_txqset + i]; - - eth_stats->q_opackets[i] = txq->stats.pkts; - eth_stats->q_obytes[i] = txq->stats.tx_bytes; - } return 0; } @@ -1697,8 +1687,6 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) return 0; } - eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; - snprintf(name, sizeof(name), "cxgbeadapter%d", eth_dev->data->port_id); adapter = rte_zmalloc(name, sizeof(*adapter), 0); if (!adapter) -- 2.27.0
[PATCH 0/5] net/cxgbe: updates and bug fixes
This series of patches add the following updates and bug fixes to the cxgbe PMD. Patch 1 fixes an issue with wrong port id being filled in mbufs allocated in Rx path. Patch 2 fixes an issue with Txq getting stuck when trying to coalesce mbufs with chains. Patch 3 reworks and simplifies the code for posting mbufs and their payload buffer sizes to hardware in Rx path. Patch 4 adds support to track packets in Rx path dropped due to congestion at Rx queues that may not get propagated to the rest of the Rx pipeline. Patch 5 adds support to read firmware configuration file from /lib/firmware/cxgb4/ to allow changing firmware parameters without having to flash the configuration file onto the adapter. Thanks, Rahul Rahul Lakkireddy (5): net/cxgbe: fill correct port info in mbufs for Rx net/cxgbe: fix Tx queue stuck with mbuf chain coalescing net/cxgbe: simplify Rx payload buffer size posting net/cxgbe: track packets dropped by TP due to congestion net/cxgbe: read firmware configuration file from filesystem drivers/net/cxgbe/base/adapter.h| 6 +- drivers/net/cxgbe/base/common.h | 4 +- drivers/net/cxgbe/base/t4_hw.c | 57 +--- drivers/net/cxgbe/base/t4_hw.h | 1 + drivers/net/cxgbe/base/t4_regs.h| 4 + drivers/net/cxgbe/base/t4fw_interface.h | 1 + drivers/net/cxgbe/base/t4vf_hw.c| 40 --- drivers/net/cxgbe/cxgbe_ethdev.c| 11 + drivers/net/cxgbe/cxgbe_main.c | 332 drivers/net/cxgbe/sge.c | 296 +++-- 10 files changed, 351 insertions(+), 401 deletions(-) -- 2.27.0
[PATCH 1/5] net/cxgbe: fill correct port info in mbufs for Rx
Fill the correct DPDK ethdev port_id, instead of local adapter physical port_id in mbufs allocated for Rx. Fixes: 78fc1a716ae8 ("cxgbe: improve Rx performance") Cc: sta...@dpdk.org Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 1c76b8e4d0..5c176004f9 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -1910,7 +1910,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, iq->stat = (void *)&iq->desc[iq->size * 8]; iq->eth_dev = eth_dev; iq->handler = hnd; - iq->port_id = pi->pidx; + iq->port_id = eth_dev->data->port_id; iq->mb_pool = mp; /* set offset to -1 to distinguish ingress queues without FL */ -- 2.27.0
[PATCH 2/5] net/cxgbe: fix Tx queue stuck with mbuf chain coalescing
When trying to coalesce mbufs with chain on Tx side, it is possible to get stuck during queue wrap around. When coalescing this mbuf chain fails, the Tx path returns EBUSY and when the same packet is retried again, it couldn't get coalesced again, and the loop repeats. Fix by pushing the packet through the normal Tx path. Also use FW_ETH_TX_PKTS_WR to handle mbufs with chain for FW to optimize. Fixes: 6c2809628cd5 ("net/cxgbe: improve latency for slow traffic") Cc: sta...@dpdk.org Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/sge.c | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 5c176004f9..566cd48406 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -789,9 +789,9 @@ static inline void txq_advance(struct sge_txq *q, unsigned int n) #define MAX_COALESCE_LEN 64000 -static inline int wraps_around(struct sge_txq *q, int ndesc) +static inline bool wraps_around(struct sge_txq *q, int ndesc) { - return (q->pidx + ndesc) > q->size ? 1 : 0; + return (q->pidx + ndesc) > q->size ? true : false; } static void tx_timer_cb(void *data) @@ -842,7 +842,6 @@ static inline void ship_tx_pkt_coalesce_wr(struct adapter *adap, /* fill the pkts WR header */ wr = (void *)&q->desc[q->pidx]; - wr->op_pkd = htonl(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); vmwr = (void *)&q->desc[q->pidx]; wr_mid = V_FW_WR_LEN16(DIV_ROUND_UP(q->coalesce.flits, 2)); @@ -852,8 +851,11 @@ static inline void ship_tx_pkt_coalesce_wr(struct adapter *adap, wr->npkt = q->coalesce.idx; wr->r3 = 0; if (is_pf4(adap)) { - wr->op_pkd = htonl(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); wr->type = q->coalesce.type; + if (likely(wr->type != 0)) + wr->op_pkd = htonl(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); + else + wr->op_pkd = htonl(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); } else { wr->op_pkd = htonl(V_FW_WR_OP(FW_ETH_TX_PKTS_VM_WR)); vmwr->r4 = 0; @@ -932,13 +934,16 @@ static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq, ndesc = DIV_ROUND_UP(q->coalesce.flits + flits, 8); credits = txq_avail(q) - ndesc; + if (unlikely(wraps_around(q, ndesc))) + return 0; + /* If we are wrapping or this is last mbuf then, send the * already coalesced mbufs and let the non-coalesce pass * handle the mbuf. */ - if (unlikely(credits < 0 || wraps_around(q, ndesc))) { + if (unlikely(credits < 0)) { ship_tx_pkt_coalesce_wr(adap, txq); - return 0; + return -EBUSY; } /* If the max coalesce len or the max WR len is reached @@ -962,8 +967,12 @@ static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq, ndesc = flits_to_desc(q->coalesce.flits + flits); credits = txq_avail(q) - ndesc; - if (unlikely(credits < 0 || wraps_around(q, ndesc))) + if (unlikely(wraps_around(q, ndesc))) return 0; + + if (unlikely(credits < 0)) + return -EBUSY; + q->coalesce.flits += wr_size / sizeof(__be64); q->coalesce.type = type; q->coalesce.ptr = (unsigned char *)&q->desc[q->pidx] + @@ -1106,7 +1115,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, unsigned int flits, ndesc, cflits; int l3hdr_len, l4hdr_len, eth_xtra_len; int len, last_desc; - int credits; + int should_coal, credits; u32 wr_mid; u64 cntrl, *end; bool v6; @@ -1138,9 +1147,9 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, /* align the end of coalesce WR to a 512 byte boundary */ txq->q.coalesce.max = (8 - (txq->q.pidx & 7)) * 8; - if (!((m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) || - m->pkt_len > RTE_ETHER_MAX_LEN)) { - if (should_tx_packet_coalesce(txq, mbuf, &cflits, adap)) { + if ((m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) == 0) { + should_coal = should_tx_packet_coalesce(txq, mbuf, &cflits, adap); + if (should_coal > 0) { if (unlikely(map_mbuf(mbuf, addr) < 0)) { dev_warn(adap, "%s: mapping err for coalesce\n", __func__); @@ -1149,8 +1158,8 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, } return
[PATCH 3/5] net/cxgbe: simplify Rx payload buffer size posting
Match the closest supported Rx payload buffer size with the mempool data size and program it for the Rx queue. This removes unnecessary need for handling additional padding, packing, and alignment, when posting Rx buffers to hardware. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/adapter.h | 6 +- drivers/net/cxgbe/base/common.h | 2 - drivers/net/cxgbe/base/t4_hw.c | 43 -- drivers/net/cxgbe/base/t4_hw.h | 1 + drivers/net/cxgbe/base/t4vf_hw.c | 40 - drivers/net/cxgbe/cxgbe_main.c | 3 +- drivers/net/cxgbe/sge.c | 256 ++- 7 files changed, 81 insertions(+), 270 deletions(-) diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 97963422bf..1c016a7115 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -98,6 +98,7 @@ struct sge_fl { /* SGE free-buffer queue state */ unsigned long alloc_failed; /* # of times buffer allocation failed */ unsigned long low; /* # of times momentarily starving */ + u8 fl_buf_size_idx; /* Selected SGE_FL_BUFFER_SIZE index */ }; #define MAX_MBUF_FRAGS (16384 / 512 + 2) @@ -110,7 +111,6 @@ struct pkt_gl { void *va; /* virtual address of first byte */ unsigned int nfrags; /* # of fragments */ unsigned int tot_len; /* total length of fragments */ - bool usembufs;/* use mbufs for fragments */ }; typedef int (*rspq_handler_t)(struct sge_rspq *q, const __be64 *rsp, @@ -160,7 +160,6 @@ struct sge_eth_rxq {/* a SW Ethernet Rx queue */ struct sge_rspq rspq; struct sge_fl fl; struct sge_eth_rx_stats stats; - bool usembufs; /* one ingress packet per mbuf FL buffer */ } __rte_cache_aligned; /* @@ -286,9 +285,8 @@ struct sge { u16 timer_val[SGE_NTIMERS]; u8 counter_val[SGE_NCOUNTERS]; - u32 fl_align; /* response queue message alignment */ - u32 fl_pg_order;/* large page allocation size */ u32 fl_starve_thres;/* Free List starvation threshold */ + u32 fl_buffer_size[SGE_FL_BUFFER_SIZE_NUM]; /* Free List buffer sizes */ }; /* diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index af987b0d5d..980d78e4a4 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -343,8 +343,6 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); int t4vf_fw_reset(struct adapter *adap); int t4_fw_halt(struct adapter *adap, unsigned int mbox, int reset); int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); -int t4_fl_pkt_align(struct adapter *adap); -int t4vf_fl_pkt_align(struct adapter *adap, u32 sge_control, u32 sge_control2); int t4vf_get_vfres(struct adapter *adap); int t4_fixup_host_params_compat(struct adapter *adap, unsigned int page_size, unsigned int cache_line_size, diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 645833765a..84c4316e68 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -3477,49 +3477,6 @@ int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset) return 0; } -/** - * t4_fl_pkt_align - return the fl packet alignment - * @adap: the adapter - * - * T4 has a single field to specify the packing and padding boundary. - * T5 onwards has separate fields for this and hence the alignment for - * next packet offset is maximum of these two. - */ -int t4_fl_pkt_align(struct adapter *adap) -{ - u32 sge_control, sge_control2; - unsigned int ingpadboundary, ingpackboundary, fl_align, ingpad_shift; - - sge_control = t4_read_reg(adap, A_SGE_CONTROL); - - /* T4 uses a single control field to specify both the PCIe Padding and -* Packing Boundary. T5 introduced the ability to specify these -* separately. The actual Ingress Packet Data alignment boundary -* within Packed Buffer Mode is the maximum of these two -* specifications. -*/ - if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) - ingpad_shift = X_INGPADBOUNDARY_SHIFT; - else - ingpad_shift = X_T6_INGPADBOUNDARY_SHIFT; - - ingpadboundary = 1 << (G_INGPADBOUNDARY(sge_control) + ingpad_shift); - - fl_align = ingpadboundary; - if (!is_t4(adap->params.chip)) { - sge_control2 = t4_read_reg(adap, A_SGE_CONTROL2); - ingpackboundary = G_INGPACKBOUNDARY(sge_control2); - if (ingpackboundary == X_INGPACKBOUNDARY_16B) - ingpackboundary = 16; - else - ingpackboundary = 1 << (ingpackboundary + - X_
[PATCH 4/5] net/cxgbe: track packets dropped by TP due to congestion
Rx packets can get dropped at TP due to congestion and this info will not get propagated to MPS. Track these Rx dropped packets in imissed counter. Also add xstats for these counters. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/common.h | 2 ++ drivers/net/cxgbe/base/t4_hw.c | 14 -- drivers/net/cxgbe/base/t4_regs.h | 4 drivers/net/cxgbe/cxgbe_ethdev.c | 11 +++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 980d78e4a4..4482ddbf56 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -101,6 +101,8 @@ struct port_stats { u64 rx_trunc1;/* buffer-group 1 truncated packets */ u64 rx_trunc2;/* buffer-group 2 truncated packets */ u64 rx_trunc3;/* buffer-group 3 truncated packets */ + + u64 rx_tp_tnl_cong_drops[NCHAN]; /* TP frame drops due to congestion */ }; struct sge_params { diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 84c4316e68..384080e6d3 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -3040,8 +3040,10 @@ unsigned int t4_get_tp_ch_map(struct adapter *adapter, unsigned int pidx) */ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { - u32 bgmap = t4_get_mps_bg_map(adap, idx); u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); + u32 bgmap = t4_get_mps_bg_map(adap, idx); + u32 val[NCHAN] = { 0 }; + u8 i; #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -3129,6 +3131,11 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) p->rx_trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_MAC_TRUNC_FRAME) : 0; p->rx_trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_MAC_TRUNC_FRAME) : 0; + t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, &val[idx], 1, +A_TP_MIB_TNL_CNG_DROP_0 + idx); + + for (i = 0; i < NCHAN; i++) + p->rx_tp_tnl_cong_drops[i] = val[i]; #undef GET_STAT #undef GET_STAT_COM } @@ -3163,9 +3170,10 @@ void t4_get_port_stats_offset(struct adapter *adap, int idx, */ void t4_clr_port_stats(struct adapter *adap, int idx) { - unsigned int i; u32 bgmap = t4_get_mps_bg_map(adap, idx); u32 port_base_addr; + unsigned int i; + u32 val = 0; if (is_t4(adap->params.chip)) port_base_addr = PORT_BASE(idx); @@ -3187,6 +3195,8 @@ void t4_clr_port_stats(struct adapter *adap, int idx) A_MPS_STAT_RX_BG_0_MAC_TRUNC_FRAME_L + i * 8, 0); } + t4_write_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, + &val, 1, A_TP_MIB_TNL_CNG_DROP_0 + idx); } /** diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h index 8a14d09a15..ff60dc1bb3 100644 --- a/drivers/net/cxgbe/base/t4_regs.h +++ b/drivers/net/cxgbe/base/t4_regs.h @@ -525,6 +525,8 @@ #define A_TP_PIO_ADDR 0x7e40 #define A_TP_PIO_DATA 0x7e44 +#define A_TP_MIB_INDEX 0x7e50 +#define A_TP_MIB_DATA 0x7e54 #define A_TP_RSS_SECRET_KEY0 0x40 @@ -587,6 +589,8 @@ #define S_RM_OVLAN 9 #define V_RM_OVLAN(x) ((x) << S_RM_OVLAN) +#define A_TP_MIB_TNL_CNG_DROP_0 0x18 + /* registers for module MA */ #define A_MA_EDRAM0_BAR 0x77c0 diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index e7ea76180f..cf9a2fdc19 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -709,6 +709,9 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, ps.rx_ovflow2 + ps.rx_ovflow3 + ps.rx_trunc0 + ps.rx_trunc1 + ps.rx_trunc2 + ps.rx_trunc3; + for (i = 0; i < NCHAN; i++) + eth_stats->imissed += ps.rx_tp_tnl_cong_drops[i]; + eth_stats->ierrors = ps.rx_symbol_err + ps.rx_fcs_err + ps.rx_jabber + ps.rx_too_long + ps.rx_runt + ps.rx_len_err; @@ -851,6 +854,14 @@ static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = { {"rx_bg1_truncated_packets", offsetof(struct port_stats, rx_trunc1)}, {"rx_bg2_truncated_packets", offsetof(struct port_stats, rx_trunc2)}, {"rx_bg3_truncated_packets", offsetof(struct port_stats, rx_trunc3)}, + {"rx_tp_tnl_cong_drops0", +offsetof(struct port_stats, rx_tp_tnl_cong_drops[0])}, + {"rx_tp_tnl_cong_drops1", +offsetof(struct port_stats, rx_tp_tnl_cong_drops[1])}, + {"rx_tp_tnl_cong_drops2", +offsetof(struct port_stats, rx_tp_tnl_cong_drops[2])}, + {&q
[PATCH 5/5] net/cxgbe: read firmware configuration file from filesystem
Add support to read firmware configuration file from /lib/firmware/cxgb4/ path in the filesystem. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/t4fw_interface.h | 1 + drivers/net/cxgbe/cxgbe_main.c | 329 2 files changed, 217 insertions(+), 113 deletions(-) diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h index a0a9292c0c..76f58d7c77 100644 --- a/drivers/net/cxgbe/base/t4fw_interface.h +++ b/drivers/net/cxgbe/base/t4fw_interface.h @@ -697,6 +697,7 @@ enum fw_params_param_dev { */ FW_PARAMS_PARAM_DEV_FWREV = 0x0B, /* fw version */ FW_PARAMS_PARAM_DEV_TPREV = 0x0C, /* tp version */ + FW_PARAMS_PARAM_DEV_CF = 0x0D, FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL = 0x17, FW_PARAMS_PARAM_DEV_FILTER2_WR = 0x1D, FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27, diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index e2a2ccb781..7b162af3e7 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -11,6 +12,7 @@ #include #include #include +#include #include #include @@ -1006,6 +1008,218 @@ static int configure_filter_mode_mask(struct adapter *adap) params, val); } +#define CXGBE_FW_CONFIG_PATH_T5 "/lib/firmware/cxgb4/t5-config.txt" +#define CXGBE_FW_CONFIG_PATH_T6 "/lib/firmware/cxgb4/t6-config.txt" + +/* + * Load firmware configuration from file in /lib/firmware/cxgb4/ path, + * if it is present. + */ +static int cxgbe_load_fw_config_from_filesystem(struct adapter *adap, + const char **config_name, + u32 *mem_type, u32 *mem_addr) +{ + u32 param, val, mtype, maddr; + const char *fw_cfg_path; + char *fw_cfg = NULL; + struct stat st; + int ret, fd; + + switch (CHELSIO_CHIP_VERSION(adap->params.chip)) { + case CHELSIO_T5: + fw_cfg_path = CXGBE_FW_CONFIG_PATH_T5; + break; + case CHELSIO_T6: + fw_cfg_path = CXGBE_FW_CONFIG_PATH_T6; + break; + default: + return -ENOENT; + } + + ret = open(fw_cfg_path, O_RDONLY); + if (ret < 0) { + dev_debug(adap, "Couldn't open FW config file\n"); + return ret; + } + + fd = ret; + + ret = fstat(fd, &st); + if (ret < 0) { + dev_debug(adap, "Couldn't get FW config file size\n"); + goto out_err; + } + + if (st.st_size >= FLASH_CFG_MAX_SIZE) { + dev_debug(adap, "FW config file size >= max(%u)\n", + FLASH_CFG_MAX_SIZE); + ret = -ENOMEM; + goto out_err; + } + + fw_cfg = rte_zmalloc(NULL, st.st_size, 0); + if (fw_cfg == NULL) { + ret = -ENOMEM; + goto out_err; + } + + if (read(fd, fw_cfg, st.st_size) != st.st_size) { + dev_debug(adap, "Couldn't read FW config file data\n"); + ret = -EIO; + goto out_err; + } + + close(fd); + + /* Send it to FW to verify and update to new configuration */ + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_CF); + ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, ¶m, &val); + if (ret < 0) { + dev_debug(adap, "FW config param query failed: %d\n", ret); + goto out_free; + } + + mtype = val >> 8; + maddr = (val & 0xff) << 16; + + t4_os_lock(&adap->win0_lock); + ret = t4_memory_rw(adap, MEMWIN_NIC, mtype, maddr, st.st_size, + fw_cfg, T4_MEMORY_WRITE); + t4_os_unlock(&adap->win0_lock); + if (ret < 0) { + dev_debug(adap, "FW config file update failed: %d\n", ret); + goto out_free; + } + + rte_free(fw_cfg); + + *mem_type = mtype; + *mem_addr = maddr; + *config_name = fw_cfg_path; + return 0; + +out_err: + close(fd); +out_free: + rte_free(fw_cfg); + return ret; +} + +static int cxgbe_load_fw_config(struct adapter *adap) +{ + u32 finiver, finicsum, cfcsum, mtype, maddr, param, val; + struct fw_caps_config_cmd caps_cmd = { 0 }; + const char *config_name = NULL; + int ret; + + ret = cxgbe_load_fw_config_from_filesystem(adap, &config_name, + &mtype, &maddr); + if
Re: [dpdk-dev] [PATCH 2/3] net/cxgbe: remove unused variable usage
On Wednesday, January 01/25/17, 2017 at 17:43:57 +0530, Ferruh Yigit wrote: > On 1/24/2017 8:48 PM, Emmanuel Roullit wrote: > > Found with clang static analysis: > > drivers/net/cxgbe/sge.c:900:3: warning: > > Value stored to 'in_use' is never read > > in_use += q->size; > > ^ ~~~ > > > > Fixes: c167acb61278 ("net/cxgbe: use I/O device memory read/write API") This fixes line seems to be wrong. Should be: Fixes: 4a01078b4fd1 ("cxgbe: add Tx support") > > > > Signed-off-by: Emmanuel Roullit > > --- > > drivers/net/cxgbe/sge.c | 4 > > 1 file changed, 4 deletions(-) > > > > diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c > > index fc03a0c26..42051ca01 100644 > > --- a/drivers/net/cxgbe/sge.c > > +++ b/drivers/net/cxgbe/sge.c > > @@ -891,14 +891,10 @@ static inline int should_tx_packet_coalesce(struct > > sge_eth_txq *txq, > > unsigned int flits, ndesc; > > unsigned char type = 0; > > int credits, hw_cidx = ntohs(q->stat->cidx); > > - int in_use = q->pidx - hw_cidx + flits_to_desc(q->coalesce.flits); > > > > /* use coal WR type 1 when no frags are present */ > > type = (mbuf->nb_segs == 1) ? 1 : 0; > > > > - if (in_use < 0) > > - in_use += q->size; > > Intention can be "q->in_use" here. That change can be proper fix instead > of removing. > > I will wait for maintainers comment to get the patch. > in_use can be removed. Also, Patch 2 and 3 can be merged. > > - > > if (unlikely(type != q->coalesce.type && q->coalesce.idx)) > > ship_tx_pkt_coalesce_wr(adap, txq); > > > > > Thanks, Rahul
Re: [dpdk-dev] [PATCH 1/1] net/cxgbe: check return value of malloc
On Saturday, March 03/25/17, 2017 at 18:14:29 +0530, caihe wrote: >Hi rahul, > >There is a bug without check the return value of alloc memory in function >t4_wr_mbox_meat_timeout, if we should fix it as below: > >diff --git a/drivers/net/cxgbe/base/t4_hw.c >b/drivers/net/cxgbe/base/t4_hw.c >index c089b06..7402a5f 100644 >--- a/drivers/net/cxgbe/base/t4_hw.c >+++ b/drivers/net/cxgbe/base/t4_hw.c >@@ -359,6 +359,10 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int >mbox, > struct mbox_entry entry; > u32 pcie_fw = 0; > >+ if (!temp) { >+ return -ENOMEM; >+ } >+ > if ((size & 15) || size > MBOX_LEN) { > free(temp); > return -EINVAL; > >Best Regards Thanks for the fix! However, there seem to be checkpatch issues with the patch that need to be fixed. http://dpdk.org/ml/archives/test-report/2017-March/015606.html Thanks, Rahul
Re: [dpdk-dev] [PATCH v2] net/cxgbe: fix a bug in t4_wr_mbox_meat_timeout
On Tuesday, March 03/28/17, 2017 at 13:02:20 +0530, henry wrote: >Check return value of malloc > >Signed-off-by: henry >--- > drivers/net/cxgbe/base/t4_hw.c | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/drivers/net/cxgbe/base/t4_hw.c >b/drivers/net/cxgbe/base/t4_hw.c >index c089b06..9dca8da 100644 >--- a/drivers/net/cxgbe/base/t4_hw.c >+++ b/drivers/net/cxgbe/base/t4_hw.c >@@ -359,6 +359,9 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int >mbox, > struct mbox_entry entry; > u32 pcie_fw = 0; > >+ if (!temp) >+ return -ENOMEM; >+ > if ((size & 15) || size > MBOX_LEN) { > free(temp); > return -EINVAL; >-- >1.8.3.1 Thanks for the fix! Acked-by: Rahul Lakkireddy
[dpdk-dev] Pktgen-DPDK build errors on ppc64le
Hi All, We are seeing Pktgen-DPDK not building on ppc64le with latest dpdk git repo. Below build errors are seen: - [pktgen-dpdk]# make == lib == common CC l2p.o In file included from /root/pktgen-dpdk/lib/common/l2p.c:88:0: /root/pktgen-dpdk/lib/common/l2p.h: In function ‘pg_raw_dump_l2p’: /root/pktgen-dpdk/lib/common/l2p.h:103:2: error: comparison is always true due to limited range of data type [-Werror=type-limits] for (i = 0; i < RTE_MAX_LCORE; i++) ^ /root/pktgen-dpdk/lib/common/l2p.h:109:2: error: comparison is always true due to limited range of data type [-Werror=type-limits] for (j = 0; j < RTE_MAX_LCORE; j++) { ^ /root/pktgen-dpdk/lib/common/l2p.h: In function ‘pg_dump_l2p’: /root/pktgen-dpdk/lib/common/l2p.h:486:2: error: comparison is always true due to limited range of data type [-Werror=type-limits] for (lid = 0; lid < RTE_MAX_LCORE; lid++) { ^ /root/pktgen-dpdk/lib/common/l2p.c: In function ‘pg_port_matrix_dump’: /root/pktgen-dpdk/lib/common/l2p.c:477:3: error: large integer implicitly truncated to unsigned type [-Werror=overflow] cnt.rxtx = get_map(l2p, pid, RTE_MAX_LCORE); ^ /root/pktgen-dpdk/lib/common/l2p.c:488:3: error: large integer implicitly truncated to unsigned type [-Werror=overflow] cnt.rxtx = get_map(l2p, pid, RTE_MAX_LCORE); ^ cc1: all warnings being treated as errors make[3]: *** [l2p.o] Error 1 make[2]: *** [all] Error 2 make[1]: *** [common] Error 2 make: *** [lib] Error 2 - By changing CONFIG_RTE_MAX_LCORE to 128 in defconfig_ppc_64-power8-linuxapp-gcc file, Pktgen-DPDK then builds fine. Thanks, Rahul
[dpdk-dev] [PATCH 01/13] cxgbe: add support to run Chelsio T6 cards
Add code to detect and run T6 devices. Update PCI ID Device table with Chelsio T6 device ids and update documentation. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- doc/guides/nics/cxgbe.rst | 41 +- doc/guides/rel_notes/release_17_08.rst | 4 +++ drivers/net/cxgbe/base/common.h| 3 ++- drivers/net/cxgbe/base/t4_chip_type.h | 11 +++- drivers/net/cxgbe/base/t4_hw.c | 46 +++--- drivers/net/cxgbe/base/t4_pci_id_tbl.h | 15 ++- drivers/net/cxgbe/base/t4_regs.h | 7 +- drivers/net/cxgbe/cxgbe_main.c | 14 +-- 8 files changed, 115 insertions(+), 26 deletions(-) diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst index a205b43..176c189 100644 --- a/doc/guides/nics/cxgbe.rst +++ b/doc/guides/nics/cxgbe.rst @@ -1,5 +1,5 @@ .. BSD LICENSE -Copyright 2015 Chelsio Communications. +Copyright 2015-2017 Chelsio Communications. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -32,8 +32,8 @@ CXGBE Poll Mode Driver == The CXGBE PMD (**librte_pmd_cxgbe**) provides poll mode driver support -for **Chelsio T5** 10/40 Gbps family of adapters. CXGBE PMD has support -for the latest Linux and FreeBSD operating systems. +for **Chelsio Terminator** 10/25/40/100 Gbps family of adapters. CXGBE PMD +has support for the latest Linux and FreeBSD operating systems. More information can be found at `Chelsio Communications Official Website <http://www.chelsio.com>`_. @@ -55,9 +55,10 @@ CXGBE PMD has support for: Limitations --- -The Chelsio T5 devices provide two/four ports but expose a single PCI bus -address, thus, librte_pmd_cxgbe registers itself as a -PCI driver that allocates one Ethernet device per detected port. +The Chelsio Terminator series of devices provide two/four ports but +expose a single PCI bus address, thus, librte_pmd_cxgbe registers +itself as a PCI driver that allocates one Ethernet device per detected +port. For this reason, one cannot whitelist/blacklist a single port without whitelisting/blacklisting the other ports on the same device. @@ -70,10 +71,16 @@ Supported Chelsio T5 NICs - 40G NICs: T580-CR, T580-LP-CR, T580-SO-CR - Other T5 NICs: T522-CR +Supported Chelsio T6 NICs +- + +- 25G NICs: T6425-CR, T6225-CR, T6225-LL-CR, T6225-SO-CR +- 100G NICs: T62100-CR, T62100-LP-CR, T62100-SO-CR + Prerequisites - -- Requires firmware version **1.13.32.0** and higher. Visit +- Requires firmware version **1.16.43.0** and higher. Visit `Chelsio Download Center <http://service.chelsio.com>`_ to get latest firmware bundled with the latest Chelsio Unified Wire package. @@ -197,12 +204,12 @@ Unified Wire package for Linux operating system are as follows: .. code-block:: console - firmware-version: 1.13.32.0, TP 0.1.4.8 + firmware-version: 1.16.43.0, TP 0.1.4.9 Running testpmd ~~~ -This section demonstrates how to launch **testpmd** with Chelsio T5 +This section demonstrates how to launch **testpmd** with Chelsio devices managed by librte_pmd_cxgbe in Linux operating system. #. Load the kernel module: @@ -226,7 +233,7 @@ devices managed by librte_pmd_cxgbe in Linux operating system. .. note:: - Both the interfaces of a Chelsio T5 2-port adapter are bound to the + Both the interfaces of a Chelsio 2-port adapter are bound to the same PCI bus address. #. Unload the kernel module: @@ -243,7 +250,7 @@ devices managed by librte_pmd_cxgbe in Linux operating system. .. note:: - Currently, CXGBE PMD only supports the binding of PF4 for Chelsio T5 NICs. + Currently, CXGBE PMD only supports the binding of PF4 for Chelsio NICs. Example output: @@ -255,7 +262,7 @@ devices managed by librte_pmd_cxgbe in Linux operating system. EAL: PCI memory mapped at 0x7fd7c020 EAL: PCI memory mapped at 0x7fd77cdfd000 EAL: PCI memory mapped at 0x7fd7c10b7000 - PMD: rte_cxgbe_pmd: fw: 1.13.32.0, TP: 0.1.4.8 + PMD: rte_cxgbe_pmd: fw: 1.16.43.0, TP: 0.1.4.9 PMD: rte_cxgbe_pmd: Coming up as MASTER: Initializing adapter Interactive-mode selected Configuring Port 0 (socket 0) @@ -339,12 +346,12 @@ Unified Wire package for FreeBSD operating system are as follows: .. code-block:: console - dev.t5nex.0.firmware_version: 1.13.32.0 + dev.t5nex.0.firmware_version: 1.16.43.0 Running testpmd ~~~ -This section demonstrates how to launch **testpmd** with Chelsio T5 +This section demonstrates how to launch **testpmd** with Chelsio devices managed by librte_pmd_cxgbe in FreeBSD operating system. #. Change to DPDK source directory where the target has been compiled in @@ -413,7 +420,7 @@ devices managed by librte_pmd_cxgbe in FreeBSD opera
[dpdk-dev] [PATCH 00/13] cxgbe: add support for Chelsio T6 family of adapters
This series of patches add support for Chelsio T6 family of adapters. Patches 1 - 4 update CXGBE PMD to detect and run Chelsio T6 cards. Patches 5 - 6 add new link speeds and update port modules. Patch 7 updates information prints to accommodate Chelsio T6 cards. Patch 8 updates TX path to reflect Chelsio T6 changes. Patches 9 - 11 update RX path to reflect Chelsio T6 changes. Patch 12 updates port statistics to not accumulate pause frames as part of packet count and also fixes issue with rx counters. Patch 13 removes RTE_PCI_DRV_INTR_LSC flag from CXGBE PMD since it doesn't handle direct LSC interrupts. Thanks, Rahul Rahul Lakkireddy (13): cxgbe: add support to run Chelsio T6 cards cxgbe: update register dump cxgbe: update flash part information cxgbe: grab available ports after firmware reset cxgbe: update link speeds and port modules cxgbe: add forward error correction support cxgbe: update hardware info prints cxgbe: update TX path for Chelsio T6 cxgbe: update RXQ channel mapping for Chelsio T6 cxgbe: update RX path for Chelsio T6 cxgbe: add compressed error vector cxgbe: fix port statistics cxgbe: remove RTE_PCI_DRV_INTR_LSC from driver flags doc/guides/nics/cxgbe.rst | 41 +- doc/guides/rel_notes/release_17_08.rst |4 + drivers/net/cxgbe/base/adapter.h|4 +- drivers/net/cxgbe/base/common.h | 30 +- drivers/net/cxgbe/base/t4_chip_type.h | 11 +- drivers/net/cxgbe/base/t4_hw.c | 1160 +-- drivers/net/cxgbe/base/t4_hw.h | 18 +- drivers/net/cxgbe/base/t4_msg.h | 16 +- drivers/net/cxgbe/base/t4_pci_id_tbl.h | 15 +- drivers/net/cxgbe/base/t4_regs.h| 31 +- drivers/net/cxgbe/base/t4_regs_values.h |7 +- drivers/net/cxgbe/base/t4fw_interface.h | 24 +- drivers/net/cxgbe/cxgbe_ethdev.c| 10 +- drivers/net/cxgbe/cxgbe_main.c | 96 +-- drivers/net/cxgbe/sge.c | 83 ++- 15 files changed, 1364 insertions(+), 186 deletions(-) -- 2.5.3
[dpdk-dev] [PATCH 05/13] cxgbe: update link speeds and port modules
Add 25G and 100G link speeds and update supported port modules. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/common.h | 4 ++-- drivers/net/cxgbe/base/t4_hw.c | 17 + drivers/net/cxgbe/base/t4fw_interface.h | 18 -- drivers/net/cxgbe/cxgbe_main.c | 21 ++--- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 2520c0e..73ec057 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -231,8 +231,8 @@ struct adapter_params { struct link_config { unsigned short supported;/* link capabilities */ unsigned short advertising; /* advertised capabilities */ - unsigned short requested_speed; /* speed user has requested */ - unsigned short speed;/* actual link speed */ + unsigned int requested_speed; /* speed user has requested */ + unsigned int speed;/* actual link speed */ unsigned char requested_fc; /* flow control user has requested */ unsigned char fc; /* actual link flow control */ unsigned char autoneg; /* autonegotiating? */ diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 4ab12ac..05bf1e8 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -2522,9 +2522,8 @@ int t4_get_tp_version(struct adapter *adapter, u32 *vers) 1, vers, 0); } -#define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ - FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ - FW_PORT_CAP_SPEED_100G | FW_PORT_CAP_ANEG) +#define ADVERT_MASK (V_FW_PORT_CAP_SPEED(M_FW_PORT_CAP_SPEED) | \ +FW_PORT_CAP_ANEG) /** * t4_link_l1cfg - apply link configuration to MAC/PHY @@ -2669,6 +2668,12 @@ const char *t4_get_port_type_description(enum fw_port_type port_type) "QSA", "QSFP", "BP40_BA", + "KR4_100G", + "CR4_QSFP", + "CR_QSFP", + "CR2_QSFP", + "SFP28", + "KR_SFP28", }; if (port_type < ARRAY_SIZE(port_type_description)) @@ -3745,7 +3750,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) if (opcode == FW_PORT_CMD && action == FW_PORT_ACTION_GET_PORT_INFO) { /* link/module state change message */ - int speed = 0, fc = 0, i; + unsigned int speed = 0, fc = 0, i; int chan = G_FW_PORT_CMD_PORTID(be32_to_cpu(p->op_to_portid)); struct port_info *pi = NULL; struct link_config *lc; @@ -3763,8 +3768,12 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) speed = ETH_SPEED_NUM_1G; else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G)) speed = ETH_SPEED_NUM_10G; + else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_25G)) + speed = ETH_SPEED_NUM_25G; else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G)) speed = ETH_SPEED_NUM_40G; + else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100G)) + speed = ETH_SPEED_NUM_100G; for_each_port(adap, i) { pi = adap2pinfo(adap, i); diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h index 74f19fe..43e8c0a 100644 --- a/drivers/net/cxgbe/base/t4fw_interface.h +++ b/drivers/net/cxgbe/base/t4fw_interface.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2014-2015 Chelsio Communications. + * Copyright(c) 2014-2017 Chelsio Communications. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1061,7 +1061,7 @@ struct fw_vi_stats_cmd { enum fw_port_cap { FW_PORT_CAP_SPEED_100M = 0x0001, FW_PORT_CAP_SPEED_1G= 0x0002, - FW_PORT_CAP_SPEED_2_5G = 0x0004, + FW_PORT_CAP_SPEED_25G = 0x0004, FW_PORT_CAP_SPEED_10G = 0x0008, FW_PORT_CAP_SPEED_40G = 0x0010, FW_PORT_CAP_SPEED_100G = 0x0020, @@ -1077,6 +1077,12 @@ enum fw_port_cap { FW_PORT_CAP_802_3_ASM_DIR = 0x8000, }; +#define S_FW_PORT_CAP_SPEED 0 +#define M_FW_PORT_CAP_SPEED 0x3f +#define V_FW_PORT_CAP_SPEED(x) ((x) << S_FW_PORT_CAP_SPEED) +#define G_FW_PORT_CAP_SPEED(x) \ + (((x) >> S_FW_PORT_CAP_SPEED) & M_FW_PORT_CAP_SPEED) + enum fw_port_mdi { F
[dpdk-dev] [PATCH 04/13] cxgbe: grab available ports after firmware reset
Move code to get the available ports from the firmware after it had been reset. This ensures that driver uses the latest info on available ports after firmware reset. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/cxgbe_main.c | 36 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index 3617e28..21e731f 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -662,26 +662,6 @@ static int adap_init0(struct adapter *adap) } /* -* Find out what ports are available to us. Note that we need to do -* this before calling adap_init0_no_config() since it needs nports -* and portvec ... -*/ - v = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | - V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_PORTVEC); - ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, &v, &port_vec); - if (ret < 0) { - dev_err(adap, "%s: failure in t4_queury_params; error = %d\n", - __func__, ret); - goto bye; - } - - adap->params.nports = hweight32(port_vec); - adap->params.portvec = port_vec; - - dev_debug(adap, "%s: adap->params.nports = %u\n", __func__, - adap->params.nports); - - /* * If the firmware is initialized already (and we're not forcing a * master initialization), note that we're living with existing * adapter parameters. Otherwise, it's time to try initializing the @@ -705,6 +685,22 @@ static int adap_init0(struct adapter *adap) goto bye; } + /* Find out what ports are available to us. */ + v = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_PORTVEC); + ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, &v, &port_vec); + if (ret < 0) { + dev_err(adap, "%s: failure in t4_query_params; error = %d\n", + __func__, ret); + goto bye; + } + + adap->params.nports = hweight32(port_vec); + adap->params.portvec = port_vec; + + dev_debug(adap, "%s: adap->params.nports = %u\n", __func__, + adap->params.nports); + /* * Give the SGE code a chance to pull in anything that it needs ... * Note that this must be called after we retrieve our VPD parameters -- 2.5.3
[dpdk-dev] [PATCH 02/13] cxgbe: update register dump
Add Chelsio T6 registers to register dump. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/t4_hw.c | 567 + 1 file changed, 567 insertions(+) diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index e618873..da28aa0 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -584,6 +584,7 @@ unsigned int t4_get_regs_len(struct adapter *adapter) switch (chip_version) { case CHELSIO_T5: + case CHELSIO_T6: return T5_REGMAP_SIZE; } @@ -1379,6 +1380,567 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size) 0x51300, 0x51308, }; + static const unsigned int t6_reg_ranges[] = { + 0x1008, 0x101c, + 0x1024, 0x10a8, + 0x10b4, 0x10f8, + 0x1100, 0x1114, + 0x111c, 0x112c, + 0x1138, 0x113c, + 0x1144, 0x114c, + 0x1180, 0x1184, + 0x1190, 0x1194, + 0x11a0, 0x11a4, + 0x11b0, 0x11b4, + 0x11fc, 0x1274, + 0x1280, 0x133c, + 0x1800, 0x18fc, + 0x3000, 0x302c, + 0x3060, 0x30b0, + 0x30b8, 0x30d8, + 0x30e0, 0x30fc, + 0x3140, 0x357c, + 0x35a8, 0x35cc, + 0x35ec, 0x35ec, + 0x3600, 0x5624, + 0x56cc, 0x56ec, + 0x56f4, 0x5720, + 0x5728, 0x575c, + 0x580c, 0x5814, + 0x5890, 0x589c, + 0x58a4, 0x58ac, + 0x58b8, 0x58bc, + 0x5940, 0x595c, + 0x5980, 0x598c, + 0x59b0, 0x59c8, + 0x59d0, 0x59dc, + 0x59fc, 0x5a18, + 0x5a60, 0x5a6c, + 0x5a80, 0x5a8c, + 0x5a94, 0x5a9c, + 0x5b94, 0x5bfc, + 0x5c10, 0x5e48, + 0x5e50, 0x5e94, + 0x5ea0, 0x5eb0, + 0x5ec0, 0x5ec0, + 0x5ec8, 0x5ed0, + 0x5ee0, 0x5ee0, + 0x5ef0, 0x5ef0, + 0x5f00, 0x5f00, + 0x6000, 0x6020, + 0x6028, 0x6040, + 0x6058, 0x609c, + 0x60a8, 0x619c, + 0x7700, 0x7798, + 0x77c0, 0x7880, + 0x78cc, 0x78fc, + 0x7b00, 0x7b58, + 0x7b60, 0x7b84, + 0x7b8c, 0x7c54, + 0x7d00, 0x7d38, + 0x7d40, 0x7d84, + 0x7d8c, 0x7ddc, + 0x7de4, 0x7e04, + 0x7e10, 0x7e1c, + 0x7e24, 0x7e38, + 0x7e40, 0x7e44, + 0x7e4c, 0x7e78, + 0x7e80, 0x7edc, + 0x7ee8, 0x7efc, + 0x8dc0, 0x8de4, + 0x8df8, 0x8e04, + 0x8e10, 0x8e84, + 0x8ea0, 0x8f88, + 0x8fb8, 0x9058, + 0x9060, 0x9060, + 0x9068, 0x90f8, + 0x9100, 0x9124, + 0x9400, 0x9470, + 0x9600, 0x9600, + 0x9608, 0x9638, + 0x9640, 0x9704, + 0x9710, 0x971c, + 0x9800, 0x9808, + 0x9820, 0x983c, + 0x9850, 0x9864, + 0x9c00, 0x9c6c, + 0x9c80, 0x9cec, + 0x9d00, 0x9d6c, + 0x9d80, 0x9dec, + 0x9e00, 0x9e6c, + 0x9e80, 0x9eec, + 0x9f00, 0x9f6c, + 0x9f80, 0xa020, + 0xd004, 0xd03c, + 0xd100, 0xd118, + 0xd200, 0xd214, + 0xd220, 0xd234, + 0xd240, 0xd254, + 0xd260, 0xd274, + 0xd280, 0xd294, + 0xd2a0, 0xd2b4, + 0xd2c0, 0xd2d4, + 0xd2e0, 0xd2f4, + 0xd300, 0xd31c, + 0xdfc0, 0xdfe0, + 0xe000, 0xf008, + 0xf010, 0xf018, + 0xf020, 0xf028, + 0x11000, 0x11014, + 0x11048, 0x1106c, + 0x11074, 0x11088, + 0x11098, 0x11120, + 0x1112c, 0x1117c, + 0x11190, 0x112e0, + 0x11300, 0x1130c, + 0x12000, 0x1206c, + 0x19040, 0x1906c, + 0x19078, 0x19080, + 0x1908c, 0x190e8, + 0x190f0, 0x190f8, + 0x19100, 0x19110, + 0x19120, 0x19124, + 0x19150, 0x19194, + 0x1919c, 0x191b0, + 0x191d0, 0x191e8, + 0x19238, 0x19290, + 0x192a4, 0x192b0, + 0x192bc, 0x192bc, + 0x19348, 0x1934c, + 0x193f8, 0x19418, + 0x19420, 0x19428, + 0x19430, 0x19444
[dpdk-dev] [PATCH 06/13] cxgbe: add forward error correction support
Add forward error correction (FEC) support and update link configuration. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/common.h | 8 + drivers/net/cxgbe/base/t4_hw.c | 57 ++--- drivers/net/cxgbe/base/t4fw_interface.h | 6 ++-- 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 73ec057..5db4ca8 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -68,6 +68,12 @@ enum { PAUSE_AUTONEG = 1 << 2 }; +enum { + FEC_RS= 1 << 0, + FEC_BASER_RS = 1 << 1, + FEC_RESERVED = 1 << 2, +}; + struct port_stats { u64 tx_octets;/* total # of octets in good frames */ u64 tx_frames;/* all good frames */ @@ -235,6 +241,8 @@ struct link_config { unsigned int speed;/* actual link speed */ unsigned char requested_fc; /* flow control user has requested */ unsigned char fc; /* actual link flow control */ + unsigned char requested_fec;/* Forward Error Correction user */ + unsigned char fec; /* has requested and actual FEC */ unsigned char autoneg; /* autonegotiating? */ unsigned char link_ok; /* link up? */ }; diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 05bf1e8..053a2cd 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -57,7 +57,8 @@ #include "t4_regs_values.h" #include "t4fw_interface.h" -static void init_link_config(struct link_config *lc, unsigned int caps); +static void init_link_config(struct link_config *lc, unsigned int pcaps, +unsigned int acaps); /** * t4_read_mtu_tbl - returns the values in the HW path MTU table @@ -2542,14 +2543,24 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port, struct link_config *lc) { struct fw_port_cmd c; - unsigned int fc = 0, mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO); + unsigned int mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO); + unsigned int fc, fec; lc->link_ok = 0; + fc = 0; if (lc->requested_fc & PAUSE_RX) fc |= FW_PORT_CAP_FC_RX; if (lc->requested_fc & PAUSE_TX) fc |= FW_PORT_CAP_FC_TX; + fec = 0; + if (lc->requested_fec & FEC_RS) + fec |= FW_PORT_CAP_FEC_RS; + if (lc->requested_fec & FEC_BASER_RS) + fec |= FW_PORT_CAP_FEC_BASER_RS; + if (lc->requested_fec & FEC_RESERVED) + fec |= FW_PORT_CAP_FEC_RESERVED; + memset(&c, 0, sizeof(c)); c.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_EXEC | @@ -2560,13 +2571,16 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port, if (!(lc->supported & FW_PORT_CAP_ANEG)) { c.u.l1cfg.rcap = cpu_to_be32((lc->supported & ADVERT_MASK) | -fc); - lc->fc = lc->requested_fc & (PAUSE_RX | PAUSE_TX); +fc | fec); + lc->fc = lc->requested_fc & ~PAUSE_AUTONEG; + lc->fec = lc->requested_fec; } else if (lc->autoneg == AUTONEG_DISABLE) { - c.u.l1cfg.rcap = cpu_to_be32(lc->requested_speed | fc | mdi); - lc->fc = lc->requested_fc & (PAUSE_RX | PAUSE_TX); + c.u.l1cfg.rcap = cpu_to_be32(lc->requested_speed | fc | +fec | mdi); + lc->fc = lc->requested_fc & ~PAUSE_AUTONEG; + lc->fec = lc->requested_fec; } else { - c.u.l1cfg.rcap = cpu_to_be32(lc->advertising | fc | mdi); + c.u.l1cfg.rcap = cpu_to_be32(lc->advertising | fc | fec | mdi); } return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); @@ -3831,19 +3845,37 @@ void t4_reset_link_config(struct adapter *adap, int idx) /** * init_link_config - initialize a link's SW state * @lc: structure holding the link state - * @caps: link capabilities + * @pcaps: link Port Capabilities + * @acaps: link current Advertised Port Capabilities * * Initializes the SW state maintained for each link, including the link's * capabilities and default speed/flow-control/autonegotiation settings. */ -static void init_link_config(struct link_config *lc, -unsigned int caps) +static void init_link_config(struct link_config *lc, unsigned int pcaps, +
[dpdk-dev] [PATCH 03/13] cxgbe: update flash part information
Update flash part identification and decoding to accommodate new flash parts. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/t4_hw.c | 106 +++-- 1 file changed, 81 insertions(+), 25 deletions(-) diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index da28aa0..4ab12ac 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -3863,8 +3863,12 @@ static int t4_wait_dev_ready(struct adapter *adapter) msleep(500); whoami = t4_read_reg(adapter, A_PL_WHOAMI); - return (whoami != 0x && whoami != X_CIM_PF_NOACCESS - ? 0 : -EIO); + if (whoami != 0x && whoami != X_CIM_PF_NOACCESS) + return 0; + + dev_err(adapter, "Device didn't become ready for access, whoami = %#x\n", + whoami); + return -EIO; } struct flash_desc { @@ -3880,47 +3884,96 @@ int t4_get_flash_params(struct adapter *adapter) * sectors. */ static struct flash_desc supported_flash[] = { - { 0x150201, 4 << 20 }, /* Spansion 4MB S25FL032P */ + { 0x00150201, 4 << 20 }, /* Spansion 4MB S25FL032P */ }; int ret; - unsigned int i; - u32 info = 0; - + u32 flashid = 0; + unsigned int part, manufacturer; + unsigned int density, size; + + /** +* Issue a Read ID Command to the Flash part. We decode supported +* Flash parts and their sizes from this. There's a newer Query +* Command which can retrieve detailed geometry information but +* many Flash parts don't support it. +*/ ret = sf1_write(adapter, 1, 1, 0, SF_RD_ID); if (!ret) - ret = sf1_read(adapter, 3, 0, 1, &info); + ret = sf1_read(adapter, 3, 0, 1, &flashid); t4_write_reg(adapter, A_SF_OP, 0); /* unlock SF */ if (ret < 0) return ret; - for (i = 0; i < ARRAY_SIZE(supported_flash); ++i) - if (supported_flash[i].vendor_and_model_id == info) { - adapter->params.sf_size = supported_flash[i].size_mb; + for (part = 0; part < ARRAY_SIZE(supported_flash); part++) { + if (supported_flash[part].vendor_and_model_id == flashid) { + adapter->params.sf_size = + supported_flash[part].size_mb; adapter->params.sf_nsec = adapter->params.sf_size / SF_SEC_SIZE; - return 0; + goto found; } + } - if ((info & 0xff) != 0x20) /* not a Numonix flash */ - return -EINVAL; - info >>= 16; /* log2 of size */ - if (info >= 0x14 && info < 0x18) - adapter->params.sf_nsec = 1 << (info - 16); - else if (info == 0x18) - adapter->params.sf_nsec = 64; - else + manufacturer = flashid & 0xff; + switch (manufacturer) { + case 0x20: { /* Micron/Numonix */ + /** +* This Density -> Size decoding table is taken from Micron +* Data Sheets. +*/ + density = (flashid >> 16) & 0xff; + switch (density) { + case 0x14: + size = 1 << 20; /* 1MB */ + break; + case 0x15: + size = 1 << 21; /* 2MB */ + break; + case 0x16: + size = 1 << 22; /* 4MB */ + break; + case 0x17: + size = 1 << 23; /* 8MB */ + break; + case 0x18: + size = 1 << 24; /* 16MB */ + break; + case 0x19: + size = 1 << 25; /* 32MB */ + break; + case 0x20: + size = 1 << 26; /* 64MB */ + break; + case 0x21: + size = 1 << 27; /* 128MB */ + break; + case 0x22: + size = 1 << 28; /* 256MB */ + break; + default: + dev_err(adapter, "Micron Flash Part has bad size, ID = %#x, Density code = %#x\n", + flashid, density); + return -EINVAL; + } + + adapter->params.sf_size = size; + adapter->params.sf_nsec = size / SF_SEC_SIZE; +
[dpdk-dev] [PATCH 08/13] cxgbe: update TX path for Chelsio T6
Update TX path to reflect Chelsio T6 changes. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/sge.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 2f9e12c..699b577 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -771,7 +771,7 @@ static u64 hwcsum(enum chip_type chip, const struct rte_mbuf *m) } if (likely(csum_type >= TX_CSUM_TCPIP)) { - int hdr_len = V_TXPKT_IPHDR_LEN(m->l3_len); + u64 hdr_len = V_TXPKT_IPHDR_LEN(m->l3_len); int eth_hdr_len = m->l2_len; if (CHELSIO_CHIP_VERSION(chip) <= CHELSIO_T5) @@ -1185,9 +1185,15 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf) else lso->len = htonl(V_LSO_T5_XFER_SIZE(m->pkt_len)); cpl = (void *)(lso + 1); - cntrl = V_TXPKT_CSUM_TYPE(v6 ? TX_CSUM_TCPIP6 : TX_CSUM_TCPIP) | - V_TXPKT_IPHDR_LEN(l3hdr_len) | - V_TXPKT_ETHHDR_LEN(eth_xtra_len); + + if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) + cntrl = V_TXPKT_ETHHDR_LEN(eth_xtra_len); + else + cntrl = V_T6_TXPKT_ETHHDR_LEN(eth_xtra_len); + + cntrl |= V_TXPKT_CSUM_TYPE(v6 ? TX_CSUM_TCPIP6 : + TX_CSUM_TCPIP) | +V_TXPKT_IPHDR_LEN(l3hdr_len); txq->stats.tso++; txq->stats.tx_cso += m->tso_segsz; } -- 2.5.3
[dpdk-dev] [PATCH 07/13] cxgbe: update hardware info prints
Update informational prints pertaining to underlying hardware. Add bootstrap firmware version and expansion ROM version prints. Move the prints to a single function. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/common.h | 6 +- drivers/net/cxgbe/base/t4_hw.c | 150 +++- drivers/net/cxgbe/base/t4_hw.h | 18 - drivers/net/cxgbe/cxgbe_main.c | 25 +++ 4 files changed, 182 insertions(+), 17 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 5db4ca8..dd8da0a 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -216,7 +216,9 @@ struct adapter_params { unsigned int sf_nsec; /* # of flash sectors */ unsigned int fw_vers; + unsigned int bs_vers; unsigned int tp_vers; + unsigned int er_vers; unsigned short mtus[NMTUS]; unsigned short a_wnd[NCCTRL_WIN]; @@ -390,8 +392,8 @@ void t4_get_port_stats_offset(struct adapter *adap, int idx, struct port_stats *offset); void t4_clr_port_stats(struct adapter *adap, int idx); void t4_reset_link_config(struct adapter *adap, int idx); -int t4_get_fw_version(struct adapter *adapter, u32 *vers); -int t4_get_tp_version(struct adapter *adapter, u32 *vers); +int t4_get_version_info(struct adapter *adapter); +void t4_dump_version_info(struct adapter *adapter); int t4_get_flash_params(struct adapter *adapter); int t4_get_chip_type(struct adapter *adap, int ver); int t4_prep_adapter(struct adapter *adapter); diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 053a2cd..787494b 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -2497,32 +2497,178 @@ int t4_read_flash(struct adapter *adapter, unsigned int addr, } /** + * t4_get_exprom_version - return the Expansion ROM version (if any) + * @adapter: the adapter + * @vers: where to place the version + * + * Reads the Expansion ROM header from FLASH and returns the version + * number (if present) through the @vers return value pointer. We return + * this in the Firmware Version Format since it's convenient. Return + * 0 on success, -ENOENT if no Expansion ROM is present. + */ +static int t4_get_exprom_version(struct adapter *adapter, u32 *vers) +{ + struct exprom_header { + unsigned char hdr_arr[16]; /* must start with 0x55aa */ + unsigned char hdr_ver[4]; /* Expansion ROM version */ + } *hdr; + u32 exprom_header_buf[DIV_ROUND_UP(sizeof(struct exprom_header), + sizeof(u32))]; + int ret; + + ret = t4_read_flash(adapter, FLASH_EXP_ROM_START, + ARRAY_SIZE(exprom_header_buf), + exprom_header_buf, 0); + if (ret) + return ret; + + hdr = (struct exprom_header *)exprom_header_buf; + if (hdr->hdr_arr[0] != 0x55 || hdr->hdr_arr[1] != 0xaa) + return -ENOENT; + + *vers = (V_FW_HDR_FW_VER_MAJOR(hdr->hdr_ver[0]) | +V_FW_HDR_FW_VER_MINOR(hdr->hdr_ver[1]) | +V_FW_HDR_FW_VER_MICRO(hdr->hdr_ver[2]) | +V_FW_HDR_FW_VER_BUILD(hdr->hdr_ver[3])); + return 0; +} + +/** * t4_get_fw_version - read the firmware version * @adapter: the adapter * @vers: where to place the version * * Reads the FW version from flash. */ -int t4_get_fw_version(struct adapter *adapter, u32 *vers) +static int t4_get_fw_version(struct adapter *adapter, u32 *vers) { return t4_read_flash(adapter, FLASH_FW_START + offsetof(struct fw_hdr, fw_ver), 1, vers, 0); } /** + * t4_get_bs_version - read the firmware bootstrap version + * @adapter: the adapter + * @vers: where to place the version + * + * Reads the FW Bootstrap version from flash. + */ +static int t4_get_bs_version(struct adapter *adapter, u32 *vers) +{ + return t4_read_flash(adapter, FLASH_FWBOOTSTRAP_START + +offsetof(struct fw_hdr, fw_ver), 1, +vers, 0); +} + +/** * t4_get_tp_version - read the TP microcode version * @adapter: the adapter * @vers: where to place the version * * Reads the TP microcode version from flash. */ -int t4_get_tp_version(struct adapter *adapter, u32 *vers) +static int t4_get_tp_version(struct adapter *adapter, u32 *vers) { return t4_read_flash(adapter, FLASH_FW_START + offsetof(struct fw_hdr, tp_microcode_ver), 1, vers, 0); } +/** + * t4_get_version_info - extract various chip/firmware version information + * @adapter: the adapter + * + * Reads various chip/firmware version numbers and stores them into the + * adapter Adapter Parameters structure. If any of the effo
[dpdk-dev] [PATCH 10/13] cxgbe: update RX path for Chelsio T6
Update RX path to reflect Chelsio T6 register value changes. Update ingress pack boundary value based on maximum payload size that can be accommodated by underlying PCI. Update ingress pad boundary value based on smallest memory controller bus width possible. Enforce alignment for free list pointer start address. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/adapter.h| 4 +- drivers/net/cxgbe/base/common.h | 1 + drivers/net/cxgbe/base/t4_hw.c | 104 +--- drivers/net/cxgbe/base/t4_regs_values.h | 7 ++- drivers/net/cxgbe/sge.c | 48 --- 5 files changed, 117 insertions(+), 47 deletions(-) diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 2680790..cc89e49 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2014-2016 Chelsio Communications. + * Copyright(c) 2014-2017 Chelsio Communications. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -459,7 +459,9 @@ static inline void t4_write_reg64(struct adapter *adapter, u32 reg_addr, #define PCI_CAP_ID_EXP 0x10/* PCI Express */ #define PCI_CAP_LIST_ID 0 /* Capability ID */ #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ +#define PCI_EXP_DEVCTL 0x0008 /* Device control */ #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00E0 /* Max payload */ #define PCI_CAP_ID_VPD 0x03/* Vital Product Data */ #define PCI_VPD_ADDR2 /* Address to access (15 bits!) */ #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 9383628..5765bf3 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -282,6 +282,7 @@ int t4_fw_bye(struct adapter *adap, unsigned int mbox); int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); int t4_fw_halt(struct adapter *adap, unsigned int mbox, int reset); int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset); +int t4_fl_pkt_align(struct adapter *adap); int t4_fixup_host_params_compat(struct adapter *adap, unsigned int page_size, unsigned int cache_line_size, enum chip_type chip_compat); diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 4e1545a..96d4bfd 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -3358,6 +3358,49 @@ int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset) } /** + * t4_fl_pkt_align - return the fl packet alignment + * @adap: the adapter + * + * T4 has a single field to specify the packing and padding boundary. + * T5 onwards has separate fields for this and hence the alignment for + * next packet offset is maximum of these two. + */ +int t4_fl_pkt_align(struct adapter *adap) +{ + u32 sge_control, sge_control2; + unsigned int ingpadboundary, ingpackboundary, fl_align, ingpad_shift; + + sge_control = t4_read_reg(adap, A_SGE_CONTROL); + + /* T4 uses a single control field to specify both the PCIe Padding and +* Packing Boundary. T5 introduced the ability to specify these +* separately. The actual Ingress Packet Data alignment boundary +* within Packed Buffer Mode is the maximum of these two +* specifications. +*/ + if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) + ingpad_shift = X_INGPADBOUNDARY_SHIFT; + else + ingpad_shift = X_T6_INGPADBOUNDARY_SHIFT; + + ingpadboundary = 1 << (G_INGPADBOUNDARY(sge_control) + ingpad_shift); + + fl_align = ingpadboundary; + if (!is_t4(adap->params.chip)) { + sge_control2 = t4_read_reg(adap, A_SGE_CONTROL2); + ingpackboundary = G_INGPACKBOUNDARY(sge_control2); + if (ingpackboundary == X_INGPACKBOUNDARY_16B) + ingpackboundary = 16; + else + ingpackboundary = 1 << (ingpackboundary + + X_INGPACKBOUNDARY_SHIFT); + + fl_align = max(ingpadboundary, ingpackboundary); + } + return fl_align; +} + +/** * t4_fixup_host_params_compat - fix up host-dependent parameters * @adap: the adapter * @page_size: the host's Base Page Size @@ -3402,6 +3445,10 @@ int t4_fixup_host_params_compat(struct adapter *adap, X_INGPADBOUNDARY_SHIFT) | V_EGRSTATUSPAGESIZE(stat_len != 64)); else { + unsigned int pack_align; +
[dpdk-dev] [PATCH 09/13] cxgbe: update RXQ channel mapping for Chelsio T6
Update MPS buffer groups and TP ingress channel congestion map to correct RXQ allocation for Chelsio T6. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/common.h | 3 +- drivers/net/cxgbe/base/t4_hw.c | 85 drivers/net/cxgbe/cxgbe_ethdev.c | 4 +- 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index dd8da0a..9383628 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -384,7 +384,8 @@ int t4_get_vpd_params(struct adapter *adapter, struct vpd_params *p); int t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented); int t4_flash_cfg_addr(struct adapter *adapter); -unsigned int t4_get_mps_bg_map(struct adapter *adapter, int idx); +unsigned int t4_get_mps_bg_map(struct adapter *adapter, unsigned int pidx); +unsigned int t4_get_tp_ch_map(struct adapter *adapter, unsigned int pidx); const char *t4_get_port_type_description(enum fw_port_type port_type); void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); void t4_get_port_stats_offset(struct adapter *adap, int idx, diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 787494b..4e1545a 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -2844,21 +2844,90 @@ const char *t4_get_port_type_description(enum fw_port_type port_type) /** * t4_get_mps_bg_map - return the buffer groups associated with a port * @adap: the adapter - * @idx: the port index + * @pidx: the port index * * Returns a bitmap indicating which MPS buffer groups are associated * with the given port. Bit i is set if buffer group i is used by the * port. */ -unsigned int t4_get_mps_bg_map(struct adapter *adap, int idx) +unsigned int t4_get_mps_bg_map(struct adapter *adap, unsigned int pidx) +{ + unsigned int chip_version = CHELSIO_CHIP_VERSION(adap->params.chip); + unsigned int nports = 1 << G_NUMPORTS(t4_read_reg(adap, + A_MPS_CMN_CTL)); + + if (pidx >= nports) { + dev_warn(adap, "MPS Port Index %d >= Nports %d\n", +pidx, nports); + return 0; + } + + switch (chip_version) { + case CHELSIO_T4: + case CHELSIO_T5: + switch (nports) { + case 1: return 0xf; + case 2: return 3 << (2 * pidx); + case 4: return 1 << pidx; + } + break; + + case CHELSIO_T6: + switch (nports) { + case 2: return 1 << (2 * pidx); + } + break; + } + + dev_err(adap, "Need MPS Buffer Group Map for Chip %0x, Nports %d\n", + chip_version, nports); + return 0; +} + +/** + * t4_get_tp_ch_map - return TP ingress channels associated with a port + * @adapter: the adapter + * @pidx: the port index + * + * Returns a bitmap indicating which TP Ingress Channels are associated with + * a given Port. Bit i is set if TP Ingress Channel i is used by the Port. + */ +unsigned int t4_get_tp_ch_map(struct adapter *adapter, unsigned int pidx) { - u32 n = G_NUMPORTS(t4_read_reg(adap, A_MPS_CMN_CTL)); + unsigned int chip_version = CHELSIO_CHIP_VERSION(adapter->params.chip); + unsigned int nports = 1 << G_NUMPORTS(t4_read_reg(adapter, + A_MPS_CMN_CTL)); + + if (pidx >= nports) { + dev_warn(adap, "TP Port Index %d >= Nports %d\n", +pidx, nports); + return 0; + } + + switch (chip_version) { + case CHELSIO_T4: + case CHELSIO_T5: + /* Note that this happens to be the same values as the MPS +* Buffer Group Map for these Chips. But we replicate the code +* here because they're really separate concepts. +*/ + switch (nports) { + case 1: return 0xf; + case 2: return 3 << (2 * pidx); + case 4: return 1 << pidx; + } + break; + + case CHELSIO_T6: + switch (nports) { + case 2: return 1 << pidx; + } + break; + } - if (n == 0) - return idx == 0 ? 0xf : 0; - if (n == 1) - return idx < 2 ? (3 << (2 * idx)) : 0; - return 1 << idx; + dev_err(adapter, "Need TP Channel Map for Chip %0x, Nports %d\n", + chip_version, nports); + return 0; } /** diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgb
[dpdk-dev] [PATCH 11/13] cxgbe: add compressed error vector
Add support for compressed error vector available in cpl_rx_pkt for Chelsio T6. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/common.h | 5 + drivers/net/cxgbe/base/t4_hw.c | 8 drivers/net/cxgbe/base/t4_msg.h | 16 +++- drivers/net/cxgbe/base/t4_regs.h | 6 ++ drivers/net/cxgbe/sge.c | 21 +++-- 5 files changed, 53 insertions(+), 3 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 5765bf3..1eda57d 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -157,6 +157,11 @@ struct tp_params { u32 vlan_pri_map; /* cached TP_VLAN_PRI_MAP */ u32 ingress_config; /* cached TP_INGRESS_CONFIG */ + /* cached TP_OUT_CONFIG compressed error vector +* and passing outer header info for encapsulated packets. +*/ + int rx_pkt_encap; + /* * TP_VLAN_PRI_MAP Compressed Filter Tuple field offsets. This is a * subset of the set of fields which may be present in the Compressed diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 96d4bfd..94abd5b 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -4594,6 +4594,14 @@ int t4_init_tp_params(struct adapter *adap) &adap->params.tp.ingress_config, 1, A_TP_INGRESS_CONFIG); + /* For T6, cache the adapter's compressed error vector +* and passing outer header info for encapsulated packets. +*/ + if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) { + v = t4_read_reg(adap, A_TP_OUT_CONFIG); + adap->params.tp.rx_pkt_encap = (v & F_CRXPKTENC) ? 1 : 0; + } + /* * Now that we have TP_VLAN_PRI_MAP cached, we can calculate the field * shift positions of several elements of the Compressed Filter Tuple diff --git a/drivers/net/cxgbe/base/t4_msg.h b/drivers/net/cxgbe/base/t4_msg.h index 4b04cd0..6acd749 100644 --- a/drivers/net/cxgbe/base/t4_msg.h +++ b/drivers/net/cxgbe/base/t4_msg.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2014-2015 Chelsio Communications. + * Copyright(c) 2014-2017 Chelsio Communications. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -262,6 +262,20 @@ struct cpl_rx_pkt { #define V_RXF_IP6(x) ((x) << S_RXF_IP6) #define F_RXF_IP6V_RXF_IP6(1U) +/* rx_pkt.err_vec fields */ +/* In T6, rx_pkt.err_vec indicates + * RxError Error vector (16b) or + * Encapsulating header length (8b), + * Outer encapsulation type (2b) and + * compressed error vector (6b) if CRxPktEnc is + * enabled in TP_OUT_CONFIG + */ +#define S_T6_COMPR_RXERR_VEC0 +#define M_T6_COMPR_RXERR_VEC0x3F +#define V_T6_COMPR_RXERR_VEC(x) ((x) << S_T6_COMPR_RXERR_VEC) +#define G_T6_COMPR_RXERR_VEC(x) \ + (((x) >> S_T6_COMPR_RXERR_VEC) & M_T6_COMPR_RXERR_VEC) + /* cpl_fw*.type values */ enum { FW_TYPE_RSSCPL = 4, diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h index eb23614..8dc1f58 100644 --- a/drivers/net/cxgbe/base/t4_regs.h +++ b/drivers/net/cxgbe/base/t4_regs.h @@ -443,6 +443,12 @@ #define F_UPCRSTV_UPCRST(1U) /* registers for module TP */ +#define A_TP_OUT_CONFIG 0x7d04 + +#define S_CRXPKTENC3 +#define V_CRXPKTENC(x) ((x) << S_CRXPKTENC) +#define F_CRXPKTENCV_CRXPKTENC(1U) + #define TP_BASE_ADDR 0x7d00 #define A_TP_TIMER_RESOLUTION 0x7d90 diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index b16a0bf..020879a 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -1352,10 +1352,16 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, const struct rss_header *rss_hdr; bool csum_ok; struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); + u16 err_vec; rss_hdr = (const void *)rsp; pkt = (const void *)&rsp[1]; - csum_ok = pkt->csum_calc && !pkt->err_vec; + /* Compressed error vector is enabled for T6 only */ + if (q->adapter->params.tp.rx_pkt_encap) + err_vec = G_T6_COMPR_RXERR_VEC(ntohs(pkt->err_vec)); + else + err_vec = ntohs(pkt->err_vec); + csum_ok = pkt->csum_calc && !err_vec; mbuf = t4_pktgl_to_mbuf(si); if (unlikely(!mbuf)) { @@ -1466,9 +1472,10 @@ static int process_responses(struct sge_rspq *q, int budget, (const void *)q->cur_desc; const struct cpl_rx_pkt *cpl = (const void *)&q->cur_desc[1]; - bool csum_ok = cpl->csum_calc &a
[dpdk-dev] [PATCH 12/13] cxgbe: fix port statistics
Do not count pause frames as part of normal TX/RX Frame/Byte counts. Also, switch to using software counters rather than hardware for RX stats. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/t4_hw.c | 20 drivers/net/cxgbe/base/t4_regs.h | 18 ++ drivers/net/cxgbe/cxgbe_ethdev.c | 4 ++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 94abd5b..83a542d 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -2941,6 +2941,7 @@ unsigned int t4_get_tp_ch_map(struct adapter *adapter, unsigned int pidx) void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { u32 bgmap = t4_get_mps_bg_map(adap, idx); + u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -2973,6 +2974,15 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) p->tx_ppp6 = GET_STAT(TX_PORT_PPP6); p->tx_ppp7 = GET_STAT(TX_PORT_PPP7); + if (CHELSIO_CHIP_VERSION(adap->params.chip) >= CHELSIO_T5) { + if (stat_ctl & F_COUNTPAUSESTATTX) { + p->tx_frames -= p->tx_pause; + p->tx_octets -= p->tx_pause * 64; + } + if (stat_ctl & F_COUNTPAUSEMCTX) + p->tx_mcast_frames -= p->tx_pause; + } + p->rx_octets = GET_STAT(RX_PORT_BYTES); p->rx_frames = GET_STAT(RX_PORT_FRAMES); p->rx_bcast_frames = GET_STAT(RX_PORT_BCAST); @@ -3000,6 +3010,16 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) p->rx_ppp5 = GET_STAT(RX_PORT_PPP5); p->rx_ppp6 = GET_STAT(RX_PORT_PPP6); p->rx_ppp7 = GET_STAT(RX_PORT_PPP7); + + if (CHELSIO_CHIP_VERSION(adap->params.chip) >= CHELSIO_T5) { + if (stat_ctl & F_COUNTPAUSESTATRX) { + p->rx_frames -= p->rx_pause; + p->rx_octets -= p->rx_pause * 64; + } + if (stat_ctl & F_COUNTPAUSEMCRX) + p->rx_mcast_frames -= p->rx_pause; + } + p->rx_ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_MAC_DROP_FRAME) : 0; p->rx_ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_MAC_DROP_FRAME) : 0; p->rx_ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_MAC_DROP_FRAME) : 0; diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h index 8dc1f58..289c7e4 100644 --- a/drivers/net/cxgbe/base/t4_regs.h +++ b/drivers/net/cxgbe/base/t4_regs.h @@ -559,6 +559,24 @@ #define V_VF(x) ((x) << S_VF) #define G_VF(x) (((x) >> S_VF) & M_VF) +#define A_MPS_STAT_CTL 0x9600 + +#define S_COUNTPAUSEMCRX5 +#define V_COUNTPAUSEMCRX(x) ((x) << S_COUNTPAUSEMCRX) +#define F_COUNTPAUSEMCRXV_COUNTPAUSEMCRX(1U) + +#define S_COUNTPAUSESTATRX4 +#define V_COUNTPAUSESTATRX(x) ((x) << S_COUNTPAUSESTATRX) +#define F_COUNTPAUSESTATRXV_COUNTPAUSESTATRX(1U) + +#define S_COUNTPAUSEMCTX3 +#define V_COUNTPAUSEMCTX(x) ((x) << S_COUNTPAUSEMCTX) +#define F_COUNTPAUSEMCTXV_COUNTPAUSEMCTX(1U) + +#define S_COUNTPAUSESTATTX2 +#define V_COUNTPAUSESTATTX(x) ((x) << S_COUNTPAUSESTATTX) +#define F_COUNTPAUSESTATTXV_COUNTPAUSESTATTX(1U) + #define A_MPS_PORT_STAT_TX_PORT_BYTES_L 0x400 #define A_MPS_PORT_STAT_TX_PORT_BYTES_H 0x404 #define A_MPS_PORT_STAT_TX_PORT_FRAMES_L 0x408 diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index e51becb..03fc15e 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -657,8 +657,6 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, cxgbe_stats_get(pi, &ps); /* RX Stats */ - eth_stats->ipackets = ps.rx_frames; - eth_stats->ibytes = ps.rx_octets; eth_stats->imissed = ps.rx_ovflow0 + ps.rx_ovflow1 + ps.rx_ovflow2 + ps.rx_ovflow3 + ps.rx_trunc0 + ps.rx_trunc1 + @@ -678,6 +676,8 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev, eth_stats->q_ipackets[i] = rxq->stats.pkts; eth_stats->q_ibytes[i] = rxq->stats.rx_bytes; + eth_stats->ipackets += eth_stats->q_ipackets[i]; + eth_stats->ibytes += eth_stats->q_ibytes[i]; } for (i = 0; i < pi->n_tx_qsets; i++) { -- 2.5.3
[dpdk-dev] [PATCH 13/13] cxgbe: remove RTE_PCI_DRV_INTR_LSC from driver flags
Remove RTE_PCI_DRV_INTR_LSC from driver flags, since LSC interrupts are currently not supported. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 03fc15e..ac70f22 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1054,7 +1054,7 @@ static int eth_cxgbe_pci_remove(struct rte_pci_device *pci_dev) static struct rte_pci_driver rte_cxgbe_pmd = { .id_table = cxgb4_pci_tbl, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, .probe = eth_cxgbe_pci_probe, .remove = eth_cxgbe_pci_remove, }; -- 2.5.3
[dpdk-dev] [PATCH 0/4] cxgbe: latency and performance fixes
This series of patches rework TX and RX path to reduce latency and improve performance. Patch 1 reduces latency for slow traffic by using status page update on RX path to process batch of packets and improves coalesce TX path to handle slow moving traffic. Patch 2 fixes an issue with RXQ default parameters not being applied to all ports under same PF. Patch 3 fixes rmb bottleneck in RX path. Patch 4 adds ability to configure PCIe extended tags. This series depend on following series: "cxgbe: add support for Chelsio T6 family of adapters" Thanks, Rahul Rahul Lakkireddy (4): cxgbe: improve latency for slow traffic cxgbe: fix rxq default params for ports under same PF cxgbe: remove rmb bottleneck in RX path cxgbe: configure PCIe extended tags config/common_base | 3 +- doc/guides/nics/cxgbe.rst | 4 + doc/guides/rel_notes/release_17_08.rst | 5 + drivers/net/cxgbe/base/adapter.h| 5 +- drivers/net/cxgbe/base/t4_regs.h| 20 +++ drivers/net/cxgbe/base/t4_regs_values.h | 2 +- drivers/net/cxgbe/base/t4fw_interface.h | 8 + drivers/net/cxgbe/cxgbe.h | 3 +- drivers/net/cxgbe/cxgbe_compat.h| 11 +- drivers/net/cxgbe/cxgbe_ethdev.c| 5 +- drivers/net/cxgbe/cxgbe_main.c | 69 +--- drivers/net/cxgbe/sge.c | 270 ++-- 12 files changed, 255 insertions(+), 150 deletions(-) -- 2.5.3
[dpdk-dev] [PATCH 1/4] cxgbe: improve latency for slow traffic
TX coalescing waits for ETH_COALESCE_PKT_NUM packets to be coalesced across bursts before transmitting them. For slow traffic, such as 100 PPS, this approach increases latency since packets are received one at a time and tx coalescing has to wait for ETH_COALESCE_PKT number of packets to arrive before transmitting. To fix this: - Update rx path to use status page instead and only receive packets when either the ingress interrupt timer threshold (5 us) or the ingress interrupt packet count threshold (32 packets) fires. (i.e. whichever happens first). - If number of packets coalesced is <= number of packets sent by tx burst function, stop coalescing and transmit these packets immediately. Also added compile time option to favor throughput over latency by default. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- config/common_base | 3 +- doc/guides/nics/cxgbe.rst | 4 ++ doc/guides/rel_notes/release_17_08.rst | 5 ++ drivers/net/cxgbe/base/adapter.h| 4 +- drivers/net/cxgbe/base/t4_regs_values.h | 2 +- drivers/net/cxgbe/base/t4fw_interface.h | 8 +++ drivers/net/cxgbe/cxgbe_compat.h| 11 +++- drivers/net/cxgbe/cxgbe_ethdev.c| 3 +- drivers/net/cxgbe/cxgbe_main.c | 5 +- drivers/net/cxgbe/sge.c | 109 10 files changed, 92 insertions(+), 62 deletions(-) diff --git a/config/common_base b/config/common_base index 67ef2ec..b2a6ff6 100644 --- a/config/common_base +++ b/config/common_base @@ -240,7 +240,7 @@ CONFIG_RTE_LIBRTE_BNX2X_MF_SUPPORT=n CONFIG_RTE_LIBRTE_BNX2X_DEBUG_PERIODIC=n # -# Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD +# Compile burst-oriented Chelsio Terminator (CXGBE) PMD # CONFIG_RTE_LIBRTE_CXGBE_PMD=y CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n @@ -248,6 +248,7 @@ CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n +CONFIG_RTE_LIBRTE_CXGBE_TPUT=y # # Compile burst-oriented Cisco ENIC PMD driver diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst index 176c189..8651a7b 100644 --- a/doc/guides/nics/cxgbe.rst +++ b/doc/guides/nics/cxgbe.rst @@ -130,6 +130,10 @@ enabling debugging options may affect system performance. Toggle display of receiving data path run-time check messages. +- ``CONFIG_RTE_LIBRTE_CXGBE_TPUT`` (default **y**) + + Toggle behaviour to prefer Throughput or Latency. + .. _driver-compilation: Driver compilation and testing diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst index 39a3398..bd4ea2c 100644 --- a/doc/guides/rel_notes/release_17_08.rst +++ b/doc/guides/rel_notes/release_17_08.rst @@ -79,6 +79,11 @@ EAL Drivers ~~~ +* **net/cxgbe: latency and performance improvements** + + TX and RX path reworked to improve performance. Also reduced latency + for slow traffic. + Libraries ~ diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index cc89e49..58c6903 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -148,6 +148,7 @@ struct sge_rspq { /* state for an SGE response queue */ void __iomem *bar2_addr;/* address of BAR2 Queue registers */ unsigned int bar2_qid; /* Queue ID for BAR2 Queue registers */ + struct sge_qstat *stat; unsigned int cidx; /* consumer index */ unsigned int gts_idx; /* last gts write sent */ @@ -708,7 +709,8 @@ void reclaim_completed_tx(struct sge_txq *q); void t4_free_sge_resources(struct adapter *adap); void t4_sge_tx_monitor_start(struct adapter *adap); void t4_sge_tx_monitor_stop(struct adapter *adap); -int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf); +int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, + uint16_t nb_pkts); int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, const struct pkt_gl *gl); int t4_sge_init(struct adapter *adap); diff --git a/drivers/net/cxgbe/base/t4_regs_values.h b/drivers/net/cxgbe/base/t4_regs_values.h index 1326594..9085ff6d 100644 --- a/drivers/net/cxgbe/base/t4_regs_values.h +++ b/drivers/net/cxgbe/base/t4_regs_values.h @@ -82,7 +82,7 @@ /* * Ingress Context field values */ -#define X_UPDATEDELIVERY_INTERRUPT 1 +#define X_UPDATEDELIVERY_STATUS_PAGE 2 #define X_RSPD_TYPE_FLBUF 0 #define X_RSPD_TYPE_CPL1 diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h index fcc61bf..6283fe9 100644 --- a/drivers/net/cxgbe/base/t4fw_interface.h +++ b/drivers/net/cxgbe/base/t4fw_interface.h @@ -84,6 +84,7 @@ enum fw_memtype { enum fw_wr_opcodes { FW_ETH_TX_PKT_WR= 0x08, FW_ETH_TX_PKTS_WR = 0
[dpdk-dev] [PATCH 2/4] cxgbe: fix rxq default params for ports under same PF
Enabling rx queues with default interrupt parameters doesn't happen for other ports under same PF due to FULL_INIT_DONE flag being set by the first port. Fix is to to allow each port to enable its own rx queues with default parameters. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/cxgbe.h| 3 ++- drivers/net/cxgbe/cxgbe_ethdev.c | 2 ++ drivers/net/cxgbe/cxgbe_main.c | 33 +++-- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h index 0201c99..9120c43 100644 --- a/drivers/net/cxgbe/cxgbe.h +++ b/drivers/net/cxgbe/cxgbe.h @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2014-2015 Chelsio Communications. + * Copyright(c) 2014-2017 Chelsio Communications. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,5 +59,6 @@ int setup_sge_fwevtq(struct adapter *adapter); void cfg_queues(struct rte_eth_dev *eth_dev); int cfg_queue_count(struct rte_eth_dev *eth_dev); int setup_rss(struct port_info *pi); +void cxgbe_enable_rx_queues(struct port_info *pi); #endif /* _CXGBE_H_ */ diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 7282575..ade0b11 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -339,6 +339,8 @@ static int cxgbe_dev_start(struct rte_eth_dev *eth_dev) goto out; } + cxgbe_enable_rx_queues(pi); + err = setup_rss(pi); if (err) goto out; diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index 2522354..4d95f5d 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -984,33 +984,22 @@ int setup_rss(struct port_info *pi) /* * Enable NAPI scheduling and interrupt generation for all Rx queues. */ -static void enable_rx(struct adapter *adap) +static void enable_rx(struct adapter *adap, struct sge_rspq *q) { - struct sge *s = &adap->sge; - struct sge_rspq *q = &s->fw_evtq; - int i, j; - /* 0-increment GTS to start the timer and enable interrupts */ t4_write_reg(adap, MYPF_REG(A_SGE_PF_GTS), V_SEINTARM(q->intr_params) | V_INGRESSQID(q->cntxt_id)); +} - for_each_port(adap, i) { - const struct port_info *pi = &adap->port[i]; - struct rte_eth_dev *eth_dev = pi->eth_dev; - - for (j = 0; j < eth_dev->data->nb_rx_queues; j++) { - q = eth_dev->data->rx_queues[j]; - - /* -* 0-increment GTS to start the timer and enable -* interrupts -*/ - t4_write_reg(adap, MYPF_REG(A_SGE_PF_GTS), -V_SEINTARM(q->intr_params) | -V_INGRESSQID(q->cntxt_id)); - } - } +void cxgbe_enable_rx_queues(struct port_info *pi) +{ + struct adapter *adap = pi->adapter; + struct sge *s = &adap->sge; + unsigned int i; + + for (i = 0; i < pi->n_rx_qsets; i++) + enable_rx(adap, &s->ethrxq[pi->first_qset + i].rspq); } /** @@ -1023,7 +1012,7 @@ static void enable_rx(struct adapter *adap) */ int cxgbe_up(struct adapter *adap) { - enable_rx(adap); + enable_rx(adap, &adap->sge.fw_evtq); t4_sge_tx_monitor_start(adap); t4_intr_enable(adap); adap->flags |= FULL_INIT_DONE; -- 2.5.3
[dpdk-dev] [PATCH 3/4] cxgbe: remove rmb bottleneck in RX path
rmb before determining rsp_type is a bottleneck. Once we determine rsp-type is FL, we can directly go ahead and read packets based on q->stat->pidx and budget_left. This removes bottleneck of rmb once per every RX packet. Now, rmb exists once per RX batch. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/sge.c | 161 +--- 1 file changed, 96 insertions(+), 65 deletions(-) diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index d98c3f6..9cbd4ec 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -683,6 +683,10 @@ static void write_sgl(struct rte_mbuf *mbuf, struct sge_txq *q, #define Q_IDXDIFF(q, idx) IDXDIFF((q)->pidx, (q)->idx, (q)->size) #define R_IDXDIFF(q, idx) IDXDIFF((q)->cidx, (q)->idx, (q)->size) +#define PIDXDIFF(head, tail, wrap) \ + ((tail) >= (head) ? (tail) - (head) : (wrap) - (head) + (tail)) +#define P_IDXDIFF(q, idx) PIDXDIFF((q)->cidx, idx, (q)->size) + /** * ring_tx_db - ring a Tx queue's doorbell * @adap: the adapter @@ -1461,74 +1465,101 @@ static int process_responses(struct sge_rspq *q, int budget, rsp_type = G_RSPD_TYPE(rc->u.type_gen); if (likely(rsp_type == X_RSPD_TYPE_FLBUF)) { - const struct rx_sw_desc *rsd = - &rxq->fl.sdesc[rxq->fl.cidx]; - const struct rss_header *rss_hdr = - (const void *)q->cur_desc; - const struct cpl_rx_pkt *cpl = - (const void *)&q->cur_desc[1]; - struct rte_mbuf *pkt, *npkt; - u32 len, bufsz; - bool csum_ok; - u16 err_vec; - - len = ntohl(rc->pldbuflen_qid); - BUG_ON(!(len & F_RSPD_NEWBUF)); - pkt = rsd->buf; - npkt = pkt; - len = G_RSPD_LEN(len); - pkt->pkt_len = len; - - /* Compressed error vector is enabled for -* T6 only -*/ - if (q->adapter->params.tp.rx_pkt_encap) - err_vec = G_T6_COMPR_RXERR_VEC( - ntohs(cpl->err_vec)); - else - err_vec = ntohs(cpl->err_vec); - csum_ok = cpl->csum_calc && !err_vec; - - /* Chain mbufs into len if necessary */ - while (len) { - struct rte_mbuf *new_pkt = rsd->buf; - - bufsz = min(get_buf_size(q->adapter, rsd), len); - new_pkt->data_len = bufsz; - unmap_rx_buf(&rxq->fl); - len -= bufsz; - npkt->next = new_pkt; - npkt = new_pkt; - pkt->nb_segs++; - rsd = &rxq->fl.sdesc[rxq->fl.cidx]; - } - npkt->next = NULL; - pkt->nb_segs--; - - if (cpl->l2info & htonl(F_RXF_IP)) { - pkt->packet_type = RTE_PTYPE_L3_IPV4; - if (unlikely(!csum_ok)) - pkt->ol_flags |= PKT_RX_IP_CKSUM_BAD; - - if ((cpl->l2info & -htonl(F_RXF_UDP | F_RXF_TCP)) && !csum_ok) - pkt->ol_flags |= PKT_RX_L4_CKSUM_BAD; - } else if (cpl->l2info & htonl(F_RXF_IP6)) { - pkt->packet_type = RTE_PTYPE_L3_IPV6; - } + unsigned int stat_pidx; + int stat_pidx_diff; + + stat_pidx = ntohs(q->stat->pidx); + stat_pidx_diff = P_IDXDIFF(q, stat_pidx); + while (stat_pidx_diff && budget_left) { + const struct rx_sw_desc *rsd = + &rxq->fl.sdesc[rxq->fl.cidx]; + const struct rss_header *rss_hdr = + (const void *)q->cur_desc; + const struct cpl_rx_pkt *cpl = + (const void *)&q->cur_desc[1]; + struct rte_mbuf *pkt, *npkt; + u32 le
[dpdk-dev] [PATCH 4/4] cxgbe: configure PCIe extended tags
Add support to configure minimum and maximum PCIe extended tag. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/base/t4_regs.h | 20 drivers/net/cxgbe/cxgbe_main.c | 31 +++ 3 files changed, 52 insertions(+) diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 58c6903..5e5f221 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -462,6 +462,7 @@ static inline void t4_write_reg64(struct adapter *adapter, u32 reg_addr, #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ #define PCI_EXP_DEVCTL 0x0008 /* Device control */ #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ +#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ #define PCI_EXP_DEVCTL_PAYLOAD 0x00E0 /* Max payload */ #define PCI_CAP_ID_VPD 0x03/* Vital Product Data */ #define PCI_VPD_ADDR2 /* Address to access (15 bits!) */ diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h index 289c7e4..1100e16 100644 --- a/drivers/net/cxgbe/base/t4_regs.h +++ b/drivers/net/cxgbe/base/t4_regs.h @@ -420,6 +420,26 @@ #define A_PCIE_FW 0x30b8 #define A_PCIE_FW_PF 0x30bc +#define A_PCIE_CFG2 0x3018 + +#define S_TOTMAXTAG0 +#define M_TOTMAXTAG0x3U +#define V_TOTMAXTAG(x) ((x) << S_TOTMAXTAG) + +#define S_T6_TOTMAXTAG0 +#define M_T6_TOTMAXTAG0x7U +#define V_T6_TOTMAXTAG(x) ((x) << S_T6_TOTMAXTAG) + +#define A_PCIE_CMD_CFG 0x5980 + +#define S_MINTAG 0 +#define M_MINTAG 0xffU +#define V_MINTAG(x)((x) << S_MINTAG) + +#define S_T6_MINTAG0 +#define M_T6_MINTAG0xffU +#define V_T6_MINTAG(x) ((x) << S_T6_MINTAG) + /* registers for module CIM */ #define CIM_BASE_ADDR 0x7b00 diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index 4d95f5d..ac5b48f 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -414,6 +414,36 @@ static void print_port_info(struct adapter *adap) } } +static void configure_pcie_ext_tag(struct adapter *adapter) +{ + u16 v; + int pos = t4_os_find_pci_capability(adapter, PCI_CAP_ID_EXP); + + if (!pos) + return; + + if (pos > 0) { + t4_os_pci_read_cfg2(adapter, pos + PCI_EXP_DEVCTL, &v); + v |= PCI_EXP_DEVCTL_EXT_TAG; + t4_os_pci_write_cfg2(adapter, pos + PCI_EXP_DEVCTL, v); + if (is_t6(adapter->params.chip)) { + t4_set_reg_field(adapter, A_PCIE_CFG2, +V_T6_TOTMAXTAG(M_T6_TOTMAXTAG), +V_T6_TOTMAXTAG(7)); + t4_set_reg_field(adapter, A_PCIE_CMD_CFG, +V_T6_MINTAG(M_T6_MINTAG), +V_T6_MINTAG(8)); + } else { + t4_set_reg_field(adapter, A_PCIE_CFG2, +V_TOTMAXTAG(M_TOTMAXTAG), +V_TOTMAXTAG(3)); + t4_set_reg_field(adapter, A_PCIE_CMD_CFG, +V_MINTAG(M_MINTAG), +V_MINTAG(8)); + } + } +} + /* * Tweak configuration based on system architecture, etc. Most of these have * defaults assigned to them by Firmware Configuration Files (if we're using @@ -799,6 +829,7 @@ static int adap_init0(struct adapter *adap) } t4_init_sge_params(adap); t4_init_tp_params(adap); + configure_pcie_ext_tag(adap); adap->params.drv_memwin = MEMWIN_NIC; adap->flags |= FW_OK; -- 2.5.3
Re: [dpdk-dev] [PATCH 00/13] cxgbe: add support for Chelsio T6 family of adapters
On Tuesday, May 05/30/17, 2017 at 15:58:56 +0530, Thomas Monjalon wrote: >27/05/2017 05:46, Rahul Lakkireddy: >> This series of patches add support for Chelsio T6 family of adapters. > >It is almost one year since your last contribution, >welcome back Rahul :) > Can't believe it's been a year already. Feels great to be back! :) >During that time, rte_flow has been implemented in DPDK. >Do you plan to use it for Chelsio offloads, instead of flow director? Yes, we do have plans to use rte_flow for our packet classification and filtering instead of flow director. Thanks, Rahul
[dpdk-dev] [PATCH] cxgbe: fix alignment for data offset in mbufs
Fixup alignment for data offset when refilling mbufs. Fixes: edd04c619685 ("net/cxgbe: update Rx path for Chelsio T6") Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/sge.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index d088065..4e4a462 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -415,7 +415,11 @@ static unsigned int refill_fl_usembufs(struct adapter *adap, struct sge_fl *q, } rte_mbuf_refcnt_set(mbuf, 1); - mbuf->data_off = RTE_PKTMBUF_HEADROOM; + mbuf->data_off = + (uint16_t)(RTE_PTR_ALIGN((char *)mbuf->buf_addr + +RTE_PKTMBUF_HEADROOM, +adap->sge.fl_align) - + (char *)mbuf->buf_addr); mbuf->next = NULL; mbuf->nb_segs = 1; mbuf->port = rxq->rspq.port_id; -- 2.5.3
Re: [dpdk-dev] [PATCH v3] cxgbe: report 100G link speed capability for Chelsio T6 adapters
Hi Martin, On Thursday, June 06/22/17, 2017 at 15:37:27 +0530, Martin Weiser wrote: >These adapters support 100G link speed but the speed_capa bitmask in the >device info did not reflect that. > >Signed-off-by: Martin Weiser >--- > drivers/net/cxgbe/cxgbe_ethdev.c | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c >b/drivers/net/cxgbe/cxgbe_ethdev.c >index b622d25..1e56529 100644 >--- a/drivers/net/cxgbe/cxgbe_ethdev.c >+++ b/drivers/net/cxgbe/cxgbe_ethdev.c >@@ -176,6 +176,9 @@ static void cxgbe_dev_info_get(struct rte_eth_dev >*eth_dev, > device_info->rx_desc_lim = cxgbe_desc_lim; > device_info->tx_desc_lim = cxgbe_desc_lim; > device_info->speed_capa = ETH_LINK_SPEED_10G | >ETH_LINK_SPEED_40G; >+ >+ if (CHELSIO_CHIP_VERSION(adapter->params.chip) == CHELSIO_T6) >+ device_info->speed_capa |= ETH_LINK_SPEED_100G; > } > > static void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) >-- >2.7.4 Thanks for the patch. However, not all Chelsio T6 adapters support 10G/40G/100G link speeds at the same time. I have a patch to report the supported link speeds correctly and is currently undergoing testing. I will submit the patch very soon. Thanks, Rahul
[dpdk-dev] [PATCH 2/2] cxgbe: fix supported speed capabilities
Use port type to determine the supported speed capabilities. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- doc/guides/nics/features/cxgbe.ini | 2 +- drivers/net/cxgbe/cxgbe.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_main.c | 104 + 4 files changed, 107 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini index 2cf0af3..3d0fde2 100644 --- a/doc/guides/nics/features/cxgbe.ini +++ b/doc/guides/nics/features/cxgbe.ini @@ -4,7 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] -Speed capabilities = P +Speed capabilities = Y Link status = Y Queue start/stop = Y MTU update = Y diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h index 9120c43..f989154 100644 --- a/drivers/net/cxgbe/cxgbe.h +++ b/drivers/net/cxgbe/cxgbe.h @@ -47,6 +47,7 @@ #define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */ int cxgbe_probe(struct adapter *adapter); +void cxgbe_get_speed_caps(struct port_info *pi, u32 *speed_caps); int cxgbe_up(struct adapter *adap); int cxgbe_down(struct port_info *pi); void cxgbe_close(struct adapter *adapter); diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index b622d25..981dd47 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -175,7 +175,7 @@ static void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_desc_lim = cxgbe_desc_lim; device_info->tx_desc_lim = cxgbe_desc_lim; - device_info->speed_capa = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_40G; + cxgbe_get_speed_caps(pi, &device_info->speed_capa); } static void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index eead7c0..0edac2b 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -1034,6 +1034,110 @@ void cxgbe_enable_rx_queues(struct port_info *pi) } /** + * fw_caps_to_speed_caps - translate Firmware Port Caps to Speed Caps. + * @port_type: Firmware Port Type + * @fw_caps: Firmware Port Capabilities + * @speed_caps: Device Info Speed Capabilities + * + * Translate a Firmware Port Capabilities specification to Device Info + * Speed Capabilities. + */ +static void fw_caps_to_speed_caps(enum fw_port_type port_type, + unsigned int fw_caps, + u32 *speed_caps) +{ +#define SET_SPEED(__speed_name) \ + do { \ + *speed_caps |= ETH_LINK_ ## __speed_name; \ + } while (0) + +#define FW_CAPS_TO_SPEED(__fw_name) \ + do { \ + if (fw_caps & FW_PORT_CAP_ ## __fw_name) \ + SET_SPEED(__fw_name); \ + } while (0) + + switch (port_type) { + case FW_PORT_TYPE_BT_SGMII: + case FW_PORT_TYPE_BT_XFI: + case FW_PORT_TYPE_BT_XAUI: + FW_CAPS_TO_SPEED(SPEED_100M); + FW_CAPS_TO_SPEED(SPEED_1G); + FW_CAPS_TO_SPEED(SPEED_10G); + break; + + case FW_PORT_TYPE_KX4: + case FW_PORT_TYPE_KX: + case FW_PORT_TYPE_FIBER_XFI: + case FW_PORT_TYPE_FIBER_XAUI: + case FW_PORT_TYPE_SFP: + case FW_PORT_TYPE_QSFP_10G: + case FW_PORT_TYPE_QSA: + FW_CAPS_TO_SPEED(SPEED_1G); + FW_CAPS_TO_SPEED(SPEED_10G); + break; + + case FW_PORT_TYPE_KR: + SET_SPEED(SPEED_10G); + break; + + case FW_PORT_TYPE_BP_AP: + case FW_PORT_TYPE_BP4_AP: + SET_SPEED(SPEED_1G); + SET_SPEED(SPEED_10G); + break; + + case FW_PORT_TYPE_BP40_BA: + case FW_PORT_TYPE_QSFP: + SET_SPEED(SPEED_40G); + break; + + case FW_PORT_TYPE_CR_QSFP: + case FW_PORT_TYPE_SFP28: + case FW_PORT_TYPE_KR_SFP28: + FW_CAPS_TO_SPEED(SPEED_1G); + FW_CAPS_TO_SPEED(SPEED_10G); + FW_CAPS_TO_SPEED(SPEED_25G); + break; + + case FW_PORT_TYPE_CR2_QSFP: + SET_SPEED(SPEED_50G); + break; + + case FW_PORT_TYPE_KR4_100G: + case FW_PORT_TYPE_CR4_QSFP: + FW_CAPS_TO_SPEED(SPEED_25G); + FW_CAPS_TO_SPEED(SPEED_40G); + FW_CAPS_TO_SPEED(SPEED_100G); + break; + + default: + break; + } + +#undef FW_CAPS_TO_SPEED +#undef SET_SPEED +} + +/** + * cxgbe_get_speed_caps - Fetch supported speed capabilities + * @pi: Underlying port's info + * @speed_caps: Device Info speed capabilities + * + * Fetch supported speed capabilities of the underlying port. + */ +void cxgbe_get_speed_caps(struct port_info *pi, u32 *speed_caps) +
[dpdk-dev] [PATCH 1/2] cxgbe: update supported port module types
Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/base/t4fw_interface.h | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h index 6283fe9..6ca4f31 100644 --- a/drivers/net/cxgbe/base/t4fw_interface.h +++ b/drivers/net/cxgbe/base/t4fw_interface.h @@ -1293,15 +1293,12 @@ enum fw_port_type { FW_PORT_TYPE_QSFP = 14, /* No, 4, Yes, No, No, No, 40G */ FW_PORT_TYPE_BP40_BA= 15, /* No, 4, No, No, Yes, Yes, 40G/10G/1G, BP ANGE */ - FW_PORT_TYPE_KR4_100G = 16, /* No, 4, 100G*/ - FW_PORT_TYPE_CR4_QSFP = 17, /* No, 4, 100G*/ - FW_PORT_TYPE_CR4_CFP4 = 18, /* No, 4, 100G*/ - FW_PORT_TYPE_CR_QSFP= 19, /* No, 1, 25G*/ - FW_PORT_TYPE_CR_CFP4= 20, /* No, 1, 25G*/ - FW_PORT_TYPE_CR2_QSFP = 21, /* No, 2, 50G*/ - FW_PORT_TYPE_CR2_CFP4 = 22, /* No, 2, 50G*/ - FW_PORT_TYPE_SFP28 = 23, /* No, 1, 25G*/ - + FW_PORT_TYPE_KR4_100G = 16, /* No, 4, 100G/40G/25G, Backplane */ + FW_PORT_TYPE_CR4_QSFP = 17, /* No, 4, 100G/40G/25G */ + FW_PORT_TYPE_CR_QSFP= 18, /* No, 1, 25G Spider cable */ + FW_PORT_TYPE_CR2_QSFP = 19, /* No, 2, 50G */ + FW_PORT_TYPE_SFP28 = 20, /* No, 1, 25G/10G/1G */ + FW_PORT_TYPE_KR_SFP28 = 21, /* No, 1, 25G/10G/1G using Backplane */ FW_PORT_TYPE_NONE = M_FW_PORT_CMD_PTYPE }; -- 2.5.3
[dpdk-dev] [PATCH 0/2] cxgbe: fix supported speed capabilities
Patch 1 updates supported port module types. Patch 2 uses port type to determine the supported speed capabilities. Thanks, Rahul Rahul Lakkireddy (2): cxgbe: update supported port module types cxgbe: fix supported speed capabilities doc/guides/nics/features/cxgbe.ini | 2 +- drivers/net/cxgbe/base/t4fw_interface.h | 15 ++--- drivers/net/cxgbe/cxgbe.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c| 2 +- drivers/net/cxgbe/cxgbe_main.c | 104 5 files changed, 113 insertions(+), 11 deletions(-) -- 2.5.3
[dpdk-dev] Segfault seen in netmap_compat app on Power8
Hi, For netmap_compat bridge application on Power8, in netmap_regif function, the assignment to nmif->ring_ofs[i] is not getting reflected immediately. As a result, the subsequent call to netmap_ring_setup ends up writing data at wrong offset. This causes segfault in the app. If we print the nmif->ring_ofs[i] after assignment, then, we see the correct offset and application starts fine. So, probably, some kind of barrier or mechanism to flush write is required on Power8? BTW, this was tried with ToT dpdk git tree on RHEL 7.3 having below gcc version: gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) Thanks, Rahul
Re: [dpdk-dev] Segfault seen in netmap_compat app on Power8
On Thursday, April 04/06/17, 2017 at 15:06:03 +0530, gowrishankar muthukrishnan wrote: >With gcc 6.3.0, I find this app functioning w/o crash. > >Did disabling gcc optimization help ? (set EXTRA_CFLAGS='-O0' before >compile). > Yes, with optimization disabled, the app is not hitting the segfault. Thanks, Rahul >Regards, >Gowrishankar >On Thursday 06 April 2017 02:34 PM, Rahul Lakkireddy wrote: >> Hi, >> >> For netmap_compat bridge application on Power8, in netmap_regif >> function, the assignment to nmif->ring_ofs[i] is not getting reflected >> immediately. >> >> As a result, the subsequent call to netmap_ring_setup ends up writing >> data at wrong offset. This causes segfault in the app. >> >> If we print the nmif->ring_ofs[i] after assignment, then, we see the >> correct offset and application starts fine. >> >> So, probably, some kind of barrier or mechanism to flush write is >> required on Power8? >> >> BTW, this was tried with ToT dpdk git tree on RHEL 7.3 having below >> gcc version: >> >> gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) >> >> Thanks, >> Rahul >> >>
[dpdk-dev] Query on Filtering Support in DPDK
Hi Thomas, On Monday, November 11/30/15, 2015 at 05:43:18 -0800, Thomas Monjalon wrote: > Hi, > > 2015-11-30 18:19, Rahul Lakkireddy: > > 1. Add a new action 'switch' that will: > >* Allow re-direction to different ports in hardware. > > > >Also, for such a rule, additionally support below: > > > >* Allow source mac/destination mac and vlan header re-writing to be > > done by the hardware. > > > >* Allow re-write of TCP/IP headers to perform NAT in hardware. > > > > 2. Add ability to mask individual fields at a particular layer for each > >filter in flow_director. For example, mask all ip packets coming from > >a particular subnet mask and particular range of l4 ports for each > >filter rule. > > > > We would like to get some suggestions on how to proceed with adding the > > above features. > > You need to identify which API must change and what will be the ABI changes. > Then please send a deprecation notice before December 11 in order to be part > of the 2.2 release notes. I am currently identifying the various API changes to support this and also the ABI changes if any. > > If you have some RFC patches to send (at least the API changes), it would be > a good discussion start. I will try to post some RFC patches in 3-4 days time to get more inputs/reviews on the approach. Thanks, Rahul.
[dpdk-dev] [PATCH] cxgbe: explictly mark this as pci_driver
On Wednesday, December 12/02/15, 2015 at 14:16:18 -0800, Stephen Hemminger wrote: > The upcoming Hyper-V driver converts the pci_drv element > in struct eth_driver to a union. When vmbus is added the > pci_drv needs to be explicit. Easier to fix the issue > ahead of time. > > This is backwards compatiable with previous code. > > Signed-off-by: Stephen Hemminger > --- > drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c > b/drivers/net/cxgbe/cxgbe_ethdev.c > index ec5d22b..97ef152 100644 > --- a/drivers/net/cxgbe/cxgbe_ethdev.c > +++ b/drivers/net/cxgbe/cxgbe_ethdev.c > @@ -847,7 +847,7 @@ out_free_adapter: > } > > static struct eth_driver rte_cxgbe_pmd = { > - { > + .pci_drv = { > .name = "rte_cxgbe_pmd", > .id_table = cxgb4_pci_tbl, > .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, > -- > 2.1.4 > Acked-by: Rahul Lakkireddy
[dpdk-dev] [RFC 0/3] ethdev: Enhancements to flow director filter
This RFC series of patches attempt to extend the flow director filter to add support for Chelsio T5 hardware filtering capabilities. Chelsio T5 supports carrying out filtering in hardware which supports 3 actions to carry out on a packet which hit a filter viz. 1. Action Pass - Packets hitting a filter rule can be directed to a particular RXQ. 2. Action Drop - Packets hitting a filter rule are dropped in h/w. 3. Action Switch - Packets hitting a filter rule can be switched in h/w from one port to another, without involvement of host. Also, the action Switch also supports rewrite of src-mac/dst-mac headers as well as rewrite of vlan headers. It also supports rewrite of IP headers and thereby, supports NAT (Network Address Translation) in h/w. Also, each filter rule can optionally support specifying a mask value i.e. it's possible to create a filter rule for an entire subnet of IP addresses or a range of tcp/udp ports, etc. Patch 1 does the following: - Adds an additional flow rte_eth_pkt_filter_flow which encapsulates ingress ports, l2 payload, vlan and ntuples. - Adds an additional mask for the flow to allow range of values to be matched. - Adds a new behavior 'switch'. - Adds behavior arguments that can be passed when a particular behavior is taken. For ex: in case of action 'switch', pass additional 4-tuple to allow rewriting src/dst ip and port addresses to support NAT'ing. Patch 2 shows testpmd command line example to support packet filter flow. Patch 3 announces ABI change for filtering support. The patch series has been compile tested on all x86 gcc targets and the current fdir filter supported drivers seem to return appropriate error codes when this new flow type and the new action are not supported and hence are not affected. Posting this series mainly for discussion on API change. Once this is agreeable then, I will post the cxgbe PMD changes to use the new API. Rahul Lakkireddy (3): ethdev: add packet filter flow and new behavior switch to fdir testpmd: add an example to show packet filter flow doc: announce ABI change for filtering support app/test-pmd/cmdline.c | 435 ++- doc/guides/rel_notes/deprecation.rst | 6 + lib/librte_ether/rte_eth_ctrl.h | 112 - 3 files changed, 544 insertions(+), 9 deletions(-) -- 2.5.3
[dpdk-dev] [RFC 1/3] ethdev: add packet filter flow and new behavior switch to fdir
Add a new packet filter flow that allows filtering a packet based on matching ingress port, ethertype, vlan, ip, and tcp/udp fields, i.e. matching based on any or all fields at the same time. Add the ability to provide masks for fields in flow to allow range of values. Add a new vlan flow containing inner and outer vlan to match. Add tos and proto fields that can be matched for ipv4_flow. Add a new behavior switch. Add the ability to provide behavior arguments to allow insert/deletion of matched fields in the flow. Useful when rewriting matched fields with new values. Adds arguments for port, mac, vlan, and nat. Ex: allows to provide new ip and port addresses to rewrite the fields of packets matching a filter rule before NAT'ing. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- lib/librte_ether/rte_eth_ctrl.h | 112 +++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..a2e770c 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -74,7 +74,11 @@ extern "C" { #define RTE_ETH_FLOW_IPV6_EX15 #define RTE_ETH_FLOW_IPV6_TCP_EX16 #define RTE_ETH_FLOW_IPV6_UDP_EX17 -#define RTE_ETH_FLOW_MAX18 +#define RTE_ETH_FLOW_PKT_FILTER_IPV4_TCP 18 +#define RTE_ETH_FLOW_PKT_FILTER_IPV4_UDP 19 +#define RTE_ETH_FLOW_PKT_FILTER_IPV6_TCP 20 +#define RTE_ETH_FLOW_PKT_FILTER_IPV6_UDP 21 +#define RTE_ETH_FLOW_MAX22 /** * Feature filter types @@ -407,6 +411,8 @@ struct rte_eth_l2_flow { struct rte_eth_ipv4_flow { uint32_t src_ip; /**< IPv4 source address to match. */ uint32_t dst_ip; /**< IPv4 destination address to match. */ + uint8_t tos; /**< IPV4 type of service to match. */ + uint8_t proto;/**< IPV4 proto to match. */ }; /** @@ -500,6 +506,43 @@ struct rte_eth_tunnel_flow { }; /** + * A structure used to define the input for vlan flow. + */ +struct rte_eth_vlan_flow { + uint16_t inner_vlan; /**< Inner vlan field to match. */ + uint16_t outer_vlan; /**< Outer vlan field to match. */ +}; + +/** + * A union used to define the input for N-Tuple flow + */ +union rte_eth_ntuple_flow { + struct rte_eth_tcpv4_flow tcp4; + struct rte_eth_udpv4_flow udp4; + struct rte_eth_tcpv6_flow tcp6; + struct rte_eth_udpv6_flow udp6; +}; + +/** + * A structure used to define the input for packet filter. + */ +struct rte_eth_pkt_filter { + uint8_t port_id; /**< Port id to match. */ + struct rte_eth_l2_flowl2_flow; /**< L2 flow fields to match. */ + struct rte_eth_vlan_flow vlan_flow; /**< Vlan flow fields to match. */ + union rte_eth_ntuple_flow ntuple_flow; + /**< N-tuple flow fields to match. */ +}; + +/** + * A structure used to define the input for packet filter flow. + */ +struct rte_eth_pkt_filter_flow { + struct rte_eth_pkt_filter pkt; /**< Packet fields to match. */ + struct rte_eth_pkt_filter mask; /**< Mask for matched fields. */ +}; + +/** * An union contains the inputs for all types of flow */ union rte_eth_fdir_flow { @@ -514,6 +557,7 @@ union rte_eth_fdir_flow { struct rte_eth_ipv6_flow ipv6_flow; struct rte_eth_mac_vlan_flow mac_vlan_flow; struct rte_eth_tunnel_flow tunnel_flow; + struct rte_eth_pkt_filter_flow pkt_filter_flow; }; /** @@ -545,6 +589,7 @@ enum rte_eth_fdir_behavior { RTE_ETH_FDIR_ACCEPT = 0, RTE_ETH_FDIR_REJECT, RTE_ETH_FDIR_PASSTHRU, + RTE_ETH_FDIR_SWITCH, }; /** @@ -559,6 +604,69 @@ enum rte_eth_fdir_status { }; /** + * Behavior sub operations on fields in matched flows. + */ +enum rte_eth_fdir_behavior_sub_op { + RTE_FDIR_BEHAVIOR_SUB_OP_UNKNOWN = 0, + RTE_FDIR_BEHAVIOR_SUB_OP_INSERT, + /**< Add/rewrite fields in matched flows */ + RTE_FDIR_BEHAVIOR_SUB_OP_DELETE, + /**< Delete/reset fields in matched flows */ +}; + +/** + * A structure used to define the input for passing port arguments for + * behavior taken. + */ +struct rte_eth_behavior_arg_port { + enum rte_eth_fdir_behavior_sub_op op; /**< Sub operation to do */ + uint8_t port_id; /**< Physical port to redirect */ +}; + +/** + * A structure used to define the input for passing mac arguments for + * behavior taken. + */ +struct rte_eth_behavior_arg_mac { + enum rte_eth_fdir_behavior_sub_op op; /**< Sub operation to do */ + struct ether_addr src_mac;/**< SRC Ethernet Address to rewirte. */ + struct ether_addr dst_mac;/**< DST Ethernet Address to rewrite. */ +}; + +/** + * A structure used to define the input for passing vlan arguments for + * behavior taken. + */ +struct rte_eth_behavior_arg_vlan
[dpdk-dev] [RFC 2/3] testpmd: add an example to show packet filter flow
Extend the existing flow_director_filter to add support for packet filter flow. Also shows how to pass the extra behavior arguments to rewrite fields in matched filter rules. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- app/test-pmd/cmdline.c | 435 - 1 file changed, 427 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 73298c9..488eddc 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -641,7 +641,7 @@ static void cmd_help_long_parsed(void *parsed_result, " flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)" " src (src_ip_address) dst (dst_ip_address)" " vlan (vlan_value) flexbytes (flexbytes_value)" - " (drop|fwd) pf|vf(vf_id) queue (queue_id)" + " (drop|fwd|switch) pf|vf(vf_id) queue (queue_id)" " fd_id (fd_id_value)\n" "Add/Del an IP type flow director filter.\n\n" @@ -650,7 +650,7 @@ static void cmd_help_long_parsed(void *parsed_result, " src (src_ip_address) (src_port)" " dst (dst_ip_address) (dst_port)" " vlan (vlan_value) flexbytes (flexbytes_value)" - " (drop|fwd) pf|vf(vf_id) queue (queue_id)" + " (drop|fwd|switch) pf|vf(vf_id) queue (queue_id)" " fd_id (fd_id_value)\n" "Add/Del an UDP/TCP type flow director filter.\n\n" @@ -659,16 +659,37 @@ static void cmd_help_long_parsed(void *parsed_result, " src (src_ip_address) (src_port)" " dst (dst_ip_address) (dst_port)" " tag (verification_tag) vlan (vlan_value)" - " flexbytes (flexbytes_value) (drop|fwd)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n" "Add/Del a SCTP type flow director filter.\n\n" "flow_director_filter (port_id) mode IP (add|del|update)" " flow l2_payload ether (ethertype)" - " flexbytes (flexbytes_value) (drop|fwd)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n" "Add/Del a l2 payload type flow director filter.\n\n" + "flow_director_filter (port_id) mode IP (add|del|update)" + " flow (ipv4-tcp-pkt-filter|ipv4-udp-pkt-filter|" + " ipv6-tcp-pkt-filter|ipv6-udp-pkt-filter)" + " ingress-port (port_id) (port_id_mask)" + " ether (ethertype) (ethertype_mask)" + " inner-vlan (inner_vlan_value) (inner_vlan_mask)" + " outer-vlan (outer_vlan_value) (outer_vlan_mask)" + " tos (tos_value) (tos_mask)" + " proto (proto_value) (proto_mask)" + " src (src_ip) (src_ip_mask) (src_port) (src_port_mask)" + " dst (dst_ip) (dst_ip_mask) (dst_port) (dst_port_mask)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" + " pf|vf(vf_id) queue (queue_id)" + " port-arg none|port-redirect (dst-port-id)" + " mac-arg none|mac-rewrite (src-mac) (dst-mac)" + " vlan-arg none|vlan-rewrite|vlan-del (vlan_value)" + " nat-arg none|nat-rewrite" + " src (src_ip) (src_port) dst (dst_ip) (dst_port)" + " fd_id (fd_id_value)\n" + "Add/Del a packet filter type flow director filter.\n\n" + "flow_director_filter (port_id) mode MAC-VLAN (add|del|update)" " mac (mac_address) vlan (vlan_value)" " flexbytes (flexbytes_value) (drop|fwd)" @@ -7973,14 +7994,34 @@ struct cmd_flow_director_result { cmdline_fixed_string_t ops; cmdline_fixed_string_t flow; cmdline_fixed_string_t flow_type; + cmdline_fixed_string_t iport; + uint8_t iport_id; +
[dpdk-dev] [RFC 3/3] doc: announce ABI change for filtering support
Current filtering support will be enhanced to accommodate support for Chelsio T5 hardware filtering support. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- doc/guides/rel_notes/deprecation.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 1c7ab01..ca43b16 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -19,3 +19,9 @@ Deprecation Notices and table action handlers will be updated: the pipeline parameter will be added, the packets mask parameter will be either removed (for input port action handler) or made input-only. + +* The filtering support will be changed to add a new packet filter + flow, add a new behavior 'switch', add an ability to add mask + for fields in each filter rule, and add an ability to pass extra + arguments for the behavior taken to allow rewriting matched fields + in filter rule. -- 2.5.3
[dpdk-dev] [RFC 1/3] ethdev: add packet filter flow and new behavior switch to fdir
Hi Andrey, On Thursday, December 12/10/15, 2015 at 07:46:42 -0800, Chilikin, Andrey wrote: > Hi Rahul, > > If ABI for fdir is going to be changed should we then take more general > approach to accommodate other NICs as well? For example, for > "rte_eth_ipv4_flow" you have "tos" and "proto" fields added, but "ttl" was > left out of scope. I believe that "rte_eth_udpv6_flow" should be compatible > with new IPv4 structure, so "flow label", "tc", "next header" and "hop limit" > to be added as well as other NICs might have support for fdir rules for all > these fields. > I agree. I'll wait for some more review comments if there are any and then post a v2 RFC series with above changes. Thanks, Rahul
[dpdk-dev] [PATCH] cxgbe: fix unnecessary check for freelist existence while freeing rxq
When refilling freelists for the first time and if it fails, the rxq is freed and returns ENOMEM. There is a check while freeing hardware rxq to pass freelist context id if the freelist exists or 0x otherwise. The error path is only reached if freelist exists. So, fix is to remove the useless check for freelist existence. Thanks to John McNamara for reporting it. Coverity issue: 107108 Fixes: 92c8a63223e5 ("cxgbe: add device configuration and Rx support") Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- drivers/net/cxgbe/sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 51449e0..3c62d03 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -1823,7 +1823,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, refill_fl_err: t4_iq_free(adap, adap->mbox, adap->pf, 0, FW_IQ_TYPE_FL_INT_CAP, - iq->cntxt_id, fl ? fl->cntxt_id : 0x, 0x); + iq->cntxt_id, fl->cntxt_id, 0x); fl_nomem: ret = -ENOMEM; err: -- 2.5.3
[dpdk-dev] [RFC 3/3] doc: announce ABI change for filtering support
Hi Thomas, I am preparing a v2 of this series where I will be accomodating some more fields to be considered for filtering. However, if the overall approach seems ok to everyone then, should I submit a separate patch for this ABI change announcement ? Thanks, Rahul. On Thursday, December 12/10/15, 2015 at 19:31:04 +0530, Rahul Lakkireddy wrote: > Current filtering support will be enhanced to accommodate support > for Chelsio T5 hardware filtering support. > > Signed-off-by: Rahul Lakkireddy > Signed-off-by: Kumar Sanghvi > --- > doc/guides/rel_notes/deprecation.rst | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/doc/guides/rel_notes/deprecation.rst > b/doc/guides/rel_notes/deprecation.rst > index 1c7ab01..ca43b16 100644 > --- a/doc/guides/rel_notes/deprecation.rst > +++ b/doc/guides/rel_notes/deprecation.rst > @@ -19,3 +19,9 @@ Deprecation Notices >and table action handlers will be updated: >the pipeline parameter will be added, the packets mask parameter will be >either removed (for input port action handler) or made input-only. > + > +* The filtering support will be changed to add a new packet filter > + flow, add a new behavior 'switch', add an ability to add mask > + for fields in each filter rule, and add an ability to pass extra > + arguments for the behavior taken to allow rewriting matched fields > + in filter rule. > -- > 2.5.3 >
[dpdk-dev] [RFC 3/3] doc: announce ABI change for filtering support
Hi Thomas, On Tuesday, December 12/15/15, 2015 at 00:55:20 -0800, Thomas Monjalon wrote: > 2015-12-15 14:10, Rahul Lakkireddy: > > Hi Thomas, > > > > I am preparing a v2 of this series where I will be accomodating some > > more fields to be considered for filtering. However, if the overall > > approach seems ok to everyone then, should I submit a separate patch > > for this ABI change announcement ? > > Yes, if this announce is not enough: > http://dpdk.org/browse/dpdk/commit/?id=648e6b3815a35 > Apart from rte_eth_fdir_flow ABI change mentioned in above link, new fields will be added to rte_eth_ipv4_flow and rte_eth_ipv6_flow, which break their ABI. Also, 4 new flow types will be added, which increases RTE_ETH_FLOW_MAX from 18 to 22 and breaks the ABI. Should I send a separate ABI change announce patch for each of them? Thanks, Rahul
[dpdk-dev] [PATCH] doc: announce ABI change for extending filtering support
Current filtering support will be enhanced to accommodate support for Chelsio T5 hardware filtering support. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- doc/guides/rel_notes/deprecation.rst | 8 1 file changed, 8 insertions(+) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index f8a41dd..15e766d 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -41,3 +41,11 @@ Deprecation Notices commands (such as RETA update in testpmd). This should impact CMDLINE_PARSE_RESULT_BUFSIZE, STR_TOKEN_SIZE and RDLINE_BUF_SIZE. It should be integrated in release 2.3. + +* ABI changes are planned for rte_eth_ipv4_flow and rte_eth_ipv6_flow to + include more fields to be matched against. The release 2.2 does not + contain these ABI changes, but release 2.3 will. + +* ABI changes are planned for adding four new flow types. This impacts + RTE_ETH_FLOW_MAX. The release 2.2 does not contain these ABI changes, + but release 2.3 will. -- 2.5.3
[dpdk-dev] [RFC v2 0/2] ethdev: Enhancements to flow director filter
This RFC series of patches attempt to extend the flow director filter to add support for Chelsio T5 hardware filtering capabilities. Chelsio T5 supports carrying out filtering in hardware which supports 3 actions to carry out on a packet which hit a filter viz. 1. Action Pass - Packets hitting a filter rule can be directed to a particular RXQ. 2. Action Drop - Packets hitting a filter rule are dropped in h/w. 3. Action Switch - Packets hitting a filter rule can be switched in h/w from one port to another, without involvement of host. Also, the action Switch also supports rewrite of src-mac/dst-mac headers as well as rewrite of vlan headers. It also supports rewrite of IP headers and thereby, supports NAT (Network Address Translation) in h/w. Also, each filter rule can optionally support specifying a mask value i.e. it's possible to create a filter rule for an entire subnet of IP addresses or a range of tcp/udp ports, etc. Patch 1 does the following: - Adds an additional flow rte_eth_pkt_filter_flow which encapsulates ingress ports, l2 payload, vlan and ntuples. - Adds an additional mask for the flow to allow range of values to be matched. - Adds an ability to set both filters with masks (Maskfull) and without masks (Maskless). Also allow prioritizing one of these filter types over the other when a packet matches several types. - Adds a new behavior 'switch'. - Adds behavior arguments that can be passed when a particular behavior is taken. For ex: in case of action 'switch', pass additional 4-tuple to allow rewriting src/dst ip and port addresses to support NAT'ing. Patch 2 shows testpmd command line example to support packet filter flow. The patch series has been compile tested on all x86 gcc targets and the current fdir filter supported drivers seem to return appropriate error codes when this new flow type and the new action are not supported and hence are not affected. Posting this series mainly for discussion on API change. Once this is agreeable then, I will post the cxgbe PMD changes to use the new API. --- v2: 1. Added ttl to rte_eth_ipv4_flow and tc, flow_label, next_header, and hop_limit to rte_eth_ipv6_flow. 2. Added new field type to rte_eth_pkt_filter_flow to differentiate between maskfull and maskless filter types. 3. Added new field prio to rte_eth_pkt_filter_flow to allow setting priority over maskfull or maskless when packet matches multiple filter types. 4. Added new behavior sub op RTE_FDIR_BEHAVIOR_SUB_OP_SWAP to allow swapping fields in matched flows. For ex, useful when swapping mac addresses in hardware before switching. 5. Updated the testpmd example to reflect the above new changes. 6. Dropped Patch 3 since the ABI announcement has already been merged. Rahul Lakkireddy (2): ethdev: add packet filter flow and new behavior switch to fdir testpmd: add an example to show packet filter flow app/test-pmd/cmdline.c | 528 +++- lib/librte_ether/rte_eth_ctrl.h | 127 +- 2 files changed, 646 insertions(+), 9 deletions(-) -- 2.5.3
[dpdk-dev] [RFC v2 1/2] ethdev: add packet filter flow and new behavior switch to fdir
Add a new packet filter flow that allows filtering a packet based on matching ingress port, ethertype, vlan, ip, and tcp/udp fields, i.e. matching based on any or all fields at the same time. Add the ability to provide masks for fields in flow to allow range of values. Allow selection of maskfull vs maskless filter types. Provide mechanism to set priority to maskfull vs maskless filter types when packet matches several filter types. Add a new vlan flow containing inner and outer vlan to match. Add tos, proto, and ttl fields that can be matched for ipv4 flow. Add tc, flow_label, next_header, and hop_limit fields that can be matched for ipv6 flow. Add a new behavior switch. Add the ability to provide behavior arguments to allow insert/deletion/ swapping of matched fields in the flow. Useful when rewriting matched fields with new values. Adds arguments for port, mac, vlan, and nat. Ex: allows to provide new ip and port addresses to rewrite the fields of packets matching a filter rule before NAT'ing. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- v2: 1. Added ttl to rte_eth_ipv4_flow and tc, flow_label, next_header, and hop_limit to rte_eth_ipv6_flow. 2. Added new field type to rte_eth_pkt_filter_flow to differentiate between maskfull and maskless filter types. 3. Added new field prio to rte_eth_pkt_filter_flow to allow setting priority over maskfull or maskless when packet matches multiple filter types. 4. Added new behavior sub op RTE_FDIR_BEHAVIOR_SUB_OP_SWAP to allow swapping fields in matched flows. Useful when swapping mac addresses in hardware before switching. lib/librte_ether/rte_eth_ctrl.h | 127 +++- 1 file changed, 126 insertions(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index ce224ad..5cc22a0 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -74,7 +74,11 @@ extern "C" { #define RTE_ETH_FLOW_IPV6_EX15 #define RTE_ETH_FLOW_IPV6_TCP_EX16 #define RTE_ETH_FLOW_IPV6_UDP_EX17 -#define RTE_ETH_FLOW_MAX18 +#define RTE_ETH_FLOW_PKT_FILTER_IPV4_TCP 18 +#define RTE_ETH_FLOW_PKT_FILTER_IPV4_UDP 19 +#define RTE_ETH_FLOW_PKT_FILTER_IPV6_TCP 20 +#define RTE_ETH_FLOW_PKT_FILTER_IPV6_UDP 21 +#define RTE_ETH_FLOW_MAX22 /** * Feature filter types @@ -407,6 +411,9 @@ struct rte_eth_l2_flow { struct rte_eth_ipv4_flow { uint32_t src_ip; /**< IPv4 source address to match. */ uint32_t dst_ip; /**< IPv4 destination address to match. */ + uint8_t tos; /**< IPV4 type of service to match. */ + uint8_t proto;/**< IPV4 proto to match. */ + uint8_t ttl; /**< IPV4 time to live to match. */ }; /** @@ -443,6 +450,10 @@ struct rte_eth_sctpv4_flow { struct rte_eth_ipv6_flow { uint32_t src_ip[4]; /**< IPv6 source address to match. */ uint32_t dst_ip[4]; /**< IPv6 destination address to match. */ + uint8_t tc; /**< IPv6 traffic class to match. */ + uint32_t flow_label; /**< IPv6 flow label to match. */ + uint8_t next_header;/**< IPv6 next header to match. */ + uint8_t hop_limit; /**< IPv6 hop limits to match. */ }; /** @@ -500,6 +511,51 @@ struct rte_eth_tunnel_flow { }; /** + * A structure used to define the input for vlan flow. + */ +struct rte_eth_vlan_flow { + uint16_t inner_vlan; /**< Inner vlan field to match. */ + uint16_t outer_vlan; /**< Outer vlan field to match. */ +}; + +/** + * A union used to define the input for N-Tuple flow + */ +union rte_eth_ntuple_flow { + struct rte_eth_tcpv4_flow tcp4; + struct rte_eth_udpv4_flow udp4; + struct rte_eth_tcpv6_flow tcp6; + struct rte_eth_udpv6_flow udp6; +}; + +/** + * A structure used to define the input for packet filter. + */ +struct rte_eth_pkt_filter { + uint8_t port_id; /**< Port id to match. */ + struct rte_eth_l2_flowl2_flow; /**< L2 flow fields to match. */ + struct rte_eth_vlan_flow vlan_flow; /**< Vlan flow fields to match. */ + union rte_eth_ntuple_flow ntuple_flow; + /**< N-tuple flow fields to match. */ +}; + +/** + * A structure used to define the input for packet filter flow. + */ +enum rte_eth_pkt_filter_type { + RTE_ETH_PKT_FILTER_TYPE_MASKLESS = 0, /**< Ignore masks in the flow */ + RTE_ETH_PKT_FILTER_TYPE_MASKFULL, /**< Consider masks in the flow */ +}; + +struct rte_eth_pkt_filter_flow { + enum rte_eth_pkt_filter_type type; /**< Type of filter */ + enum rte_eth_pkt_filter_type prio; + /**< Prioritize the filter type when a packet matches several types */ + struct rte_eth_pkt_filter pkt; /**< Packet fields to match. */ + struct rte_
[dpdk-dev] [RFC v2 2/2] testpmd: add an example to show packet filter flow
Extend the existing flow_director_filter to add support for packet filter flow. Also shows how to pass the extra behavior arguments to rewrite fields in matched filter rules. Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- v2: 1. Added new field filter-type to allow specifying maskfull vs maskless filter types. 2. Added new field filter-prio to allow specifying the priority between maskfull and maskless filters i.e. if we have a maskfull and a maskless filter both of which can match a single traffic pattern then, which one takes the priority is determined by filter-prio. 3. Added new field flow-label to be matched for ipv6. 4. Added new mac-swap behavior argument. app/test-pmd/cmdline.c | 528 - 1 file changed, 520 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 73298c9..3402f2c 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -641,7 +641,7 @@ static void cmd_help_long_parsed(void *parsed_result, " flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)" " src (src_ip_address) dst (dst_ip_address)" " vlan (vlan_value) flexbytes (flexbytes_value)" - " (drop|fwd) pf|vf(vf_id) queue (queue_id)" + " (drop|fwd|switch) pf|vf(vf_id) queue (queue_id)" " fd_id (fd_id_value)\n" "Add/Del an IP type flow director filter.\n\n" @@ -650,7 +650,7 @@ static void cmd_help_long_parsed(void *parsed_result, " src (src_ip_address) (src_port)" " dst (dst_ip_address) (dst_port)" " vlan (vlan_value) flexbytes (flexbytes_value)" - " (drop|fwd) pf|vf(vf_id) queue (queue_id)" + " (drop|fwd|switch) pf|vf(vf_id) queue (queue_id)" " fd_id (fd_id_value)\n" "Add/Del an UDP/TCP type flow director filter.\n\n" @@ -659,16 +659,41 @@ static void cmd_help_long_parsed(void *parsed_result, " src (src_ip_address) (src_port)" " dst (dst_ip_address) (dst_port)" " tag (verification_tag) vlan (vlan_value)" - " flexbytes (flexbytes_value) (drop|fwd)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n" "Add/Del a SCTP type flow director filter.\n\n" "flow_director_filter (port_id) mode IP (add|del|update)" " flow l2_payload ether (ethertype)" - " flexbytes (flexbytes_value) (drop|fwd)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" " pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)\n" "Add/Del a l2 payload type flow director filter.\n\n" + "flow_director_filter (port_id) mode IP (add|del|update)" + " flow (ipv4-tcp-pkt-filter|ipv4-udp-pkt-filter" + " ipv6-tcp-pkt-filter|ipv6-udp-pkt-filter)" + " filter-type maskfull|maskless" + " filter-prio default|maskfull|maskless" + " ingress-port (port_id) (port_id_mask)" + " ether (ethertype) (ethertype_mask)" + " inner-vlan (inner_vlan_value) (inner_vlan_mask)" + " outer-vlan (outer_vlan_value) (outer_vlan_mask)" + " tos (tos_value) (tos_mask)" + " flow-label (flow_label_value) (flow_label_mask)" + " proto (proto_value) (proto_mask)" + " ttl (ttl_value) (ttl_mask)" + " src (src_ip) (src_ip_mask) (src_port) (src_port_mask)" + " dst (dst_ip) (dst_ip_mask) (dst_port) (dst_port_mask)" + " flexbytes (flexbytes_value) (drop|fwd|switch)" + " pf|vf(vf_id) queue (queue_id)" + " port-arg none|port-redirect (dst-port-id)" + " mac-arg none|mac-rewrite|mac-swap (src-mac) (dst-mac)" + " vlan-arg none|vlan-rewrite|vlan-del (vlan_value)" + " nat-arg non
[dpdk-dev] [PATCH] net/cxgbe: fix control queue mbuf pool naming convention
When multiple Chelsio adapters are present, the current naming convention of using underlying physical port number of the adapter creates conflicts when allocating control queue mbuf pool for multiple adapters and hence results in allocation failure. Fix by using port_id from rte_eth_dev_data, instead of physical port number. Fixes: 3a3aaabc7c77 ("net/cxgbe: add control queue to communicate filter requests") Cc: sta...@dpdk.org Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_main.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index ec080e5d3..0368db509 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -122,6 +122,7 @@ int setup_sge_ctrl_txq(struct adapter *adapter) int err = 0, i = 0; for_each_port(adapter, i) { + struct port_info *pi = adap2pinfo(adapter, i); char name[RTE_ETH_NAME_MAX_LEN]; struct sge_ctrl_txq *q = &s->ctrlq[i]; @@ -135,16 +136,19 @@ int setup_sge_ctrl_txq(struct adapter *adapter) err); goto out; } - snprintf(name, sizeof(name), "cxgbe_ctrl_pool_%d", i); + snprintf(name, sizeof(name), "%s_ctrl_pool_%d", +pi->eth_dev->device->driver->name, +pi->eth_dev->data->port_id); q->mb_pool = rte_pktmbuf_pool_create(name, s->ctrlq[i].q.size, RTE_CACHE_LINE_SIZE, RTE_MBUF_PRIV_ALIGN, RTE_MBUF_DEFAULT_BUF_SIZE, SOCKET_ID_ANY); if (!q->mb_pool) { - dev_err(adapter, "Can't create ctrl pool for port: %d", - i); - err = -ENOMEM; + err = -rte_errno; + dev_err(adapter, + "Can't create ctrl pool for port %d. Err: %d\n", + pi->eth_dev->data->port_id, err); goto out; } } -- 2.18.0
Re: [dpdk-dev] [PATCH] doc: remove redundant "OF" prefix from testpmd doc
On Thursday, December 12/06/18, 2018 at 17:36:14 +0530, Dekel Peled wrote: > testpmd actions set_tp_src and set_tp_dst documentation adds the > of_ prefix to action names, while the implementation doesn't add it. > > This patch removes the prefix from action names in testpmd > documentation. > > Fixes: 9ccc94919500 ("ethdev: add flow API actions to modify TCP/UDP port > numbers") > Cc: rahul.lakkire...@chelsio.com > > Signed-off-by: Dekel Peled > --- > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 056f8bb..9d4f107 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3931,12 +3931,12 @@ This section lists supported actions and their > attributes, if any. > >- ``ipv6_addr``: New IPv6 destination address. > > -- ``of_set_tp_src``: Set a new source port number in the outermost TCP/UDP > +- ``set_tp_src``: Set a new source port number in the outermost TCP/UDP >header. > >- ``port``: New TCP/UDP source port number. > > -- ``of_set_tp_dst``: Set a new destination port number in the outermost > TCP/UDP > +- ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP >header. > >- ``port``: New TCP/UDP destination port number. > -- > 1.8.3.1 > Good catch! Acked-by: Rahul Lakkireddy
[dpdk-dev] [PATCH 0/4] net/cxgbe: fix build for Microsoft Windows OS support
This series of patches fix compilation warning and errors seen while building CXGBE PMD in preparation for Microsoft Windows OS support. Patch 1 uses relative paths for including header files. Patch 2 fixes macros related to rte_log(). Patch 3 only redefines symbols when they are not available. Patch 4 fixes other misc build issues. Patches are generated against dpdk-next-net tree. Thanks, Rahul Rahul Lakkireddy (4): net/cxgbe: use relative paths for including header files net/cxgbe: fix macros related to logs for Windows net/cxgbe: only redefine symbols when not available for Windows net/cxgbe: fix other misc build issues for Windows drivers/net/cxgbe/Makefile | 2 - drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/common.h| 4 +- drivers/net/cxgbe/base/t4_hw.c | 4 +- drivers/net/cxgbe/base/t4vf_hw.c | 2 +- drivers/net/cxgbe/clip_tbl.c | 2 +- drivers/net/cxgbe/cxgbe.h | 4 +- drivers/net/cxgbe/cxgbe_compat.h | 83 -- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_filter.c | 7 +-- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 2 +- drivers/net/cxgbe/cxgbe_main.c | 6 +-- drivers/net/cxgbe/cxgbevf_ethdev.c | 2 +- drivers/net/cxgbe/cxgbevf_main.c | 6 +-- drivers/net/cxgbe/l2t.c| 3 +- drivers/net/cxgbe/l2t.h| 2 +- drivers/net/cxgbe/mps_tcam.h | 2 +- drivers/net/cxgbe/sge.c| 9 ++-- 19 files changed, 90 insertions(+), 58 deletions(-) -- 2.18.0
[dpdk-dev] [PATCH 1/4] net/cxgbe: use relative paths for including header files
Explicitly state header file location using relative paths. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/Makefile | 2 -- drivers/net/cxgbe/base/adapter.h | 4 ++-- drivers/net/cxgbe/base/common.h| 2 +- drivers/net/cxgbe/clip_tbl.c | 2 +- drivers/net/cxgbe/cxgbe.h | 4 ++-- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_filter.c | 7 --- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 2 +- drivers/net/cxgbe/cxgbe_main.c | 6 +++--- drivers/net/cxgbe/cxgbevf_ethdev.c | 2 +- drivers/net/cxgbe/cxgbevf_main.c | 6 +++--- drivers/net/cxgbe/l2t.c| 3 ++- drivers/net/cxgbe/l2t.h| 2 +- drivers/net/cxgbe/mps_tcam.h | 2 +- drivers/net/cxgbe/sge.c| 6 +++--- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile index 68466f13e..d809f4720 100644 --- a/drivers/net/cxgbe/Makefile +++ b/drivers/net/cxgbe/Makefile @@ -9,8 +9,6 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pmd_cxgbe.a -CFLAGS += -I$(SRCDIR)/base/ -CFLAGS += -I$(SRCDIR) CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 47cfc5f5f..17ce60d04 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -14,9 +14,9 @@ #include #include -#include "cxgbe_compat.h" +#include "../cxgbe_compat.h" +#include "../cxgbe_ofld.h" #include "t4_regs_values.h" -#include "cxgbe_ofld.h" enum { MAX_ETH_QSETS = 64, /* # of Ethernet Tx/Rx queue sets */ diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index fd2006682..84311fc95 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -6,7 +6,7 @@ #ifndef __CHELSIO_COMMON_H #define __CHELSIO_COMMON_H -#include "cxgbe_compat.h" +#include "../cxgbe_compat.h" #include "t4_hw.h" #include "t4vf_hw.h" #include "t4_chip_type.h" diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c index 5e4dc5270..a0ab2a6ac 100644 --- a/drivers/net/cxgbe/clip_tbl.c +++ b/drivers/net/cxgbe/clip_tbl.c @@ -3,7 +3,7 @@ * All rights reserved. */ -#include "common.h" +#include "base/common.h" #include "clip_tbl.h" /** diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h index eb58f8802..5a7490f91 100644 --- a/drivers/net/cxgbe/cxgbe.h +++ b/drivers/net/cxgbe/cxgbe.h @@ -6,8 +6,8 @@ #ifndef _CXGBE_H_ #define _CXGBE_H_ -#include "common.h" -#include "t4_regs.h" +#include "base/common.h" +#include "base/t4_regs.h" #define CXGBE_MIN_RING_DESC_SIZE 128 /* Min TX/RX descriptor ring size */ #define CXGBE_MAX_RING_DESC_SIZE 4096 /* Max TX/RX descriptor ring size */ diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index b2f83ea37..010a818eb 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -57,7 +57,7 @@ /* *... and the PCI ID Table itself ... */ -#include "t4_pci_id_tbl.h" +#include "base/t4_pci_id_tbl.h" uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index 3a7912e48..86a6158fd 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -3,9 +3,10 @@ * All rights reserved. */ #include -#include "common.h" -#include "t4_tcb.h" -#include "t4_regs.h" + +#include "base/common.h" +#include "base/t4_tcb.h" +#include "base/t4_regs.h" #include "cxgbe_filter.h" #include "clip_tbl.h" #include "l2t.h" diff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h index b7bcbf56a..2d6077718 100644 --- a/drivers/net/cxgbe/cxgbe_filter.h +++ b/drivers/net/cxgbe/cxgbe_filter.h @@ -6,7 +6,7 @@ #ifndef _CXGBE_FILTER_H_ #define _CXGBE_FILTER_H_ -#include "t4_msg.h" +#include "base/t4_msg.h" /* * Defined bit width of user definable filter tuples */ diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index 4deaff8f2..7b9f4d391 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -2,7 +2,7 @@ * Copyright(c) 2018 Chelsio Communications. * All rights reserved. */ -#include "common.h" +#include "base/common.h" #include "cxgbe_flow.h" #define __CXGBE_FILL_FS(__v, __m, fs, elem, e) \ diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index ec080e5d3..27327d500 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++
[dpdk-dev] [PATCH 2/4] net/cxgbe: fix macros related to logs for Windows
Replace "args..." with "fmt, ..." and directly use __VA_ARGS__. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_compat.h | 40 ++-- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index 5d47c5f3d..ce4662d54 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -19,41 +19,45 @@ #include #include -#define dev_printf(level, fmt, args...) \ - RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ## args) +#define dev_printf(level, fmt, ...) \ + RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__) -#define dev_err(x, args...) dev_printf(ERR, args) -#define dev_info(x, args...) dev_printf(INFO, args) -#define dev_warn(x, args...) dev_printf(WARNING, args) +#define dev_err(x, fmt, ...) dev_printf(ERR, fmt, ##__VA_ARGS__) +#define dev_info(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__) +#define dev_warn(x, fmt, ...) dev_printf(WARNING, fmt, ##__VA_ARGS__) #ifdef RTE_LIBRTE_CXGBE_DEBUG -#define dev_debug(x, args...) dev_printf(DEBUG, args) +#define dev_debug(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__) #else -#define dev_debug(x, args...) do { } while (0) +#define dev_debug(x, fmt, ...) do { } while (0) #endif #ifdef RTE_LIBRTE_CXGBE_DEBUG_REG -#define CXGBE_DEBUG_REG(x, args...) dev_printf(DEBUG, "REG:" args) +#define CXGBE_DEBUG_REG(x, fmt, ...) \ + dev_printf(INFO, "REG:" fmt, ##__VA_ARGS__) #else -#define CXGBE_DEBUG_REG(x, args...) do { } while (0) +#define CXGBE_DEBUG_REG(x, fmt, ...) do { } while (0) #endif #ifdef RTE_LIBRTE_CXGBE_DEBUG_MBOX -#define CXGBE_DEBUG_MBOX(x, args...) dev_printf(DEBUG, "MBOX:" args) +#define CXGBE_DEBUG_MBOX(x, fmt, ...) \ + dev_printf(INFO, "MBOX:" fmt, ##__VA_ARGS__) #else -#define CXGBE_DEBUG_MBOX(x, args...) do { } while (0) +#define CXGBE_DEBUG_MBOX(x, fmt, ...) do { } while (0) #endif #ifdef RTE_LIBRTE_CXGBE_DEBUG_TX -#define CXGBE_DEBUG_TX(x, args...) dev_printf(DEBUG, "TX:" args) +#define CXGBE_DEBUG_TX(x, fmt, ...) \ + dev_printf(INFO, "TX:" fmt, ##__VA_ARGS__) #else -#define CXGBE_DEBUG_TX(x, args...) do { } while (0) +#define CXGBE_DEBUG_TX(x, fmt, ...) do { } while (0) #endif #ifdef RTE_LIBRTE_CXGBE_DEBUG_RX -#define CXGBE_DEBUG_RX(x, args...) dev_printf(DEBUG, "RX:" args) +#define CXGBE_DEBUG_RX(x, fmt, ...) \ + dev_printf(INFO, "RX:" fmt, ##__VA_ARGS__) #else -#define CXGBE_DEBUG_RX(x, args...) do { } while (0) +#define CXGBE_DEBUG_RX(x, fmt, ...) do { } while (0) #endif #ifdef RTE_LIBRTE_CXGBE_DEBUG @@ -63,9 +67,9 @@ #define CXGBE_FUNC_TRACE() do { } while (0) #endif -#define pr_err(y, args...) dev_err(0, y, ##args) -#define pr_warn(y, args...) dev_warn(0, y, ##args) -#define pr_info(y, args...) dev_info(0, y, ##args) +#define pr_err(fmt, ...) dev_err(0, fmt, ##__VA_ARGS__) +#define pr_warn(fmt, ...) dev_warn(0, fmt, ##__VA_ARGS__) +#define pr_info(fmt, ...) dev_info(0, fmt, ##__VA_ARGS__) #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__) #define ASSERT(x) do {\ -- 2.18.0
[dpdk-dev] [PATCH 3/4] net/cxgbe: only redefine symbols when not available for Windows
Redefine symbols only when they are not available for Windows Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/t4_hw.c | 4 ++-- drivers/net/cxgbe/base/t4vf_hw.c | 2 +- drivers/net/cxgbe/cxgbe_compat.h | 29 - 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 701e0b1fe..796e2f7f8 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -246,7 +246,7 @@ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, u32 mbox_addr) { for ( ; nflit; nflit--, mbox_addr += 8) - *rpl++ = htobe64(t4_read_reg64(adap, mbox_addr)); + *rpl++ = cpu_to_be64(t4_read_reg64(adap, mbox_addr)); } /* @@ -335,7 +335,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, return -EINVAL; } - bzero(p, size); + memset(p, 0, size); memcpy(p, (const __be64 *)cmd, size); /* diff --git a/drivers/net/cxgbe/base/t4vf_hw.c b/drivers/net/cxgbe/base/t4vf_hw.c index d96456bbe..649bacfb2 100644 --- a/drivers/net/cxgbe/base/t4vf_hw.c +++ b/drivers/net/cxgbe/base/t4vf_hw.c @@ -44,7 +44,7 @@ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, u32 mbox_addr) { for ( ; nflit; nflit--, mbox_addr += 8) - *rpl++ = htobe64(t4_read_reg64(adap, mbox_addr)); + *rpl++ = cpu_to_be64(t4_read_reg64(adap, mbox_addr)); } /** diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index ce4662d54..686ca6e0a 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -18,6 +18,7 @@ #include #include #include +#include #define dev_printf(level, fmt, ...) \ RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__) @@ -149,18 +150,24 @@ typedef uint64_t dma_addr_t; #define false 0 #define true 1 +#ifndef min #define min(a, b) RTE_MIN(a, b) +#endif + +#ifndef max #define max(a, b) RTE_MAX(a, b) +#endif /* * round up val _p to a power of 2 size _s */ #define cxgbe_roundup(_p, _s) (((unsigned long)(_p) + (_s - 1)) & ~(_s - 1)) -#undef container_of +#ifndef container_of #define container_of(ptr, type, member) ({ \ typeof(((type *)0)->member)(*__mptr) = (ptr); \ (type *)((char *)__mptr - offsetof(type, member)); }) +#endif #define ARRAY_SIZE(arr) RTE_DIM(arr) @@ -173,6 +180,26 @@ typedef uint64_t dma_addr_t; #define be64_to_cpu(o) rte_be_to_cpu_64(o) #define le32_to_cpu(o) rte_le_to_cpu_32(o) +#ifndef ntohs +#define ntohs(o) be16_to_cpu(o) +#endif + +#ifndef ntohl +#define ntohl(o) be32_to_cpu(o) +#endif + +#ifndef htons +#define htons(o) cpu_to_be16(o) +#endif + +#ifndef htonl +#define htonl(o) cpu_to_be32(o) +#endif + +#ifndef caddr_t +typedef char *caddr_t; +#endif + #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #define DELAY(x) rte_delay_us(x) #define udelay(x) DELAY(x) -- 2.18.0
[dpdk-dev] [PATCH 4/4] net/cxgbe: fix other misc build issues for Windows
Fix following build errors: warning: function declaration is incompatible with definition error : expected an expression error : expression must be a pointer to a complete object type Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/common.h | 2 +- drivers/net/cxgbe/cxgbe_compat.h | 14 +++--- drivers/net/cxgbe/sge.c | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h index 84311fc95..973d4d7dd 100644 --- a/drivers/net/cxgbe/base/common.h +++ b/drivers/net/cxgbe/base/common.h @@ -522,7 +522,7 @@ void t4_read_rss_key(struct adapter *adap, u32 *key); enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS }; int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid, - unsigned int qtype, u64 *pbar2_qoffset, + enum t4_bar2_qtype qtype, u64 *pbar2_qoffset, unsigned int *pbar2_qid); int t4_init_sge_params(struct adapter *adapter); diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index 686ca6e0a..edc8ea57d 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -276,12 +276,12 @@ static inline void writel_relaxed(unsigned int val, volatile void __iomem *addr) * Multiplies an integer by a fraction, while avoiding unnecessary * overflow or loss of precision. */ -#define mult_frac(x, numer, denom)( \ -{ \ - typeof(x) quot = (x) / (denom); \ - typeof(x) rem = (x) % (denom); \ - (quot * (numer)) + ((rem * (numer)) / (denom)); \ -} \ -) +static inline unsigned int mult_frac(unsigned int x, unsigned int numer, +unsigned int denom) +{ + unsigned int quot = x / denom; + unsigned int rem = x % denom; + return (quot * numer) + ((rem * numer) / denom); +} #endif /* _CXGBE_COMPAT_H_ */ diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index bf0afb138..673c4fbb3 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -397,7 +397,8 @@ static unsigned int refill_fl_usembufs(struct adapter *adap, struct sge_fl *q, rte_mbuf_refcnt_set(mbuf, 1); mbuf->data_off = - (uint16_t)(RTE_PTR_ALIGN((char *)mbuf->buf_addr + + (uint16_t)((char *) + RTE_PTR_ALIGN((char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM, adap->sge.fl_align) - (char *)mbuf->buf_addr); -- 2.18.0
[dpdk-dev] [PATCH 0/2] net/cxgbe: rte_flow related bug fixes
Patch 1 fixes memory corruption due to overlapping regions in TID table. Patch 2 fixes NULL pointer dereference when attempting to parse pattern match items without any spec. Thanks, Rahul Rahul Lakkireddy (2): net/cxgbe: fix overlapping regions in TID table net/cxgbe: skip parsing match items with no spec drivers/net/cxgbe/cxgbe_flow.c | 4 drivers/net/cxgbe/cxgbe_main.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.18.0
[dpdk-dev] [PATCH] net/cxgbe: implement reset hit counters for offloaded flows
Implement logic to reset hit counters for offloaded flows. Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/base/t4_tcb.h | 6 drivers/net/cxgbe/cxgbe_filter.c | 49 drivers/net/cxgbe/cxgbe_filter.h | 2 ++ drivers/net/cxgbe/cxgbe_flow.c | 3 ++ 4 files changed, 60 insertions(+) diff --git a/drivers/net/cxgbe/base/t4_tcb.h b/drivers/net/cxgbe/base/t4_tcb.h index 68cda7730..3c590e053 100644 --- a/drivers/net/cxgbe/base/t4_tcb.h +++ b/drivers/net/cxgbe/base/t4_tcb.h @@ -22,10 +22,16 @@ #define V_TCB_TIMESTAMP(x) ((x) << S_TCB_TIMESTAMP) /* 223:192 */ +#define W_TCB_T_RTT_TS_RECENT_AGE6 #define S_TCB_T_RTT_TS_RECENT_AGE0 #define M_TCB_T_RTT_TS_RECENT_AGE0xULL #define V_TCB_T_RTT_TS_RECENT_AGE(x) ((x) << S_TCB_T_RTT_TS_RECENT_AGE) +/* 255:224 */ +#define S_TCB_T_RTSEQ_RECENT0 +#define M_TCB_T_RTSEQ_RECENT0xULL +#define V_TCB_T_RTSEQ_RECENT(x) ((x) << S_TCB_T_RTSEQ_RECENT) + #define S_TF_CCTRL_RFR62 #endif /* _T4_TCB_DEFS_H */ diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index 3a7912e48..085039e93 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -1304,6 +1304,55 @@ int cxgbe_get_filter_count(struct adapter *adapter, unsigned int fidx, return 0; } +/* + * Clear the packet count for the specified filter. + */ +int cxgbe_clear_filter_count(struct adapter *adapter, unsigned int fidx, +int hash, bool clear_byte) +{ + u64 tcb_mask = 0, tcb_val = 0; + struct filter_entry *f = NULL; + u16 tcb_word = 0; + + if (is_hashfilter(adapter) && hash) { + if (fidx >= adapter->tids.ntids) + return -ERANGE; + + /* No hitcounts supported for T5 hashfilters */ + if (is_t5(adapter->params.chip)) + return 0; + + f = adapter->tids.tid_tab[fidx]; + } else { + if (fidx >= adapter->tids.nftids) + return -ERANGE; + + f = &adapter->tids.ftid_tab[fidx]; + } + + if (!f || !f->valid) + return -EINVAL; + + tcb_word = W_TCB_TIMESTAMP; + tcb_mask = V_TCB_TIMESTAMP(M_TCB_TIMESTAMP); + tcb_val = V_TCB_TIMESTAMP(0ULL); + + set_tcb_field(adapter, f->tid, tcb_word, tcb_mask, tcb_val, 1); + + if (clear_byte) { + tcb_word = W_TCB_T_RTT_TS_RECENT_AGE; + tcb_mask = + V_TCB_T_RTT_TS_RECENT_AGE(M_TCB_T_RTT_TS_RECENT_AGE) | + V_TCB_T_RTSEQ_RECENT(M_TCB_T_RTSEQ_RECENT); + tcb_val = V_TCB_T_RTT_TS_RECENT_AGE(0ULL) | + V_TCB_T_RTSEQ_RECENT(0ULL); + + set_tcb_field(adapter, f->tid, tcb_word, tcb_mask, tcb_val, 1); + } + + return 0; +} + /** * Handle a Hash filter delete reply. */ diff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h index b7bcbf56a..209ede34f 100644 --- a/drivers/net/cxgbe/cxgbe_filter.h +++ b/drivers/net/cxgbe/cxgbe_filter.h @@ -267,4 +267,6 @@ void hash_del_filter_rpl(struct adapter *adap, int validate_filter(struct adapter *adap, struct ch_filter_specification *fs); int cxgbe_get_filter_count(struct adapter *adapter, unsigned int fidx, u64 *c, int hash, bool get_byte); +int cxgbe_clear_filter_count(struct adapter *adapter, unsigned int fidx, +int hash, bool clear_byte); #endif /* _CXGBE_FILTER_H_ */ diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index 7b87bdf58..7278cb485 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -947,6 +947,7 @@ cxgbe_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow, const struct rte_flow_action *action, void *data, struct rte_flow_error *e) { + struct adapter *adap = ethdev2adap(flow->dev); struct ch_filter_specification fs; struct rte_flow_query_count *c; struct filter_entry *f; @@ -985,6 +986,8 @@ cxgbe_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow, /* Query was successful */ c->bytes_set = 1; c->hits_set = 1; + if (c->reset) + cxgbe_clear_filter_count(adap, flow->fidx, f->fs.cap, true); return 0; /* success / partial_success */ } -- 2.18.0
[dpdk-dev] [PATCH 1/2] net/cxgbe: fix overlapping regions in TID table
Location of filter TID table should be after active TID table memory, and not from the beginning of TID table memory. This fixes memory corruption due to overlapping regions. Fixes: 3a381a4116ed ("net/cxgbe: query firmware for HASH filter resources") Cc: sta...@dpdk.org Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index 0368db509..5fa6cdd05 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -415,7 +415,7 @@ static int tid_init(struct tid_info *t) return -ENOMEM; t->atid_tab = (union aopen_entry *)&t->tid_tab[t->ntids]; - t->ftid_tab = (struct filter_entry *)&t->tid_tab[t->natids]; + t->ftid_tab = (struct filter_entry *)&t->atid_tab[t->natids]; t->ftid_bmap_array = t4_os_alloc(ftid_bmap_size); if (!t->ftid_bmap_array) { tid_free(t); -- 2.18.0
[dpdk-dev] [PATCH 2/2] net/cxgbe: skip parsing match items with no spec
Skip parsing pattern match items that have no spec. This fixes NULL dereference when accessing their non-existent spec. Fixes: ee61f5113b17 ("net/cxgbe: parse and validate flows") Cc: sta...@dpdk.org Signed-off-by: Rahul Lakkireddy --- drivers/net/cxgbe/cxgbe_flow.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index 4deaff8f2..7b87bdf58 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -732,6 +732,10 @@ cxgbe_rtef_parse_items(struct rte_flow *flow, "parse items cannot be repeated (except void)"); repeat[i->type] = 1; + /* No spec found for this pattern item. Skip it */ + if (!i->spec) + break; + /* validate the item */ ret = cxgbe_validate_item(i, e); if (ret) -- 2.18.0
Re: [dpdk-dev] [PATCH 2/4] net/cxgbe: fix macros related to logs for Windows
On Tuesday, December 12/18/18, 2018 at 23:55:26 +0530, Ferruh Yigit wrote: > On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote: > > Replace "args..." with "fmt, ..." and directly use __VA_ARGS__. > > What do you mean exactly by "for Windows"? Which compiler? Is there a > specific C > standard version you target? What is the issue with existing macros? > > Since we don't have a Windows support in DPDK, yet, it is not clear what you > are > targeting. > These patches are a pre-requisite to enable compilation for CXGBE PMD for Windows OS. It currently uses Intel C++ compiler [1]. Our plan is to integrate these compilation fixes to dpdk-next-net and then ask for a pull request to pull these to dpdk-draft-windows tree [2]. These existing macros result in following errors in Windows build: # cxgbe_compat.h(28): error : expected a ")" #define dev_printf(level, fmt, args...) \ ^ # cxgbe_compat.h(31): error : expected a ")" #define dev_err(x, args...) dev_printf(ERR, args) [...] [1] https://software.intel.com/en-us/parallel-studio-xe [2] http://git.dpdk.org/draft/dpdk-draft-windows/ Thanks, Rahul
Re: [dpdk-dev] [PATCH 3/4] net/cxgbe: only redefine symbols when not available for Windows
On Tuesday, December 12/18/18, 2018 at 23:56:22 +0530, Ferruh Yigit wrote: > On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote: > > Redefine symbols only when they are not available for Windows > > > > Again "for Windows" is very vague, can you please add more context? > These patches are a pre-requisite to enable compilation for CXGBE PMD for Windows OS. It currently uses Intel C++ compiler [1]. Our plan is to integrate these compilation fixes to dpdk-next-net and then ask for a pull request to pull these to dpdk-draft-windows tree [2]. [1] https://software.intel.com/en-us/parallel-studio-xe [2] http://git.dpdk.org/draft/dpdk-draft-windows/ This patch fixes following issues in Windows build: # cxgbe_compat.h(154): warning #47: incompatible redefinition of macro "min" #define min(a, b) RTE_MIN(a, b) ^ # cxgbe_compat.h(158): warning #47: incompatible redefinition of macro "max" #define max(a, b) RTE_MAX(a, b) ^ # t4_hw.c(249): warning #266: function "htobe64" declared implicitly *rpl++ = htobe64(t4_read_reg64(adap, mbox_addr)); ^ # t4_hw.c(338): warning #266: function "bzero" declared implicitly bzero(p, 0, size); ^ # t4_hw.c(5337): warning #266: function "htonl" declared implicitly rvc.op_to_viid = htonl(V_FW_CMD_OP(FW_RSS_VI_CONFIG_CMD) | ^ # t4_hw.c(5344): warning #266: function "ntohl" declared implicitly p->rss_mode = ntohl(rvc.u.basicvirtual.defaultq_to_udpen); ^ # t4vf_hw.ct4vf_hw.c(47): warning #266: function "htobe64" declared implicitly *rpl++ = htobe64(t4_read_reg64(adap, mbox_addr)); ^ # sge.c(361): error : expected an expression struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, fl); ^ # sge.c(465): warning #266: function "ntohs" declared implicitly int hw_cidx = ntohs(q->stat->cidx); ^ # sge.c(1918): warning #266: function "htons" declared implicitly htons(V_FW_IQ_CMD_IQPCIECH(pciechan) | ^ # sge.c(1350): error : identifier "caddr_t" is undefined static void inline_tx_mbuf(const struct sge_txq *q, caddr_t from, caddr_t *to, ^ Thanks, Rahul
Re: [dpdk-dev] [PATCH 1/4] net/cxgbe: use relative paths for including header files
On Tuesday, December 12/18/18, 2018 at 23:53:38 +0530, Ferruh Yigit wrote: > On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote: > > Explicitly state header file location using relative paths. > > > > Signed-off-by: Rahul Lakkireddy > > --- > > drivers/net/cxgbe/Makefile | 2 -- > > drivers/net/cxgbe/base/adapter.h | 4 ++-- > > drivers/net/cxgbe/base/common.h| 2 +- > > drivers/net/cxgbe/clip_tbl.c | 2 +- > > drivers/net/cxgbe/cxgbe.h | 4 ++-- > > drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- > > drivers/net/cxgbe/cxgbe_filter.c | 7 --- > > drivers/net/cxgbe/cxgbe_filter.h | 2 +- > > drivers/net/cxgbe/cxgbe_flow.c | 2 +- > > drivers/net/cxgbe/cxgbe_main.c | 6 +++--- > > drivers/net/cxgbe/cxgbevf_ethdev.c | 2 +- > > drivers/net/cxgbe/cxgbevf_main.c | 6 +++--- > > drivers/net/cxgbe/l2t.c| 3 ++- > > drivers/net/cxgbe/l2t.h| 2 +- > > drivers/net/cxgbe/mps_tcam.h | 2 +- > > drivers/net/cxgbe/sge.c| 6 +++--- > > 16 files changed, 27 insertions(+), 27 deletions(-) > > > > diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile > > index 68466f13e..d809f4720 100644 > > --- a/drivers/net/cxgbe/Makefile > > +++ b/drivers/net/cxgbe/Makefile > > @@ -9,8 +9,6 @@ include $(RTE_SDK)/mk/rte.vars.mk > > # > > LIB = librte_pmd_cxgbe.a > > > > -CFLAGS += -I$(SRCDIR)/base/ > > -CFLAGS += -I$(SRCDIR) > > CFLAGS += -O3 > > CFLAGS += $(WERROR_FLAGS) > > Hi Rahul, > > What issue do you observe if you don't use relative paths? The Intel C++ compiler [1] is not able to locate the header files without relative path in Windows. We get the following error for these header files. # base\common.h(9): error : cannot open source file "cxgbe_compat.h" #include "cxgbe_compat.h" ^ We could reproduce the same error by removing the above two lines for Linux. To keep it consistent across both OS, I'm using relative paths for both. [1] https://software.intel.com/en-us/parallel-studio-xe Thanks, Rahul
Re: [dpdk-dev] [PATCH 2/4] net/cxgbe: fix macros related to logs for Windows
On Wednesday, December 12/19/18, 2018 at 19:15:39 +0530, Ferruh Yigit wrote: > On 12/19/2018 12:39 PM, Rahul Lakkireddy wrote: > > On Tuesday, December 12/18/18, 2018 at 23:55:26 +0530, Ferruh Yigit wrote: > >> On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote: > >>> Replace "args..." with "fmt, ..." and directly use __VA_ARGS__. > >> > >> What do you mean exactly by "for Windows"? Which compiler? Is there a > >> specific C > >> standard version you target? What is the issue with existing macros? > >> > >> Since we don't have a Windows support in DPDK, yet, it is not clear what > >> you are > >> targeting. > >> > > > > These patches are a pre-requisite to enable compilation for CXGBE PMD for > > Windows OS. It currently uses Intel C++ compiler [1]. Our plan is to > > integrate these compilation fixes to dpdk-next-net and then ask for a > > pull request to pull these to dpdk-draft-windows tree [2]. > > I think that is OK as long as we don't break the existing platforms, which is > the case already. I am asking from documentation / keeping record point of > view. > > Would you mind sending a new version of the patchset, with more detailed > commit > logs, target compiler and its version, target Windows OS and dependencies if > any, the log of the error the patch fixes (like below ones) ? > Sure, will update the commit messages with above information and send a v2. Thanks, Rahul > > > > These existing macros result in following errors in Windows build: > > > > # cxgbe_compat.h(28): error : expected a ")" > > #define dev_printf(level, fmt, args...) \ > >^ > > > > # cxgbe_compat.h(31): error : expected a ")" > > #define dev_err(x, args...) dev_printf(ERR, args) > > > > [...] > > > > [1] https://software.intel.com/en-us/parallel-studio-xe > > [2] http://git.dpdk.org/draft/dpdk-draft-windows/ > > > > Thanks, > > Rahul > > >