[dpdk-dev] [PATCH v2] cryptodev: fix crash on null dereference
crypodev->data->name will be null when rte_cryptodev_get_dev_id() invoked without a valid crypto device instance. Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto devices") Signed-off-by: Jerin JacobAcked-by: Arek Kusztal CC: sta...@dpdk.org --- lib/librte_cryptodev/rte_cryptodev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 127e8d0..54e95d5 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -225,13 +225,14 @@ rte_cryptodev_create_vdev(const char *name, const char *args) } int -rte_cryptodev_get_dev_id(const char *name) { +rte_cryptodev_get_dev_id(const char *name) +{ unsigned i; if (name == NULL) return -1; - for (i = 0; i < rte_cryptodev_globals->max_devs; i++) + for (i = 0; i < rte_cryptodev_globals->nb_devs; i++) if ((strcmp(rte_cryptodev_globals->devs[i].data->name, name) == 0) && (rte_cryptodev_globals->devs[i].attached == -- 2.5.5
[dpdk-dev] [PATCH 3/3] app/testpmd: add ixgbe MACsec offload support
add test for set macsec offload add test for set macsec sc add test for set macsec sa Signed-off-by: Tiwei Bie--- app/test-pmd/cmdline.c | 389 + app/test-pmd/macfwd.c | 2 + app/test-pmd/macswap.c | 2 + app/test-pmd/testpmd.h | 2 + app/test-pmd/txonly.c | 2 + 5 files changed, 397 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 63b55dc..6d61c88 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -274,6 +274,18 @@ static void cmd_help_long_parsed(void *parsed_result, "set vf mac antispoof (port_id) (vf_id) (on|off).\n" "Set MAC antispoof for a VF from the PF.\n\n" + + "set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)\n" + "Enable MACsec offload.\n\n" + + "set macsec offload (port_id) off\n" + "Disable MACsec offload.\n\n" + + "set macsec sc (tx|rx) (port_id) (mac) (pi)\n" + "Configure MACsec secure connection (SC).\n\n" + + "set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)\n" + "Configure MACsec secure association (SA).\n\n" #endif "vlan set strip (on|off) (port_id)\n" @@ -11409,6 +11421,379 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = { NULL, }, }; + +/* MACsec configuration */ + +/* Common result structure for MACsec offload enable */ +struct cmd_macsec_offload_on_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t macsec; + cmdline_fixed_string_t offload; + uint8_t port_id; + cmdline_fixed_string_t on; + cmdline_fixed_string_t encrypt; + cmdline_fixed_string_t en_on_off; + cmdline_fixed_string_t replay_protect; + cmdline_fixed_string_t rp_on_off; +}; + +/* Common CLI fields for MACsec offload disable */ +cmdline_parse_token_string_t cmd_macsec_offload_on_set = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +set, "set"); +cmdline_parse_token_string_t cmd_macsec_offload_on_macsec = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +macsec, "macsec"); +cmdline_parse_token_string_t cmd_macsec_offload_on_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +offload, "offload"); +cmdline_parse_token_string_t cmd_macsec_offload_on_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_macsec_offload_on_result, +port_id, UINT8); +cmdline_parse_token_string_t cmd_macsec_offload_on_on = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +on, "on"); +cmdline_parse_token_string_t cmd_macsec_offload_on_encrypt = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +encrypt, "encrypt"); +cmdline_parse_token_string_t cmd_macsec_offload_on_en_on_off = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +en_on_off, "on#off"); +cmdline_parse_token_string_t cmd_macsec_offload_on_replay_protect = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +replay_protect, "replay-protect"); +cmdline_parse_token_string_t cmd_macsec_offload_on_rp_on_off = + TOKEN_STRING_INITIALIZER + (struct cmd_macsec_offload_on_result, +rp_on_off, "on#off"); + +static void +cmd_set_macsec_offload_on_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_macsec_offload_on_result *res = parsed_result; + int ret; + portid_t port_id = res->port_id; + int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; + int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); + + switch (ret) { + case 0: + break; + case -ENODEV: + printf("invalid port_id %d\n", port_id); + break; + default: + printf("programming error: (%s)\n", strerror(-ret)); + } +} + +cmdline_parse_inst_t cmd_set_macsec_offload_on = { + .f = cmd_set_macsec_offload_on_parsed, + .data = NULL, + .help_str = "set macsec offload port_id on " + "encrypt on|off replay-protect on|off", + .tokens = { + (void *)_macsec_offload_on_set, + (void *)_macsec_offload_on_macsec, +
[dpdk-dev] [PATCH 2/3] net/ixgbe: add MACsec offload support
MACsec (or LinkSec, 802.1AE) is a MAC level encryption/authentication scheme defined in IEEE 802.1AE that uses symmetric cryptography. This commit adds the MACsec offload support for ixgbe. Signed-off-by: Tiwei Bie--- drivers/net/ixgbe/ixgbe_ethdev.c| 436 +++- drivers/net/ixgbe/ixgbe_ethdev.h| 41 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 3 + drivers/net/ixgbe/rte_pmd_ixgbe.h | 98 +++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 11 + 5 files changed, 582 insertions(+), 7 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index edc9b22..2684097 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -232,6 +232,7 @@ static int ixgbe_dev_rss_reta_query(struct rte_eth_dev *dev, static void ixgbe_dev_link_status_print(struct rte_eth_dev *dev); static int ixgbe_dev_lsc_interrupt_setup(struct rte_eth_dev *dev); static int ixgbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev); +static int ixgbe_dev_macsec_interrupt_setup(struct rte_eth_dev *dev); static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev); static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev); static void ixgbe_dev_interrupt_handler(struct rte_intr_handle *handle, @@ -744,6 +745,51 @@ static const struct rte_ixgbe_xstats_name_off rte_ixgbe_stats_strings[] = { #define IXGBE_NB_HW_STATS (sizeof(rte_ixgbe_stats_strings) / \ sizeof(rte_ixgbe_stats_strings[0])) +/* MACsec statistics */ +static const struct rte_ixgbe_xstats_name_off rte_ixgbe_macsec_strings[] = { + {"out_pkts_untagged", offsetof(struct ixgbe_macsec_stats, + out_pkts_untagged)}, + {"out_pkts_encrypted", offsetof(struct ixgbe_macsec_stats, + out_pkts_encrypted)}, + {"out_pkts_protected", offsetof(struct ixgbe_macsec_stats, + out_pkts_protected)}, + {"out_octets_encrypted", offsetof(struct ixgbe_macsec_stats, + out_octets_encrypted)}, + {"out_octets_protected", offsetof(struct ixgbe_macsec_stats, + out_octets_protected)}, + {"in_pkts_untagged", offsetof(struct ixgbe_macsec_stats, + in_pkts_untagged)}, + {"in_pkts_badtag", offsetof(struct ixgbe_macsec_stats, + in_pkts_badtag)}, + {"in_pkts_nosci", offsetof(struct ixgbe_macsec_stats, + in_pkts_nosci)}, + {"in_pkts_unknownsci", offsetof(struct ixgbe_macsec_stats, + in_pkts_unknownsci)}, + {"in_octets_decrypted", offsetof(struct ixgbe_macsec_stats, + in_octets_decrypted)}, + {"in_octets_validated", offsetof(struct ixgbe_macsec_stats, + in_octets_validated)}, + {"in_pkts_unchecked", offsetof(struct ixgbe_macsec_stats, + in_pkts_unchecked)}, + {"in_pkts_delayed", offsetof(struct ixgbe_macsec_stats, + in_pkts_delayed)}, + {"in_pkts_late", offsetof(struct ixgbe_macsec_stats, + in_pkts_late)}, + {"in_pkts_ok", offsetof(struct ixgbe_macsec_stats, + in_pkts_ok)}, + {"in_pkts_invalid", offsetof(struct ixgbe_macsec_stats, + in_pkts_invalid)}, + {"in_pkts_notvalid", offsetof(struct ixgbe_macsec_stats, + in_pkts_notvalid)}, + {"in_pkts_unusedsa", offsetof(struct ixgbe_macsec_stats, + in_pkts_unusedsa)}, + {"in_pkts_notusingsa", offsetof(struct ixgbe_macsec_stats, + in_pkts_notusingsa)}, +}; + +#define IXGBE_NB_MACSEC_STATS (sizeof(rte_ixgbe_macsec_strings) / \ + sizeof(rte_ixgbe_macsec_strings[0])) + /* Per-queue statistics */ static const struct rte_ixgbe_xstats_name_off rte_ixgbe_rxq_strings[] = { {"mbuf_allocation_errors", offsetof(struct ixgbe_hw_stats, rnbc)}, @@ -2380,6 +2426,8 @@ ixgbe_dev_start(struct rte_eth_dev *dev) rte_intr_dp_is_en(intr_handle)) ixgbe_dev_rxq_interrupt_setup(dev); + ixgbe_dev_macsec_interrupt_setup(dev); + /* enable uio/vfio intr/eventfd mapping */ rte_intr_enable(intr_handle); @@ -2557,6 +2605,7 @@ ixgbe_dev_close(struct rte_eth_dev *dev) static void ixgbe_read_stats_registers(struct ixgbe_hw *hw, struct ixgbe_hw_stats *hw_stats, + struct ixgbe_macsec_stats *macsec_stats, uint64_t *total_missed_rx, uint64_t *total_qbrc, uint64_t *total_qprc, uint64_t *total_qprdc) { @@ -2726,6 +2775,40 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw, /* Flow Director Stats registers */ hw_stats->fdirmatch += IXGBE_READ_REG(hw, IXGBE_FDIRMATCH); hw_stats->fdirmiss += IXGBE_READ_REG(hw, IXGBE_FDIRMISS); + + /* MACsec Stats registers */ + macsec_stats->out_pkts_untagged += IXGBE_READ_REG(hw,
[dpdk-dev] [PATCH 0/3] Add MACsec offload support for ixgbe
This patch set adds the MACsec offload support for ixgbe. The testpmd is also updated to support MACsec cmds. Tiwei Bie (3): lib: add MACsec offload flags net/ixgbe: add MACsec offload support app/testpmd: add ixgbe MACsec offload support app/test-pmd/cmdline.c | 389 + app/test-pmd/macfwd.c | 2 + app/test-pmd/macswap.c | 2 + app/test-pmd/testpmd.h | 2 + app/test-pmd/txonly.c | 2 + drivers/net/ixgbe/ixgbe_ethdev.c| 436 +++- drivers/net/ixgbe/ixgbe_ethdev.h| 41 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 3 + drivers/net/ixgbe/rte_pmd_ixgbe.h | 98 +++ drivers/net/ixgbe/rte_pmd_ixgbe_version.map | 11 + lib/librte_ether/rte_ethdev.h | 2 + lib/librte_mbuf/rte_mbuf.h | 5 + 12 files changed, 986 insertions(+), 7 deletions(-) -- 2.7.4
[dpdk-dev] [PATCH 3/3] net/ixgbe: optimize Rx/Tx log message level
Signed-off-by: Qiming Yang--- drivers/net/ixgbe/ixgbe_logs.h | 7 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 14 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_logs.h b/drivers/net/ixgbe/ixgbe_logs.h index 53ba42d..68e47fd 100644 --- a/drivers/net/ixgbe/ixgbe_logs.h +++ b/drivers/net/ixgbe/ixgbe_logs.h @@ -50,6 +50,13 @@ #define PMD_RX_LOG(level, fmt, args...) do { } while(0) #endif +#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX_FREE +#define PMD_RX_FREE_LOG(level, fmt, args...) \ + RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +#else +#define PMD_RX_FREE_LOG(level, fmt, args...) do { } while (0) +#endif + #ifdef RTE_LIBRTE_IXGBE_DEBUG_TX #define PMD_TX_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index b2d9f45..b52c793 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1560,7 +1560,7 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, if (ixgbe_rx_alloc_bufs(rxq, true) != 0) { int i, j; - PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u " + PMD_RX_LOG(ERR, "RX mbuf alloc failed port_id=%u " "queue_id=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id); @@ -1701,7 +1701,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nmb = rte_mbuf_raw_alloc(rxq->mb_pool); if (nmb == NULL) { - PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u " + PMD_RX_LOG(ERR, "RX mbuf alloc failed port_id=%u " "queue_id=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id); rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++; @@ -1799,7 +1799,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); if (nb_hold > rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " + PMD_RX_FREE_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " "nb_hold=%u nb_rx=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id, (unsigned) rx_id, (unsigned) nb_hold, @@ -1972,7 +1972,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, if (!bulk_alloc) { nmb = rte_mbuf_raw_alloc(rxq->mb_pool); if (nmb == NULL) { - PMD_RX_LOG(DEBUG, "RX mbuf alloc failed " + PMD_RX_LOG(ERR, "RX mbuf alloc failed " "port_id=%u queue_id=%u", rxq->port_id, rxq->queue_id); @@ -1989,7 +1989,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, next_rdt); nb_hold -= rxq->rx_free_thresh; } else { - PMD_RX_LOG(DEBUG, "RX bulk alloc failed " + PMD_RX_FREE_LOG(DEBUG, "RX bulk alloc failed " "port_id=%u queue_id=%u", rxq->port_id, rxq->queue_id); @@ -2152,7 +2152,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, * hardware point of view... */ if (!bulk_alloc && nb_hold > rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " + PMD_RX_FREE_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " "nb_hold=%u nb_rx=%u", rxq->port_id, rxq->queue_id, rx_id, nb_hold, nb_rx); @@ -4763,7 +4763,7 @@ ixgbe_setup_loopback_link_82599(struct ixgbe_hw *hw) if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM) != IXGBE_SUCCESS) { - PMD_INIT_LOG(ERR, "Could not enable loopback mode"); + PMD_INIT_LOG(WARNING, "Could not enable loopback mode"); /* ignore error */ return; } -- 2.7.4
[dpdk-dev] [PATCH 2/3] net/i40e: optimize Rx/Tx log message level
Signed-off-by: Qiming Yang--- drivers/net/i40e/i40e_logs.h | 7 +++ drivers/net/i40e/i40e_rxtx.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_logs.h b/drivers/net/i40e/i40e_logs.h index e042e24..5c25dbf 100644 --- a/drivers/net/i40e/i40e_logs.h +++ b/drivers/net/i40e/i40e_logs.h @@ -50,6 +50,13 @@ #define PMD_RX_LOG(level, fmt, args...) do { } while(0) #endif +#ifdef RTE_LIBRTE_I40E_DEBUG_RX_FREE +#define PMD_RX_FREE_LOG(level, fmt, args...) \ + RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +#else +#define PMD_RX_FREE_LOG(level, fmt, args...) do { } while (0) +#endif + #ifdef RTE_LIBRTE_I40E_DEBUG_TX #define PMD_TX_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 7ae7d9f..ef25fb1 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -612,7 +612,7 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (i40e_rx_alloc_bufs(rxq) != 0) { uint16_t i, j; - PMD_RX_LOG(DEBUG, "Rx mbuf alloc failed for " + PMD_RX_LOG(ERR, "Rx mbuf alloc failed for " "port_id=%u, queue_id=%u", rxq->port_id, rxq->queue_id); rxq->rx_nb_avail = 0; -- 2.7.4
[dpdk-dev] [PATCH 0/3] net: optimize Rx/Tx log message level
These three patches optimized the level of Rx and Tx log messages. Add a new log control function PMD_RX_FREE_LOG to control the Rx message which is not printed in packet receive processing. This function switched by macro RTE_LIBRTE__DEBUG_RX_FREE. Qiming Yang (3): net/e1000: optimize Rx/Tx log message level net/i40e: optimize Rx/Tx log message level net/ixgbe: optimize Rx/Tx log message level config/common_base | 1 + drivers/net/e1000/e1000_logs.h | 7 +++ drivers/net/e1000/em_rxtx.c| 10 +- drivers/net/e1000/igb_rxtx.c | 10 +- drivers/net/i40e/i40e_logs.h | 7 +++ drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_logs.h | 7 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 14 +++--- 8 files changed, 40 insertions(+), 18 deletions(-) -- 2.7.4
[dpdk-dev] [PATCH 1/3] net/e1000: optimize Rx/Tx log message level
Signed-off-by: Qiming Yang--- config/common_base | 1 + drivers/net/e1000/e1000_logs.h | 7 +++ drivers/net/e1000/em_rxtx.c| 10 +- drivers/net/e1000/igb_rxtx.c | 10 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/config/common_base b/config/common_base index 4bff83a..46e9797 100644 --- a/config/common_base +++ b/config/common_base @@ -143,6 +143,7 @@ CONFIG_RTE_LIBRTE_EM_PMD=y CONFIG_RTE_LIBRTE_IGB_PMD=y CONFIG_RTE_LIBRTE_E1000_DEBUG_INIT=n CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n +CONFIG_RTE_LIBRTE_E1000_DEBUG_RX_FREE=n CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=n CONFIG_RTE_LIBRTE_E1000_DEBUG_TX_FREE=n CONFIG_RTE_LIBRTE_E1000_DEBUG_DRIVER=n diff --git a/drivers/net/e1000/e1000_logs.h b/drivers/net/e1000/e1000_logs.h index 81e7bf5..407c245 100644 --- a/drivers/net/e1000/e1000_logs.h +++ b/drivers/net/e1000/e1000_logs.h @@ -50,6 +50,13 @@ #define PMD_RX_LOG(level, fmt, args...) do { } while(0) #endif +#ifdef RTE_LIBRTE_E1000_DEBUG_RX_FREE +#define PMD_RX_FREE_LOG(level, fmt, args...) \ + RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +#else +#define PMD_RX_FREE_LOG(level, fmt, args...) do { } while (0) +#endif + #ifdef RTE_LIBRTE_E1000_DEBUG_TX #define PMD_TX_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 41f51c0..673af85 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -721,7 +721,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nmb = rte_mbuf_raw_alloc(rxq->mb_pool); if (nmb == NULL) { - PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u " + PMD_RX_LOG(ERR, "RX mbuf alloc failed port_id=%u " "queue_id=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id); @@ -806,7 +806,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); if (nb_hold > rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " + PMD_RX_FREE_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " "nb_hold=%u nb_rx=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id, (unsigned) rx_id, (unsigned) nb_hold, @@ -901,7 +901,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nmb = rte_mbuf_raw_alloc(rxq->mb_pool); if (nmb == NULL) { - PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u " + PMD_RX_LOG(ERR, "RX mbuf alloc failed port_id=%u " "queue_id=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id); rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++; @@ -1051,7 +1051,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); if (nb_hold > rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " + PMD_RX_FREE_LOG(DEBUG, "port_id=%u queue_id=%u rx_tail=%u " "nb_hold=%u nb_rx=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id, (unsigned) rx_id, (unsigned) nb_hold, @@ -1391,7 +1391,7 @@ eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) uint32_t desc = 0; if (rx_queue_id >= dev->data->nb_rx_queues) { - PMD_RX_LOG(DEBUG, "Invalid RX queue_id=%d", rx_queue_id); + PMD_RX_LOG(ERR, "Invalid RX queue_id=%d", rx_queue_id); return 0; } diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index dbd37ac..b8e67c7 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -832,7 +832,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nmb = rte_mbuf_raw_alloc(rxq->mb_pool); if (nmb == NULL) { - PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u " + PMD_RX_LOG(ERR, "RX mbuf alloc failed port_id=%u " "queue_id=%u", (unsigned) rxq->port_id, (unsigned) rxq->queue_id); rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++; @@ -919,7 +919,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); if (nb_hold > rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG,
[dpdk-dev] [PATCH 25/25] net/qede: update PMD version to 2.0.0.1
Signed-off-by: Rasesh Mody--- drivers/net/qede/qede_ethdev.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index 9701d736..be54f31e 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -46,8 +46,8 @@ /* Driver versions */ #define QEDE_PMD_VER_PREFIX"QEDE PMD" -#define QEDE_PMD_VERSION_MAJOR 1 -#define QEDE_PMD_VERSION_MINOR 2 +#define QEDE_PMD_VERSION_MAJOR 2 +#define QEDE_PMD_VERSION_MINOR 0 #define QEDE_PMD_VERSION_REVISION 0 #define QEDE_PMD_VERSION_PATCH 1 -- 2.11.0.rc1
[dpdk-dev] [PATCH 24/25] net/qede/base: dcbx changes for base driver
This patch includes changes for DCBX like: - Return empty parameters for oper-params query when negotiation is not complete - Use the ieee specific mask value for reading the ethtype value in the ieee dcbx mode - Endian-ness conversion is not needed for priority<->TC field, as the data is already being read/written by ecore in the bigendian way - While writing the ets config, base driver incorrectly merges the input values with the operational values. The values should be either set or unset - CEE selection field must be set regardless CEE/IEEE mode - Fail the dcbx query for VF interfaces - Semantic changes Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore.h | 3 + drivers/net/qede/base/ecore_dcbx.c | 375 ++--- drivers/net/qede/base/ecore_dcbx_api.h | 1 + drivers/net/qede/base/ecore_dev.c | 24 ++- 4 files changed, 185 insertions(+), 218 deletions(-) diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index b1b0a2ed..b41ff4a2 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -373,6 +373,9 @@ struct ecore_hw_info { u32 port_mode; u32 hw_mode; unsigned long device_capabilities; + + /* Default DCBX mode */ + u8 dcbx_mode; }; struct ecore_hw_cid_data { diff --git a/drivers/net/qede/base/ecore_dcbx.c b/drivers/net/qede/base/ecore_dcbx.c index 5932948a..9fbddec0 100644 --- a/drivers/net/qede/base/ecore_dcbx.c +++ b/drivers/net/qede/base/ecore_dcbx.c @@ -28,99 +28,75 @@ static bool ecore_dcbx_app_ethtype(u32 app_info_bitmap) { - return (ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF) == - DCBX_APP_SF_ETHTYPE) ? true : false; + return !!(ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF) == + DCBX_APP_SF_ETHTYPE); } -static bool ecore_dcbx_app_port(u32 app_info_bitmap) -{ - return (ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF) == - DCBX_APP_SF_PORT) ? true : false; -} - -static bool ecore_dcbx_ieee_app_port(u32 app_info_bitmap, u8 type) +static bool ecore_dcbx_ieee_app_ethtype(u32 app_info_bitmap) { u8 mfw_val = ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF_IEEE); /* Old MFW */ if (mfw_val == DCBX_APP_SF_IEEE_RESERVED) - return ecore_dcbx_app_port(app_info_bitmap); + return ecore_dcbx_app_ethtype(app_info_bitmap); - return (mfw_val == type || mfw_val == DCBX_APP_SF_IEEE_TCP_UDP_PORT) ? - true : false; + return !!(mfw_val == DCBX_APP_SF_IEEE_ETHTYPE); } -static bool ecore_dcbx_default_tlv(u32 app_info_bitmap, u16 proto_id) +static bool ecore_dcbx_app_port(u32 app_info_bitmap) { - return (ecore_dcbx_app_ethtype(app_info_bitmap) && - proto_id == ECORE_ETH_TYPE_DEFAULT) ? true : false; + return !!(ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF) == + DCBX_APP_SF_PORT); } -static bool ecore_dcbx_enabled(u32 dcbx_cfg_bitmap) +static bool ecore_dcbx_ieee_app_port(u32 app_info_bitmap, u8 type) { - return (ECORE_MFW_GET_FIELD(dcbx_cfg_bitmap, DCBX_CONFIG_VERSION) == - DCBX_CONFIG_VERSION_DISABLED) ? false : true; -} + u8 mfw_val = ECORE_MFW_GET_FIELD(app_info_bitmap, DCBX_APP_SF_IEEE); -static bool ecore_dcbx_cee(u32 dcbx_cfg_bitmap) -{ - return (ECORE_MFW_GET_FIELD(dcbx_cfg_bitmap, DCBX_CONFIG_VERSION) == - DCBX_CONFIG_VERSION_CEE) ? true : false; -} + /* Old MFW */ + if (mfw_val == DCBX_APP_SF_IEEE_RESERVED) + return ecore_dcbx_app_port(app_info_bitmap); -static bool ecore_dcbx_ieee(u32 dcbx_cfg_bitmap) -{ - return (ECORE_MFW_GET_FIELD(dcbx_cfg_bitmap, DCBX_CONFIG_VERSION) == - DCBX_CONFIG_VERSION_IEEE) ? true : false; + return !!(mfw_val == type || mfw_val == DCBX_APP_SF_IEEE_TCP_UDP_PORT); } -static bool ecore_dcbx_local(u32 dcbx_cfg_bitmap) +static bool ecore_dcbx_default_tlv(u32 app_info_bitmap, u16 proto_id, bool ieee) { - return (ECORE_MFW_GET_FIELD(dcbx_cfg_bitmap, DCBX_CONFIG_VERSION) == - DCBX_CONFIG_VERSION_STATIC) ? true : false; + bool ethtype; + + if (ieee) + ethtype = ecore_dcbx_ieee_app_ethtype(app_info_bitmap); + else + ethtype = ecore_dcbx_app_ethtype(app_info_bitmap); + + return !!(ethtype && (proto_id == ECORE_ETH_TYPE_DEFAULT)); } static void ecore_dcbx_dp_protocol(struct ecore_hwfn *p_hwfn, struct ecore_dcbx_results *p_data) { - struct ecore_hw_info *p_info = _hwfn->hw_info; enum dcbx_protocol_type id; - u8 prio, tc, size, update; - bool enable; - const char *name; /* @DPDK */ int i; - size = OSAL_ARRAY_SIZE(ecore_dcbx_app_update); + DP_VERBOSE(p_hwfn, ECORE_MSG_DCB, "DCBX negotiated: %d\n", +
[dpdk-dev] [PATCH 23/25] net/qede/base: semantic/formatting changes
This patch consists of semantic/formatting changes. It also includes comment additions. Signed-off-by: Rasesh Mody--- drivers/net/qede/base/common_hsi.h | 5 +- drivers/net/qede/base/ecore_dev.c| 53 --- drivers/net/qede/base/ecore_hsi_common.h | 14 +- drivers/net/qede/base/ecore_hw.c | 4 +- drivers/net/qede/base/ecore_init_ops.c | 23 ++- drivers/net/qede/base/ecore_int.c| 6 +- drivers/net/qede/base/ecore_mcp.c| 5 +- drivers/net/qede/base/ecore_spq.c| 3 +- drivers/net/qede/base/ecore_sriov.c | 8 +- drivers/net/qede/base/mcp_public.h | 262 +++ 10 files changed, 186 insertions(+), 197 deletions(-) diff --git a/drivers/net/qede/base/common_hsi.h b/drivers/net/qede/base/common_hsi.h index 4083e86d..2f84148e 100644 --- a/drivers/net/qede/base/common_hsi.h +++ b/drivers/net/qede/base/common_hsi.h @@ -721,8 +721,7 @@ union event_ring_data { u8 bytes[8] /* Byte Array */; struct vf_pf_channel_eqe_data vf_pf_channel /* VF-PF Channel data */; struct iscsi_eqe_data iscsi_info /* Dedicated fields to iscsi data */; - /* Dedicated field for RoCE affiliated asynchronous error */; - struct regpair roceHandle; + struct regpair roceHandle /* Dedicated field for RDMA data */; struct malicious_vf_eqe_data malicious_vf /* Malicious VF data */; struct initial_cleanup_eqe_data vf_init_cleanup /* VF Initial Cleanup data */; @@ -766,6 +765,8 @@ enum protocol_type { MAX_PROTOCOL_TYPE }; + + /* * Ustorm Queue Zone */ diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index 15db09fc..b7540286 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -70,28 +70,26 @@ static u32 ecore_hw_bar_size(struct ecore_hwfn *p_hwfn, enum BAR_ID bar_id) } val = ecore_rd(p_hwfn, p_hwfn->p_main_ptt, bar_reg); + if (val) + return 1 << (val + 15); /* The above registers were updated in the past only in CMT mode. Since * they were found to be useful MFW started updating them from 8.7.7.0. * In older MFW versions they are set to 0 which means disabled. */ - if (!val) { - if (p_hwfn->p_dev->num_hwfns > 1) { - DP_NOTICE(p_hwfn, false, - "BAR size not configured. Assuming BAR size"); - DP_NOTICE(p_hwfn, false, - "of 256kB for GRC and 512kB for DB\n"); - return BAR_ID_0 ? 256 * 1024 : 512 * 1024; - } else { - DP_NOTICE(p_hwfn, false, - "BAR size not configured. Assuming BAR size"); - DP_NOTICE(p_hwfn, false, - "of 512kB for GRC and 512kB for DB\n"); - return 512 * 1024; - } + if (p_hwfn->p_dev->num_hwfns > 1) { + DP_NOTICE(p_hwfn, false, + "BAR size not configured. Assuming BAR size of 256kB" + " for GRC and 512kB for DB\n"); + val = BAR_ID_0 ? 256 * 1024 : 512 * 1024; + } else { + DP_NOTICE(p_hwfn, false, + "BAR size not configured. Assuming BAR size of 512kB" + " for GRC and 512kB for DB\n"); + val = 512 * 1024; } - return 1 << (val + 15); + return val; } void ecore_init_dp(struct ecore_dev *p_dev, @@ -1623,7 +1621,8 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev, u32 load_code, param; int i; - if (p_params->int_mode == ECORE_INT_MODE_MSI && p_dev->num_hwfns > 1) { + if ((p_params->int_mode == ECORE_INT_MODE_MSI) && + (p_dev->num_hwfns > 1)) { DP_NOTICE(p_dev, false, "MSI mode is not supported for CMT devices\n"); return ECORE_INVAL; @@ -2784,11 +2783,14 @@ ecore_get_hw_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, ecore_mcp_cmd_port_init(p_hwfn, p_ptt); } - if (personality != ECORE_PCI_DEFAULT) + if (personality != ECORE_PCI_DEFAULT) { p_hwfn->hw_info.personality = personality; - else if (ecore_mcp_is_init(p_hwfn)) - p_hwfn->hw_info.personality = - p_hwfn->mcp_info->func_info.protocol; + } else if (ecore_mcp_is_init(p_hwfn)) { + enum ecore_pci_personality protocol; + + protocol = p_hwfn->mcp_info->func_info.protocol; + p_hwfn->hw_info.personality = protocol; + } #ifndef ASIC_ONLY /* To overcome ILT lack for emulation, until at least until we'll have @@ -2937,8 +2939,9 @@ void ecore_prepare_hibernate(struct ecore_dev
[dpdk-dev] [PATCH 18/25] net/qede/base: add support for external PHY
Add support for external PHY BCM8485x. Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_mcp.c | 6 +-- drivers/net/qede/base/mcp_public.h | 88 -- 2 files changed, 87 insertions(+), 7 deletions(-) diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c index 5d40c1ed..adcb0f09 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -838,11 +838,9 @@ enum _ecore_status_t ecore_mcp_set_link(struct ecore_hwfn *p_hwfn, if (b_up) DP_VERBOSE(p_hwfn, ECORE_MSG_LINK, "Configuring Link: Speed 0x%08x, Pause 0x%08x," - " adv_speed 0x%08x, loopback 0x%08x," - " features 0x%08x\n", + " adv_speed 0x%08x, loopback 0x%08x\n", p_phy_cfg->speed, p_phy_cfg->pause, - p_phy_cfg->adv_speed, p_phy_cfg->loopback_mode, - p_phy_cfg->feature_config_flags); + p_phy_cfg->adv_speed, p_phy_cfg->loopback_mode); else DP_VERBOSE(p_hwfn, ECORE_MSG_LINK, "Resetting link\n"); diff --git a/drivers/net/qede/base/mcp_public.h b/drivers/net/qede/base/mcp_public.h index 96efc3c8..b8a9ae3a 100644 --- a/drivers/net/qede/base/mcp_public.h +++ b/drivers/net/qede/base/mcp_public.h @@ -84,9 +84,32 @@ struct eth_phy_cfg { /* Remote Serdes Loopback (RX to TX) */ #define ETH_LOOPBACK_INT_PHY_FEA_AH_ONLY (9) - /* features */ - u32 feature_config_flags; -#define ETH_EEE_MODE_ADV_LPI (1 << 0) + /* Used to configure the EEE Tx LPI timer, has several modes of +* operation, according to bits 29:28 +* 2'b00: Timer will be configured by nvram, output will be the value +*from nvram. +* 2'b01: Timer will be configured by nvram, output will be in +*16xmicroseconds. +* 2'b10: bits 1:0 contain an nvram value which will be used instead +*of the one located in the nvram. Output will be that value. +* 2'b11: bits 19:0 contain the idle timer in microseconds; output +*will be in 16xmicroseconds. +* Bits 31:30 should be 2'b11 in order for EEE to be enabled. +*/ + u32 eee_mode; +#define EEE_MODE_TIMER_USEC_MASK (0x000f) +#define EEE_MODE_TIMER_USEC_OFFSET (0) +#define EEE_MODE_TIMER_USEC_BALANCED_TIME (0xa00) +#define EEE_MODE_TIMER_USEC_AGGRESSIVE_TIME(0x100) +#define EEE_MODE_TIMER_USEC_LATENCY_TIME (0x6000) +/* Set by the driver to request status timer will be in microseconds and and not + * in EEE policy definition + */ +#define EEE_MODE_OUTPUT_TIME (1 << 28) +/* Set by the driver to override default nvm timer */ +#define EEE_MODE_OVERRIDE_NVRAM(1 << 29) +#define EEE_MODE_ENABLE_LPI(1 << 30) /* Set when */ +#define EEE_MODE_ADV_LPI (1 << 31) /* Set when EEE is enabled */ }; struct port_mf_cfg { @@ -447,6 +470,14 @@ struct public_global { #define MDUMP_REASON_INTERNAL_ERROR(1 << 0) #define MDUMP_REASON_EXTERNAL_TRIGGER (1 << 1) #define MDUMP_REASON_DUMP_AGED (1 << 2) + u32 ext_phy_upgrade_fw; +#define EXT_PHY_FW_UPGRADE_STATUS_MASK (0x) +#define EXT_PHY_FW_UPGRADE_STATUS_SHIFT(0) +#define EXT_PHY_FW_UPGRADE_STATUS_IN_PROGRESS (1) +#define EXT_PHY_FW_UPGRADE_STATUS_FAILED (2) +#define EXT_PHY_FW_UPGRADE_STATUS_SUCCESS (3) +#define EXT_PHY_FW_UPGRADE_TYPE_MASK (0x) +#define EXT_PHY_FW_UPGRADE_TYPE_SHIFT (16) }; /**/ @@ -597,6 +628,7 @@ struct public_port { #define LINK_STATUS_FEC_MODE_NONE (0 << 27) #define LINK_STATUS_FEC_MODE_FIRECODE_CL74 (1 << 27) #define LINK_STATUS_FEC_MODE_RS_CL91 (2 << 27) +#define LINK_STATUS_EXT_PHY_LINK_UP0x4000 u32 link_status1; u32 ext_phy_fw_version; @@ -718,6 +750,39 @@ struct public_port { u32 wol_pkt_len; u32 wol_pkt_details; struct dcb_dscp_map dcb_dscp_map; + + /* the status of EEE auto-negotiation +* bits 19:0 the configured tx-lpi entry timer value. Depends on bit 31. +* bits 23:20 the speeds advertised for EEE. +* bits 27:24 the speeds the Link partner advertised for EEE. +* The supported/adv. modes in bits 27:19 originate from the +* SHMEM_EEE_XXX_ADV definitions (where XXX is replaced by speed). +* bit 28 when 1'b1 EEE was requested. +* bit 29 when 1'b1 tx lpi was requested. +* bit 30 when 1'b1 EEE was negotiated. Tx lpi will be asserted if 30:29 +*are 2'b11. +* bit 31 - When 1'b0 bits 15:0 contain +*
[dpdk-dev] [PATCH 17/25] net/qede/base: retrieve FW crash dump info
As part of device probe, check if management FW crash dump logs are available. If available, then log an warning message and update the epoch value too. A new struct ecore_mdump_info is added to populate dump info including the new "reason" field by reading shared memory region. Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_dev.c | 18 +++--- drivers/net/qede/base/ecore_dev_api.h | 4 +-- drivers/net/qede/base/ecore_mcp.c | 66 ++- drivers/net/qede/base/ecore_mcp.h | 22 drivers/net/qede/base/ecore_mcp_api.h | 33 +++--- drivers/net/qede/qede_main.c | 2 +- 6 files changed, 87 insertions(+), 58 deletions(-) diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index 0da95c65..86b4bffc 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -1761,10 +1761,6 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev, return mfw_rc; } - ecore_mcp_mdump_get_info(p_hwfn, p_hwfn->p_main_ptt); - ecore_mcp_mdump_set_values(p_hwfn, p_hwfn->p_main_ptt, - p_params->epoch); - /* send DCBX attention request command */ DP_VERBOSE(p_hwfn, ECORE_MSG_DCB, "sending phony dcbx set command to trigger DCBx attention handling\n"); @@ -2962,6 +2958,7 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void OSAL_IOMEM *p_regview, struct ecore_hw_prepare_params *p_params) { struct ecore_dev *p_dev = p_hwfn->p_dev; + struct ecore_mdump_info mdump_info; enum _ecore_status_t rc = ECORE_SUCCESS; /* Split PCI bars evenly between hwfns */ @@ -3024,6 +3021,19 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void OSAL_IOMEM *p_regview, DP_NOTICE(p_hwfn, false, "Failed to initiate PF FLR\n"); } + /* Check if mdump logs are present and update the epoch value */ + if (p_hwfn == ECORE_LEADING_HWFN(p_hwfn->p_dev)) { + rc = ecore_mcp_mdump_get_info(p_hwfn, p_hwfn->p_main_ptt, + _info); + if (rc == ECORE_SUCCESS && mdump_info.num_of_logs > 0) { + DP_NOTICE(p_hwfn, false, + "* * * IMPORTANT - HW ERROR register dump captured by device * * *\n"); + } + + ecore_mcp_mdump_set_values(p_hwfn, p_hwfn->p_main_ptt, + p_params->epoch); + } + /* Allocate the init RT array and initialize the init-ops engine */ rc = ecore_init_alloc(p_hwfn); if (rc) { diff --git a/drivers/net/qede/base/ecore_dev_api.h b/drivers/net/qede/base/ecore_dev_api.h index 0ec02b5b..0dee68a9 100644 --- a/drivers/net/qede/base/ecore_dev_api.h +++ b/drivers/net/qede/base/ecore_dev_api.h @@ -68,8 +68,6 @@ struct ecore_hw_init_params { bool allow_npar_tx_switch; /* binary fw data pointer in binary fw file */ const u8 *bin_fw_data; - /* the OS Epoch time in seconds */ - u32 epoch; }; /** @@ -149,6 +147,8 @@ struct ecore_hw_prepare_params { bool chk_reg_fifo; /* request the MFW to initiate PF FLR */ bool initiate_pf_flr; + /* the OS Epoch time in seconds */ + u32 epoch; }; /** diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c index a5d707b2..5d40c1ed 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -1098,16 +1098,9 @@ enum _ecore_status_t ecore_mcp_mdump_trigger(struct ecore_hwfn *p_hwfn, { u32 mcp_resp; - return ecore_mcp_mdump_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_MDUMP_TRIGGER, - OSAL_NULL, OSAL_NULL, _resp); -} - -enum _ecore_status_t ecore_mcp_mdump_clear_logs(struct ecore_hwfn *p_hwfn, - struct ecore_ptt *p_ptt) -{ - u32 mcp_resp; + p_hwfn->p_dev->mdump_en = true; - return ecore_mcp_mdump_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_MDUMP_CLEAR_LOGS, + return ecore_mcp_mdump_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_MDUMP_TRIGGER, OSAL_NULL, OSAL_NULL, _resp); } @@ -1141,32 +1134,56 @@ ecore_mcp_mdump_get_config(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, return rc; } -enum _ecore_status_t ecore_mcp_mdump_get_info(struct ecore_hwfn *p_hwfn, - struct ecore_ptt *p_ptt) +enum _ecore_status_t +ecore_mcp_mdump_get_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, +struct ecore_mdump_info *p_mdump_info) { + u32 addr, global_offsize, global_addr; struct mdump_config_stc mdump_config; enum _ecore_status_t
[dpdk-dev] [PATCH 13/25] net/qede/base: add new enum member to status codes
Add ECORE_CONN_RESET to enum ecore_status. Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_status.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/qede/base/ecore_status.h b/drivers/net/qede/base/ecore_status.h index 6277bc80..c77ec260 100644 --- a/drivers/net/qede/base/ecore_status.h +++ b/drivers/net/qede/base/ecore_status.h @@ -10,6 +10,7 @@ #define __ECORE_STATUS_H__ enum _ecore_status_t { + ECORE_CONN_RESET = -13, ECORE_UNKNOWN_ERROR = -12, ECORE_NORESOURCES= -11, ECORE_NODEV = -10, -- 2.11.0.rc1
[dpdk-dev] [PATCH 14/25] net/qede/base: add macros for converting pointer
Add macros PTR_LO and PTR_HI (for converting pointer to HI and LOW bits for passing to FW hsi handles). Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_utils.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/qede/base/ecore_utils.h b/drivers/net/qede/base/ecore_utils.h index 616b44c2..034cf1eb 100644 --- a/drivers/net/qede/base/ecore_utils.h +++ b/drivers/net/qede/base/ecore_utils.h @@ -10,6 +10,12 @@ #define __ECORE_UTILS_H__ /* dma_addr_t manip */ +/* Suppress "right shift count >= width of type" warning when that quantity is + * 32-bits rquires the >> 16) >> 16) + */ +#define PTR_LO(x) ((u32)(((osal_uintptr_t)(x)) & 0x)) +#define PTR_HI(x) ((u32)osal_uintptr_t)(x)) >> 16) >> 16)) + #define DMA_LO(x) ((u32)(((dma_addr_t)(x)) & 0x)) #define DMA_HI(x) ((u32)(((dma_addr_t)(x)) >> 32)) -- 2.11.0.rc1
[dpdk-dev] [PATCH 08/25] net/qede/base: fix updating VF queue zone id
Pass the absolute qzone_id when creating queues. Fixes: 5cdd769a ("qede: add L2 support") Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_dev.c| 9 ++--- drivers/net/qede/base/ecore_l2.c | 10 +- drivers/net/qede/base/ecore_l2_api.h | 11 +-- drivers/net/qede/base/ecore_sriov.c | 1 + drivers/net/qede/qede_eth_if.c | 1 + 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index 1d906b73..8b7d1da0 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -542,11 +542,14 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev) /* Allocate Memory for the Queue->CID mapping */ for_each_hwfn(p_dev, i) { struct ecore_hwfn *p_hwfn = _dev->hwfns[i]; + u32 num_tx_conns = RESC_NUM(p_hwfn, ECORE_L2_QUEUE); + int tx_size, rx_size; /* @@@TMP - resc management, change to actual required size */ - int tx_size = sizeof(struct ecore_hw_cid_data) * - RESC_NUM(p_hwfn, ECORE_L2_QUEUE); - int rx_size = sizeof(struct ecore_hw_cid_data) * + if (p_hwfn->pf_params.eth_pf_params.num_cons > num_tx_conns) + num_tx_conns = p_hwfn->pf_params.eth_pf_params.num_cons; + tx_size = sizeof(struct ecore_hw_cid_data) * num_tx_conns; + rx_size = sizeof(struct ecore_hw_cid_data) * RESC_NUM(p_hwfn, ECORE_L2_QUEUE); p_hwfn->p_tx_cids = OSAL_ZALLOC(p_hwfn->p_dev, GFP_KERNEL, diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c index b139c398..9cb554c6 100644 --- a/drivers/net/qede/base/ecore_l2.c +++ b/drivers/net/qede/base/ecore_l2.c @@ -663,7 +663,7 @@ ecore_sp_eth_rx_queue_start(struct ecore_hwfn *p_hwfn, if (IS_VF(p_hwfn->p_dev)) { return ecore_vf_pf_rxq_start(p_hwfn, -p_params->queue_id, +(u8)p_params->queue_id, p_params->sb, (u8)p_params->sb_idx, bd_max_bytes, @@ -840,9 +840,9 @@ ecore_sp_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn, struct ecore_spq_entry *p_ent = OSAL_NULL; struct ecore_sp_init_data init_data; struct ecore_hw_cid_data *p_tx_cid; - u16 pq_id, abs_tx_q_id = 0; - u8 abs_vport_id; + u16 pq_id, abs_tx_qzone_id = 0; enum _ecore_status_t rc = ECORE_NOTIMPL; + u8 abs_vport_id; /* Store information for the stop */ p_tx_cid = _hwfn->p_tx_cids[p_params->queue_id]; @@ -853,7 +853,7 @@ ecore_sp_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn, if (rc != ECORE_SUCCESS) return rc; - rc = ecore_fw_l2_queue(p_hwfn, p_params->queue_id, _tx_q_id); + rc = ecore_fw_l2_queue(p_hwfn, p_params->qzone_id, _tx_qzone_id); if (rc != ECORE_SUCCESS) return rc; @@ -876,7 +876,7 @@ ecore_sp_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn, p_ramrod->sb_index = (u8)p_params->sb_idx; p_ramrod->stats_counter_id = p_params->stats_id; - p_ramrod->queue_zone_id = OSAL_CPU_TO_LE16(abs_tx_q_id); + p_ramrod->queue_zone_id = OSAL_CPU_TO_LE16(abs_tx_qzone_id); p_ramrod->pbl_size = OSAL_CPU_TO_LE16(pbl_size); DMA_REGPAIR_LE(p_ramrod->pbl_base_addr, pbl_addr); diff --git a/drivers/net/qede/base/ecore_l2_api.h b/drivers/net/qede/base/ecore_l2_api.h index c12d97c9..247316b8 100644 --- a/drivers/net/qede/base/ecore_l2_api.h +++ b/drivers/net/qede/base/ecore_l2_api.h @@ -28,10 +28,17 @@ enum ecore_rss_caps { #endif struct ecore_queue_start_common_params { - /* Rx/Tx queue id */ - u8 queue_id; + /* Rx/Tx queue relative id to keep obtained cid in corresponding array +* RX - upper-bounded by number of FW-queues +*/ + u16 queue_id; u8 vport_id; + /* q_zone_id is relative, may be different from queue id +* currently used by Tx-only, upper-bounded by number of FW-queues +*/ + u8 qzone_id; + /* stats_id is relative or absolute depends on function */ u8 stats_id; u16 sb; diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index bdf91647..0e2b3248 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -2107,6 +2107,7 @@ static void ecore_iov_vf_mbx_start_txq(struct ecore_hwfn *p_hwfn, goto out; p_params.queue_id = (u8)vf->vf_queues[req->tx_qid].fw_tx_qid; + p_params.qzone_id = (u8)vf->vf_queues[req->tx_qid].fw_tx_qid; p_params.vport_id = vf->vport_id; p_params.stats_id =
[dpdk-dev] [PATCH 05/25] net/qede/base: make API non-static
Move ecore_set_fw_mac_addr from ecore_l2.c to ecore_dev.c to facilitate future code reuse. Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore.h | 2 ++ drivers/net/qede/base/ecore_dev.c | 13 + drivers/net/qede/base/ecore_l2.c | 11 --- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index c9f3b003..19e9e020 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -811,6 +811,8 @@ int ecore_configure_pf_min_bandwidth(struct ecore_dev *p_dev, u8 min_bw); void ecore_clean_wfq_db(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt); int ecore_device_num_engines(struct ecore_dev *p_dev); int ecore_device_num_ports(struct ecore_dev *p_dev); +void ecore_set_fw_mac_addr(__le16 *fw_msb, __le16 *fw_mid, __le16 *fw_lsb, + u8 *mac); #define ECORE_LEADING_HWFN(dev)(>hwfns[0]) diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index d7a95fed..1d906b73 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -4297,3 +4297,16 @@ int ecore_device_num_ports(struct ecore_dev *p_dev) return p_dev->num_ports_in_engines * ecore_device_num_engines(p_dev); } + +void ecore_set_fw_mac_addr(__le16 *fw_msb, + __le16 *fw_mid, + __le16 *fw_lsb, + u8 *mac) +{ + ((u8 *)fw_msb)[0] = mac[1]; + ((u8 *)fw_msb)[1] = mac[0]; + ((u8 *)fw_mid)[0] = mac[3]; + ((u8 *)fw_mid)[1] = mac[2]; + ((u8 *)fw_lsb)[0] = mac[5]; + ((u8 *)fw_lsb)[1] = mac[4]; +} diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c index 9989ee48..b139c398 100644 --- a/drivers/net/qede/base/ecore_l2.c +++ b/drivers/net/qede/base/ecore_l2.c @@ -1012,17 +1012,6 @@ ecore_filter_action(enum ecore_filter_opcode opcode) return action; } -static void ecore_set_fw_mac_addr(__le16 *fw_msb, - __le16 *fw_mid, __le16 *fw_lsb, u8 *mac) -{ - ((u8 *)fw_msb)[0] = mac[1]; - ((u8 *)fw_msb)[1] = mac[0]; - ((u8 *)fw_mid)[0] = mac[3]; - ((u8 *)fw_mid)[1] = mac[2]; - ((u8 *)fw_lsb)[0] = mac[5]; - ((u8 *)fw_lsb)[1] = mac[4]; -} - static enum _ecore_status_t ecore_filter_ucast_common(struct ecore_hwfn *p_hwfn, u16 opaque_fid, -- 2.11.0.rc1
[dpdk-dev] [PATCH 07/25] net/qede/base: add check to validate txq
Make sure VF tx_qid and the status block index is in the allocated range, else fail the request. Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_sriov.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index afc1db3f..bdf91647 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -2099,26 +2099,26 @@ static void ecore_iov_vf_mbx_start_txq(struct ecore_hwfn *p_hwfn, pq_params.eth.is_vf = 1; pq_params.eth.vf_id = vf->relative_vf_id; - req = >req_virt->start_txq; OSAL_MEMSET(_params, 0, sizeof(p_params)); + req = >req_virt->start_txq; + + if (!ecore_iov_validate_txq(p_hwfn, vf, req->tx_qid) || + !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb)) + goto out; + p_params.queue_id = (u8)vf->vf_queues[req->tx_qid].fw_tx_qid; p_params.vport_id = vf->vport_id; p_params.stats_id = vf->abs_vf_id + 0x10, p_params.sb = req->hw_sb; p_params.sb_idx = req->sb_index; - if (!ecore_iov_validate_txq(p_hwfn, vf, req->tx_qid) || - !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb)) - goto out; - - rc = ecore_sp_eth_txq_start_ramrod( - p_hwfn, - vf->opaque_fid, - vf->vf_queues[req->tx_qid].fw_cid, - _params, - req->pbl_addr, - req->pbl_size, - _params); + rc = ecore_sp_eth_txq_start_ramrod(p_hwfn, + vf->opaque_fid, + vf->vf_queues[req->tx_qid].fw_cid, + _params, + req->pbl_addr, + req->pbl_size, + _params); if (rc) status = PFVF_STATUS_FAILURE; -- 2.11.0.rc1
[dpdk-dev] [PATCH 02/25] net/qede/base: improve set field macro
Improve robustness of the SET_FIELD macro by using a mask. Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index 907b35b9..c9f3b003 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -80,7 +80,7 @@ enum ecore_nvm_cmd { #define SET_FIELD(value, name, flag) \ do { \ (value) &= ~(name##_MASK << name##_SHIFT); \ - (value) |= (((u64)flag) << (name##_SHIFT)); \ + (value) |= u64)flag) & (u64)name##_MASK) << (name##_SHIFT));\ } while (0) #define GET_FIELD(value, name) \ -- 2.11.0.rc1
Re: [dpdk-dev] [PATCH 3/4] crypto: add sgl support for sw PMDs
2016-12-02 18:07 GMT+01:00 Tomasz Kulasek: > This patch introduces RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER feature flag > informing that selected crypto device supports segmented mbufs natively > and doesn't need to be coalesced before crypto operation. > > While using segmented buffers in crypto devices may have unpredictable > results, for PMDs which doesn't support it natively, additional check is > made for debug compilation. > [...] > +#ifdef RTE_LIBRTE_PMD_AESNI_GCM_DEBUG > + if (!rte_pktmbuf_is_contiguous(ops[i]->sym->m_src) || > + (ops[i]->sym->m_dst != NULL && > + !rte_pktmbuf_is_contiguous( > + ops[i]->sym->m_dst))) { > + ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; > + GCM_LOG_ERR("PMD supports only contiguous mbufs, " > + "op (%p) provides noncontiguous mbuf as " > + "source/destination buffer.\n", ops[i]); > + qp->qp_stats.enqueue_err_count++; > + break; > + } > +#endif [...] Why are there so many copies of this code? Best Regards, Michał Mirosław
[dpdk-dev] [PATCH 3/8] net/qede/base: fix multiple acquisition requests by VF
There are certain conditions under which VF would infinitely send ACQUIRE messages, as it will fail to understand that PF has rejected the ACQUIRE request. Fix to reject multiple acquisition requests by VF. Fixes: 22d07d93 ("net/qede/base: update") Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_vf.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c index be8b1ec4..161b3176 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -296,6 +296,14 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn) VFPF_ACQUIRE_CAP_PRE_FP_HSI; } } + + /* If PF/VF are using same Major, PF must have had +* it's reasons. Simply fail. +*/ + DP_NOTICE(p_hwfn, false, + "PF rejected acquisition by VF\n"); + rc = ECORE_INVAL; + goto exit; } else { DP_ERR(p_hwfn, "PF returned err %d to VF acquisition request\n", -- 2.11.0.rc1
[dpdk-dev] [PATCH 6/8] net/qede/base: fix Rx queue access by malicious VFs
8.10.x.x was supposed to prevent malicious VFs from using out-of-bound queue indices, but apparently Rx queue access is still done prior to the index being validated by PF. Fixes: 98bc693e ("net/qede/base: change queue start") Signed-off-by: Rasesh Mody--- drivers/net/qede/base/ecore_sriov.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index de54b9a0..12552966 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -1968,6 +1968,11 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn, enum _ecore_status_t rc; req = >req_virt->start_rxq; + + if (!ecore_iov_validate_rxq(p_hwfn, vf, req->rx_qid) || + !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb)) + goto out; + OSAL_MEMSET(_params, 0, sizeof(p_params)); p_params.queue_id = (u8)vf->vf_queues[req->rx_qid].fw_rx_qid; p_params.vf_qid = req->rx_qid; @@ -1976,10 +1981,6 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn, p_params.sb = req->hw_sb; p_params.sb_idx = req->sb_index; - if (!ecore_iov_validate_rxq(p_hwfn, vf, req->rx_qid) || - !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb)) - goto out; - /* Legacy VFs have their Producers in a different location, which they * calculate on their own and clean the producer prior to this. */ -- 2.11.0.rc1
[dpdk-dev] [PATCH 1/8] net/qede: fix to get vendor/device id info
Fixes: ec94dbc5 ("qede: add base driver") Signed-off-by: Rasesh Mody--- drivers/net/qede/qede_ethdev.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 9c2a5eae..b9a325df 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -2071,6 +2071,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) rte_eth_copy_pci_info(eth_dev, pci_dev); + /* @DPDK */ + edev->vendor_id = pci_dev->id.vendor_id; + edev->device_id = pci_dev->id.device_id; + qed_ops = qed_get_eth_ops(); if (!qed_ops) { DP_ERR(edev, "Failed to get qed_eth_ops_pass\n"); -- 2.11.0.rc1
[dpdk-dev] [PATCH 7/7] net/qede: restrict maximum queues for PF/VF
Fix to adverstise max_rx_queues by taking into account the number of PF connections instead of returning max_queues supported by the HW. Fixes: 2ea6f76a ("qede: add core driver") Signed-off-by: Harish Patil--- drivers/net/qede/qede_ethdev.c | 13 ++--- drivers/net/qede/qede_ethdev.h | 3 +++ drivers/net/qede/qede_main.c | 5 - 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 10abb8b..9c2a5ea 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -973,8 +973,15 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) dev_info->max_rx_pktlen = (uint32_t)ETH_TX_MAX_NON_LSO_PKT_LEN; dev_info->rx_desc_lim = qede_rx_desc_lim; dev_info->tx_desc_lim = qede_tx_desc_lim; - dev_info->max_rx_queues = (uint16_t)QEDE_MAX_RSS_CNT(qdev); + + if (IS_PF(edev)) + dev_info->max_rx_queues = (uint16_t)RTE_MIN( + QEDE_MAX_RSS_CNT(qdev), QEDE_PF_NUM_CONNS / 2); + else + dev_info->max_rx_queues = (uint16_t)RTE_MIN( + QEDE_MAX_RSS_CNT(qdev), ECORE_MAX_VF_CHAINS_PER_PF); dev_info->max_tx_queues = dev_info->max_rx_queues; + dev_info->max_mac_addrs = qdev->dev_info.num_mac_addrs; dev_info->max_vfs = 0; dev_info->reta_size = ECORE_RSS_IND_TABLE_SIZE; @@ -2015,9 +2022,9 @@ int qede_dev_filter_ctrl(struct rte_eth_dev *eth_dev, static void qede_update_pf_params(struct ecore_dev *edev) { struct ecore_pf_params pf_params; - /* 32 rx + 32 tx */ + memset(_params, 0, sizeof(struct ecore_pf_params)); - pf_params.eth_pf_params.num_cons = 64; + pf_params.eth_pf_params.num_cons = QEDE_PF_NUM_CONNS; qed_ops->common->update_pf_params(edev, _params); } diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index bd85ba3..95e06ef 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -115,6 +115,9 @@ extern char fw_file[]; +/* Number of PF connections - 32 RX + 32 TX */ +#define QEDE_PF_NUM_CONNS (64) + /* Port/function states */ enum qede_dev_state { QEDE_DEV_INIT, /* Init the chip and Slowpath */ diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index b7202c8..2c88329 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -399,11 +399,6 @@ static int qed_slowpath_start(struct ecore_dev *edev, if (edev->num_hwfns > 1) { ecore_vf_get_num_rxqs(>hwfns[1], ); info->num_queues += queues; - /* Restrict 100G VF to advertise 16 queues till the -* required support is available to go beyond 16. -*/ - info->num_queues = RTE_MIN(info->num_queues, - ECORE_MAX_VF_CHAINS_PER_PF); } ecore_vf_get_num_vlan_filters(>hwfns[0], -- 1.8.3.1
[dpdk-dev] [PATCH 6/7] net/qede: fix maximum VF count to 0
Set max_vfs to 0 since it is relevant only to SR-IOV PF which is not supported yet. Fixes: 2ea6f76a ("qede: add core driver") Signed-off-by: Harish Patil--- drivers/net/qede/qede_ethdev.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index ee8fb43..10abb8b 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -976,10 +976,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) dev_info->max_rx_queues = (uint16_t)QEDE_MAX_RSS_CNT(qdev); dev_info->max_tx_queues = dev_info->max_rx_queues; dev_info->max_mac_addrs = qdev->dev_info.num_mac_addrs; - if (IS_VF(edev)) - dev_info->max_vfs = 0; - else - dev_info->max_vfs = (uint16_t)NUM_OF_VFS(>edev); + dev_info->max_vfs = 0; dev_info->reta_size = ECORE_RSS_IND_TABLE_SIZE; dev_info->hash_key_size = ECORE_RSS_KEY_SIZE * sizeof(uint32_t); dev_info->flow_type_rss_offloads = (uint64_t)QEDE_RSS_OFFLOAD_ALL; -- 1.8.3.1
[dpdk-dev] [PATCH 5/7] net/qede: fix RSS related issue
This patch includes the following: - Fix missing hash_key_size advertisement - Fix RSS hash query function - Update RSS offload flag - Accept user provided RSS configuration params via rx_adv_conf in dev_configure() - Decouple RSS configuration from common qed_update_vport() and instead make use of existing RSS APIs for default RSS configuration Fixes: 6d9e26c4 ("net/qede: get RSS hash configuration") Fixes: 9c5d0a66 ("net/qede: fix RSS") Signed-off-by: Harish Patil--- drivers/net/qede/qede_eth_if.c | 79 + drivers/net/qede/qede_eth_if.h | 9 +- drivers/net/qede/qede_ethdev.c | 254 ++--- drivers/net/qede/qede_ethdev.h | 9 +- drivers/net/qede/qede_rxtx.c | 90 +-- drivers/net/qede/qede_rxtx.h | 10 +- 6 files changed, 239 insertions(+), 212 deletions(-) diff --git a/drivers/net/qede/qede_eth_if.c b/drivers/net/qede/qede_eth_if.c index 30fded0..7d21200 100644 --- a/drivers/net/qede/qede_eth_if.c +++ b/drivers/net/qede/qede_eth_if.c @@ -68,6 +68,33 @@ static int qed_stop_vport(struct ecore_dev *edev, uint8_t vport_id) return 0; } +bool qed_update_rss_parm_cmt(struct ecore_dev *edev, uint16_t *p_tbl) +{ + uint16_t max = 0, k; + bool rss_mode = 0; /* disable */ + int divisor; + + /* Find largest entry, since it's possible RSS needs to +* be disabled [in case only 1 queue per-hwfn] +*/ + for (k = 0; k < ECORE_RSS_IND_TABLE_SIZE; k++) + max = (max > p_tbl[k]) ? max : p_tbl[k]; + + /* Either fix RSS values or disable RSS */ + if (edev->num_hwfns < max + 1) { + divisor = (max + edev->num_hwfns - 1) / edev->num_hwfns; + DP_VERBOSE(edev, ECORE_MSG_SPQ, + "CMT - fixing RSS values (modulo %02x)\n", + divisor); + for (k = 0; k < ECORE_RSS_IND_TABLE_SIZE; k++) + p_tbl[k] = p_tbl[k] % divisor; + + rss_mode = 1; + } + + return rss_mode; +} + static int qed_update_vport(struct ecore_dev *edev, struct qed_update_vport_params *params) { @@ -94,58 +121,6 @@ static int qed_stop_vport(struct ecore_dev *edev, uint8_t vport_id) params->update_accept_any_vlan_flg; sp_params.mtu = params->mtu; - /* RSS - is a bit tricky, since upper-layer isn't familiar with hwfns. -* We need to re-fix the rss values per engine for CMT. -*/ - - if (edev->num_hwfns > 1 && params->update_rss_flg) { - struct qed_update_vport_rss_params *rss = >rss_params; - int k, max = 0; - - /* Find largest entry, since it's possible RSS needs to -* be disabled [in case only 1 queue per-hwfn] -*/ - for (k = 0; k < ECORE_RSS_IND_TABLE_SIZE; k++) - max = (max > rss->rss_ind_table[k]) ? - max : rss->rss_ind_table[k]; - - /* Either fix RSS values or disable RSS */ - if (edev->num_hwfns < max + 1) { - int divisor = (max + edev->num_hwfns - 1) / - edev->num_hwfns; - - DP_VERBOSE(edev, ECORE_MSG_SPQ, - "CMT - fixing RSS values (modulo %02x)\n", - divisor); - - for (k = 0; k < ECORE_RSS_IND_TABLE_SIZE; k++) - rss->rss_ind_table[k] = - rss->rss_ind_table[k] % divisor; - } else { - DP_VERBOSE(edev, ECORE_MSG_SPQ, - "CMT - 1 queue per-hwfn; Disabling RSS\n"); - params->update_rss_flg = 0; - } - } - - /* Now, update the RSS configuration for actual configuration */ - if (params->update_rss_flg) { - sp_rss_params.update_rss_config = 1; - sp_rss_params.rss_enable = 1; - sp_rss_params.update_rss_capabilities = 1; - sp_rss_params.update_rss_ind_table = 1; - sp_rss_params.update_rss_key = 1; - sp_rss_params.rss_caps = ECORE_RSS_IPV4 | ECORE_RSS_IPV6 | - ECORE_RSS_IPV4_TCP | ECORE_RSS_IPV6_TCP; - sp_rss_params.rss_table_size_log = 7; /* 2^7 = 128 */ - rte_memcpy(sp_rss_params.rss_ind_table, - params->rss_params.rss_ind_table, - ECORE_RSS_IND_TABLE_SIZE * sizeof(uint16_t)); - rte_memcpy(sp_rss_params.rss_key, params->rss_params.rss_key, - ECORE_RSS_KEY_SIZE * sizeof(uint32_t)); - sp_params.rss_params = _rss_params; - } - for_each_hwfn(edev, i) { struct ecore_hwfn *p_hwfn = >hwfns[i]; diff --git a/drivers/net/qede/qede_eth_if.h
[dpdk-dev] [PATCH 4/7] net/qede: add fastpath support for VXLAN tunneling
- Support HW checksum and RSS offload for VXLAN traffic - Identify inner/outer packet_types using lookup table - Update documentation Signed-off-by: Harish Patil--- doc/guides/nics/features/qede.ini | 3 + doc/guides/nics/qede.rst | 3 +- drivers/net/qede/qede_eth_if.h| 3 + drivers/net/qede/qede_ethdev.c| 18 +-- drivers/net/qede/qede_ethdev.h| 3 + drivers/net/qede/qede_main.c | 2 + drivers/net/qede/qede_rxtx.c | 280 +++--- drivers/net/qede/qede_rxtx.h | 46 +++ 8 files changed, 269 insertions(+), 89 deletions(-) diff --git a/doc/guides/nics/features/qede.ini b/doc/guides/nics/features/qede.ini index 7d75030..8858e5d 100644 --- a/doc/guides/nics/features/qede.ini +++ b/doc/guides/nics/features/qede.ini @@ -23,6 +23,9 @@ CRC offload = Y VLAN offload = Y L3 checksum offload = Y L4 checksum offload = Y +Tunnel filter= Y +Inner L3 checksum= Y +Inner L4 checksum= Y Packet type parsing = Y Basic stats = Y Extended stats = Y diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst index ddf4248..e7332dc 100644 --- a/doc/guides/nics/qede.rst +++ b/doc/guides/nics/qede.rst @@ -59,12 +59,13 @@ Supported Features - MTU change - Multiprocess aware - Scatter-Gather +- VXLAN tunneling offload Non-supported Features -- - SR-IOV PF -- Tunneling offloads +- GENEVE and NVGRE Tunneling offloads - LRO/TSO - NPAR diff --git a/drivers/net/qede/qede_eth_if.h b/drivers/net/qede/qede_eth_if.h index 9c0db87..d67b312 100644 --- a/drivers/net/qede/qede_eth_if.h +++ b/drivers/net/qede/qede_eth_if.h @@ -42,6 +42,9 @@ struct qed_dev_eth_info { struct ether_addr port_mac; uint16_t num_vlan_filters; uint32_t num_mac_addrs; + + /* Legacy VF - this affects the datapath */ + bool is_legacy; }; struct qed_update_vport_rss_params { diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index bd728c8..e8d4157 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -919,14 +919,16 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) .txq_flags = QEDE_TXQ_FLAGS, }; - dev_info->rx_offload_capa = (DEV_RX_OFFLOAD_VLAN_STRIP | -DEV_RX_OFFLOAD_IPV4_CKSUM | -DEV_RX_OFFLOAD_UDP_CKSUM | -DEV_RX_OFFLOAD_TCP_CKSUM); - dev_info->tx_offload_capa = (DEV_TX_OFFLOAD_VLAN_INSERT | -DEV_TX_OFFLOAD_IPV4_CKSUM | -DEV_TX_OFFLOAD_UDP_CKSUM | -DEV_TX_OFFLOAD_TCP_CKSUM); + dev_info->rx_offload_capa = (DEV_RX_OFFLOAD_VLAN_STRIP | +DEV_RX_OFFLOAD_IPV4_CKSUM | +DEV_RX_OFFLOAD_UDP_CKSUM | +DEV_RX_OFFLOAD_TCP_CKSUM | +DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM); + dev_info->tx_offload_capa = (DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM); memset(, 0, sizeof(struct qed_link_output)); qdev->ops->common->get_link(edev, ); diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index 6d0616e..d736246 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -15,6 +15,7 @@ #include #include #include +#include /* ecore includes */ #include "base/bcm_osal.h" @@ -184,6 +185,8 @@ static int qede_rss_reta_update(struct rte_eth_dev *eth_dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size); +static inline uint32_t qede_rx_cqe_to_pkt_type(uint16_t flags); + /* Non-static functions */ void qede_init_rss_caps(uint8_t *rss_caps, uint64_t hf); diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index 03058cb..b7202c8 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -411,6 +411,8 @@ static int qed_slowpath_start(struct ecore_dev *edev, ecore_vf_get_port_mac(>hwfns[0], (uint8_t *)>port_mac); + + info->is_legacy = ecore_vf_get_pre_fp_hsi(>hwfns[0]); } qed_fill_dev_info(edev, >common); diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 2e181c8..6daf193 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -701,79 +701,64 @@ static int qede_start_queues(struct rte_eth_dev *eth_dev, bool
[dpdk-dev] [PATCH 1/7] net/qede: reduce noise in debug logs
From: Rasesh ModyReplace CONFIG_RTE_LIBRTE_QEDE_DEBUG_DRIVER with CONFIG_RTE_LIBRTE_QEDE_DEBUG_VAL which is a 32-bit bitmapped value where each bit represent a particular submodule to debug. Also move notice messages under CONFIG_RTE_LIBRTE_QEDE_DEBUG_INFO. Signed-off-by: Harish Patil Signed-off-by: Rasesh Mody --- config/common_base | 2 +- doc/guides/nics/qede.rst | 4 ++-- drivers/net/qede/qede_ethdev.c | 4 ++-- drivers/net/qede/qede_logs.h | 21 + 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/config/common_base b/config/common_base index 4bff83a..2ffd557 100644 --- a/config/common_base +++ b/config/common_base @@ -320,7 +320,7 @@ CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n CONFIG_RTE_LIBRTE_QEDE_PMD=y CONFIG_RTE_LIBRTE_QEDE_DEBUG_INIT=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_INFO=n -CONFIG_RTE_LIBRTE_QEDE_DEBUG_DRIVER=n +CONFIG_RTE_LIBRTE_QEDE_DEBUG_VAL=0 CONFIG_RTE_LIBRTE_QEDE_DEBUG_TX=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_RX=n #Provides abs path/name of the firmware file. diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst index d22ecdd..ddf4248 100644 --- a/doc/guides/nics/qede.rst +++ b/doc/guides/nics/qede.rst @@ -103,9 +103,9 @@ enabling debugging options may affect system performance. Toggle display of generic debugging messages. -- ``CONFIG_RTE_LIBRTE_QEDE_DEBUG_DRIVER`` (default **n**) +- ``CONFIG_RTE_LIBRTE_QEDE_DEBUG_VAL`` (default **0**) - Toggle display of ecore related messages. + Control driver debug verbosity using 32-bit bitmap flags. - ``CONFIG_RTE_LIBRTE_QEDE_DEBUG_TX`` (default **n**) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 2c600c1..69cedd8 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1393,8 +1393,8 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) uint8_t is_mac_forced; bool is_mac_exist; /* Fix up ecore debug level */ - uint32_t dp_module = ~0 & ~ECORE_MSG_HW; - uint8_t dp_level = ECORE_LEVEL_VERBOSE; + uint32_t dp_module = RTE_LIBRTE_QEDE_DEBUG_VAL; + uint8_t dp_level = ECORE_LEVEL_NOTICE; uint32_t max_mac_addrs; int rc; diff --git a/drivers/net/qede/qede_logs.h b/drivers/net/qede/qede_logs.h index 45c4af0..08fdf04 100644 --- a/drivers/net/qede/qede_logs.h +++ b/drivers/net/qede/qede_logs.h @@ -16,15 +16,18 @@ (p_dev)->name ? (p_dev)->name : "", \ ##__VA_ARGS__) +#ifdef RTE_LIBRTE_QEDE_DEBUG_INFO #define DP_NOTICE(p_dev, is_assert, fmt, ...) \ rte_log(RTE_LOG_NOTICE, RTE_LOGTYPE_PMD,\ "[QEDE PMD: (%s)]%s:" fmt, \ (p_dev)->name ? (p_dev)->name : "", \ __func__, \ ##__VA_ARGS__) +#else +#define DP_NOTICE(p_dev, fmt, ...) do { } while (0) +#endif #ifdef RTE_LIBRTE_QEDE_DEBUG_INFO - #define DP_INFO(p_dev, fmt, ...) \ rte_log(RTE_LOG_INFO, RTE_LOGTYPE_PMD, \ "[%s:%d(%s)]" fmt, \ @@ -33,10 +36,8 @@ ##__VA_ARGS__) #else #define DP_INFO(p_dev, fmt, ...) do { } while (0) - #endif -#ifdef RTE_LIBRTE_QEDE_DEBUG_DRIVER #define DP_VERBOSE(p_dev, module, fmt, ...) \ do { \ if ((p_dev)->dp_module & module) \ @@ -46,9 +47,7 @@ (p_dev)->name ? (p_dev)->name : "", \ ##__VA_ARGS__); \ } while (0) -#else -#define DP_VERBOSE(p_dev, fmt, ...) do { } while (0) -#endif + #define PMD_INIT_LOG(level, edev, fmt, args...)\ rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD, \ @@ -77,14 +76,4 @@ #define PMD_RX_LOG(level, q, fmt, args...) do { } while (0) #endif -#ifdef RTE_LIBRTE_QEDE_DEBUG_DRIVER -#define PMD_DRV_LOG_RAW(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) -#else -#define PMD_DRV_LOG_RAW(level, fmt, args...) do { } while (0) -#endif - -#define PMD_DRV_LOG(level, fmt, args...) \ - PMD_DRV_LOG_RAW(level, fmt "\n", ## args) - #endif /* _QEDE_LOGS_H_ */ -- 1.8.3.1
[dpdk-dev] [PATCH 2/7] net/qede: refactor filtering code
The filter_config in qed_eth_ops_pass is a wrapper call driving all the filtering configuration. This requires defining multiple structures and passing different function arguments for each filter type which is unnecessary. So as part of this refactoring we remove filter_config from qed_eth_ops_pass and invoke base apis directly. Another change is to use a singly list for unicast/multicast macs and thereby prevent duplicate entries. This change is primarily intended to support future tunneling support which makes use of existing L2 filtering/classifications. Fixes: 2ea6f76a ("qede: add core driver") Signed-off-by: Harish Patil--- drivers/net/qede/qede_eth_if.c | 101 +- drivers/net/qede/qede_eth_if.h | 36 + drivers/net/qede/qede_ethdev.c | 303 - drivers/net/qede/qede_ethdev.h | 15 ++ 4 files changed, 230 insertions(+), 225 deletions(-) diff --git a/drivers/net/qede/qede_eth_if.c b/drivers/net/qede/qede_eth_if.c index 1ae6127..30fded0 100644 --- a/drivers/net/qede/qede_eth_if.c +++ b/drivers/net/qede/qede_eth_if.c @@ -310,86 +310,11 @@ static void qed_fastpath_start(struct ecore_dev *edev) ecore_get_vport_stats(edev, stats); } -static int -qed_configure_filter_ucast(struct ecore_dev *edev, - struct qed_filter_ucast_params *params) -{ - struct ecore_filter_ucast ucast; - - if (!params->vlan_valid && !params->mac_valid) { - DP_NOTICE(edev, true, - "Tried configuring a unicast filter," - "but both MAC and VLAN are not set\n"); - return -EINVAL; - } - - memset(, 0, sizeof(ucast)); - switch (params->type) { - case QED_FILTER_XCAST_TYPE_ADD: - ucast.opcode = ECORE_FILTER_ADD; - break; - case QED_FILTER_XCAST_TYPE_DEL: - ucast.opcode = ECORE_FILTER_REMOVE; - break; - case QED_FILTER_XCAST_TYPE_REPLACE: - ucast.opcode = ECORE_FILTER_REPLACE; - break; - default: - DP_NOTICE(edev, true, "Unknown unicast filter type %d\n", - params->type); - } - - if (params->vlan_valid && params->mac_valid) { - ucast.type = ECORE_FILTER_MAC_VLAN; - ether_addr_copy((struct ether_addr *)>mac, - (struct ether_addr *)); - ucast.vlan = params->vlan; - } else if (params->mac_valid) { - ucast.type = ECORE_FILTER_MAC; - ether_addr_copy((struct ether_addr *)>mac, - (struct ether_addr *)); - } else { - ucast.type = ECORE_FILTER_VLAN; - ucast.vlan = params->vlan; - } - - ucast.is_rx_filter = true; - ucast.is_tx_filter = true; - - return ecore_filter_ucast_cmd(edev, , ECORE_SPQ_MODE_CB, NULL); -} - -static int -qed_configure_filter_mcast(struct ecore_dev *edev, - struct qed_filter_mcast_params *params) -{ - struct ecore_filter_mcast mcast; - int i; - - memset(, 0, sizeof(mcast)); - switch (params->type) { - case QED_FILTER_XCAST_TYPE_ADD: - mcast.opcode = ECORE_FILTER_ADD; - break; - case QED_FILTER_XCAST_TYPE_DEL: - mcast.opcode = ECORE_FILTER_REMOVE; - break; - default: - DP_NOTICE(edev, true, "Unknown multicast filter type %d\n", - params->type); - } - - mcast.num_mc_addrs = params->num; - for (i = 0; i < mcast.num_mc_addrs; i++) - ether_addr_copy((struct ether_addr *)>mac[i], - (struct ether_addr *)[i]); - - return ecore_filter_mcast_cmd(edev, , ECORE_SPQ_MODE_CB, NULL); -} - -int qed_configure_filter_rx_mode(struct ecore_dev *edev, +int qed_configure_filter_rx_mode(struct rte_eth_dev *eth_dev, enum qed_filter_rx_mode_type type) { + struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); + struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); struct ecore_filter_accept_flags flags; memset(, 0, sizeof(flags)); @@ -422,25 +347,6 @@ int qed_configure_filter_rx_mode(struct ecore_dev *edev, ECORE_SPQ_MODE_CB, NULL); } -static int -qed_configure_filter(struct ecore_dev *edev, struct qed_filter_params *params) -{ - switch (params->type) { - case QED_FILTER_TYPE_UCAST: - return qed_configure_filter_ucast(edev, >filter.ucast); - case QED_FILTER_TYPE_MCAST: - return qed_configure_filter_mcast(edev, >filter.mcast); - case QED_FILTER_TYPE_RX_MODE: - return qed_configure_filter_rx_mode(edev, - params->filter. -
[dpdk-dev] [PATCH 3/7] net/qede: add slowpath support for VXLAN tunneling
- Enable/disable VXLAN tunneling - Add/remove VXLAN classification rules - Destination UDP port configuration Signed-off-by: Harish Patil--- drivers/net/qede/base/ecore_l2.c | 3 + drivers/net/qede/base/ecore_l2_api.h | 1 + drivers/net/qede/qede_ethdev.c | 400 ++- drivers/net/qede/qede_ethdev.h | 7 + drivers/net/qede/qede_main.c | 14 -- drivers/net/qede/qede_rxtx.h | 2 +- 6 files changed, 411 insertions(+), 16 deletions(-) diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c index 74f61b0..a893cb9 100644 --- a/drivers/net/qede/base/ecore_l2.c +++ b/drivers/net/qede/base/ecore_l2.c @@ -1093,6 +1093,9 @@ static void ecore_set_fw_mac_addr(__le16 *fw_msb, case ECORE_FILTER_VNI: p_first_filter->type = ETH_FILTER_TYPE_VNI; break; + case ECORE_FILTER_UNUSED: /* @DPDK */ + p_first_filter->type = MAX_ETH_FILTER_TYPE; + break; } if ((p_first_filter->type == ETH_FILTER_TYPE_MAC) || diff --git a/drivers/net/qede/base/ecore_l2_api.h b/drivers/net/qede/base/ecore_l2_api.h index 326fa45..c338f5d 100644 --- a/drivers/net/qede/base/ecore_l2_api.h +++ b/drivers/net/qede/base/ecore_l2_api.h @@ -89,6 +89,7 @@ enum ecore_filter_ucast_type { ECORE_FILTER_INNER_MAC_VNI_PAIR, ECORE_FILTER_MAC_VNI_PAIR, ECORE_FILTER_VNI, + ECORE_FILTER_UNUSED, /* @DPDK */ }; struct ecore_filter_ucast { diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 1e21cb2..bd728c8 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -14,6 +14,111 @@ static const struct qed_eth_ops *qed_ops; static int64_t timer_period = 1; +/* VXLAN tunnel classification mapping */ +const struct _qede_vxlan_tunn_types { + uint16_t rte_filter_type; + enum ecore_filter_ucast_type qede_type; + enum ecore_tunn_clss qede_tunn_clss; + const char *string; +} qede_tunn_types[] = { + { + ETH_TUNNEL_FILTER_OMAC, + ECORE_FILTER_MAC, + ECORE_TUNN_CLSS_MAC_VLAN, + "outer-mac" + }, + { + ETH_TUNNEL_FILTER_TENID, + ECORE_FILTER_VNI, + ECORE_TUNN_CLSS_MAC_VNI, + "vni" + }, + { + ETH_TUNNEL_FILTER_IMAC, + ECORE_FILTER_INNER_MAC, + ECORE_TUNN_CLSS_INNER_MAC_VLAN, + "inner-mac" + }, + { + ETH_TUNNEL_FILTER_IVLAN, + ECORE_FILTER_INNER_VLAN, + ECORE_TUNN_CLSS_INNER_MAC_VLAN, + "inner-vlan" + }, + { + ETH_TUNNEL_FILTER_OMAC | ETH_TUNNEL_FILTER_TENID, + ECORE_FILTER_MAC_VNI_PAIR, + ECORE_TUNN_CLSS_MAC_VNI, + "outer-mac and vni" + }, + { + ETH_TUNNEL_FILTER_OMAC | ETH_TUNNEL_FILTER_IMAC, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "outer-mac and inner-mac" + }, + { + ETH_TUNNEL_FILTER_OMAC | ETH_TUNNEL_FILTER_IVLAN, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "outer-mac and inner-vlan" + }, + { + ETH_TUNNEL_FILTER_TENID | ETH_TUNNEL_FILTER_IMAC, + ECORE_FILTER_INNER_MAC_VNI_PAIR, + ECORE_TUNN_CLSS_INNER_MAC_VNI, + "vni and inner-mac", + }, + { + ETH_TUNNEL_FILTER_TENID | ETH_TUNNEL_FILTER_IVLAN, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "vni and inner-vlan", + }, + { + ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_IVLAN, + ECORE_FILTER_INNER_PAIR, + ECORE_TUNN_CLSS_INNER_MAC_VLAN, + "inner-mac and inner-vlan", + }, + { + ETH_TUNNEL_FILTER_OIP, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "outer-IP" + }, + { + ETH_TUNNEL_FILTER_IIP, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "inner-IP" + }, + { + RTE_TUNNEL_FILTER_IMAC_IVLAN, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "IMAC_IVLAN" + }, + { + RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "IMAC_IVLAN_TENID" + }, + { + RTE_TUNNEL_FILTER_IMAC_TENID, + ECORE_FILTER_UNUSED, + MAX_ECORE_TUNN_CLSS, + "IMAC_TENID" + }, + { + RTE_TUNNEL_FILTER_OMAC_TENID_IMAC, + ECORE_FILTER_UNUSED, +
[dpdk-dev] [PATCH 31/31] net/i40e: remove unused marco from PMD
Signed-off-by: Jingjing Wu--- drivers/net/i40e/Makefile | 2 +- drivers/net/i40e/i40e_ethdev.c | 40 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile index 13085fb..66997b6 100644 --- a/drivers/net/i40e/Makefile +++ b/drivers/net/i40e/Makefile @@ -38,7 +38,7 @@ LIB = librte_pmd_i40e.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER -DINTEGRATED_VF -CFLAGS += -DX722_SUPPORT -DX722_A0_SUPPORT +CFLAGS += -DX722_A0_SUPPORT EXPORT_MAP := rte_pmd_i40e_version.map diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 67778ba..34388e0 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -6198,18 +6198,14 @@ i40e_parse_hena(uint64_t flags) rss_hf |= ETH_RSS_FRAG_IPV4; if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP)) rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP; -#ifdef X722_SUPPORT if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK)) rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP; -#endif if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP)) rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP; -#ifdef X722_SUPPORT if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP)) rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP; if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP)) rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP; -#endif if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP)) rss_hf |= ETH_RSS_NONFRAG_IPV4_SCTP; if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER)) @@ -6218,18 +6214,14 @@ i40e_parse_hena(uint64_t flags) rss_hf |= ETH_RSS_FRAG_IPV6; if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP)) rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP; -#ifdef X722_SUPPORT if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK)) rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP; -#endif if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP)) rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP; -#ifdef X722_SUPPORT if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP)) rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP; if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP)) rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP; -#endif if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP)) rss_hf |= ETH_RSS_NONFRAG_IPV6_SCTP; if (flags & (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER)) @@ -7101,7 +7093,6 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_FLEX_PAYLOAD, -#ifdef X722_SUPPORT [I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP] = I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | @@ -7120,7 +7111,6 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_FLEX_PAYLOAD, -#endif [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | @@ -7130,7 +7120,6 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_TCP_FLAGS | I40E_INSET_FLEX_PAYLOAD, -#ifdef X722_SUPPORT [I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK] = I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | @@ -7140,7 +7129,6 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV4_SRC | I40E_INSET_IPV4_DST | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_TCP_FLAGS | I40E_INSET_FLEX_PAYLOAD, -#endif [I40E_FILTER_PCTYPE_NONF_IPV4_SCTP] = I40E_INSET_DMAC | I40E_INSET_SMAC | I40E_INSET_VLAN_OUTER | I40E_INSET_VLAN_INNER | @@ -7174,7 +7162,6 @@ i40e_get_valid_input_set(enum i40e_filter_pctype pctype, I40E_INSET_IPV6_HOP_LIMIT | I40E_INSET_IPV6_SRC | I40E_INSET_IPV6_DST | I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT | I40E_INSET_FLEX_PAYLOAD, -#ifdef X722_SUPPORT
[dpdk-dev] [PATCH 26/31] net/i40e/base: add ERROR state for NVM update state machine
This patch adds I40E_NVMUPD_STATE_ERROR state for NVM update. Without this patch driver has no possibility to return NVM image write failure.This state is being set when ARQ rises error. arq_last_status is also updated every time when ARQ event comes, not only on error cases. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_adminq.c | 4 ++-- drivers/net/i40e/base/i40e_nvm.c| 17 + drivers/net/i40e/base/i40e_type.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_adminq.c b/drivers/net/i40e/base/i40e_adminq.c index 0d3a83f..5bdf3f7 100644 --- a/drivers/net/i40e/base/i40e_adminq.c +++ b/drivers/net/i40e/base/i40e_adminq.c @@ -1077,11 +1077,11 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw, desc = I40E_ADMINQ_DESC(hw->aq.arq, ntc); desc_idx = ntc; + hw->aq.arq_last_status = + (enum i40e_admin_queue_err)LE16_TO_CPU(desc->retval); flags = LE16_TO_CPU(desc->flags); if (flags & I40E_AQ_FLAG_ERR) { ret_code = I40E_ERR_ADMIN_QUEUE_ERROR; - hw->aq.arq_last_status = - (enum i40e_admin_queue_err)LE16_TO_CPU(desc->retval); i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: Event received with error 0x%X.\n", diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c index 1f345a5..4f4a645 100644 --- a/drivers/net/i40e/base/i40e_nvm.c +++ b/drivers/net/i40e/base/i40e_nvm.c @@ -901,9 +901,20 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw, *((u16 *)[2]) = hw->nvm_wait_opcode; } + /* Clear error status on read */ + if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR) + hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; + return I40E_SUCCESS; } + /* Clear status even it is not read and log */ + if (hw->nvmupd_state == I40E_NVMUPD_STATE_ERROR) { + i40e_debug(hw, I40E_DEBUG_NVM, + "Clearing I40E_NVMUPD_STATE_ERROR state without reading\n"); + hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; + } + switch (hw->nvmupd_state) { case I40E_NVMUPD_STATE_INIT: status = i40e_nvmupd_state_init(hw, cmd, bytes, perrno); @@ -1253,6 +1264,7 @@ STATIC enum i40e_status_code i40e_nvmupd_state_writing(struct i40e_hw *hw, void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode) { if (opcode == hw->nvm_wait_opcode) { + i40e_debug(hw, I40E_DEBUG_NVM, "NVMUPD: clearing wait on opcode 0x%04x\n", opcode); if (hw->nvm_release_on_done) { @@ -1261,6 +1273,11 @@ void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode) } hw->nvm_wait_opcode = 0; + if (hw->aq.arq_last_status) { + hw->nvmupd_state = I40E_NVMUPD_STATE_ERROR; + return; + } + switch (hw->nvmupd_state) { case I40E_NVMUPD_STATE_INIT_WAIT: hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h index 3784c8f..56e47ea 100644 --- a/drivers/net/i40e/base/i40e_type.h +++ b/drivers/net/i40e/base/i40e_type.h @@ -499,6 +499,7 @@ enum i40e_nvmupd_state { I40E_NVMUPD_STATE_WRITING, I40E_NVMUPD_STATE_INIT_WAIT, I40E_NVMUPD_STATE_WRITE_WAIT, + I40E_NVMUPD_STATE_ERROR }; /* nvm_access definition and its masks/shifts need to be accessible to @@ -1526,6 +1527,7 @@ struct i40e_hw_port_stats { #define I40E_SR_EMPR_REGS_AUTO_LOAD_PTR0x3A #define I40E_SR_GLOBR_REGS_AUTO_LOAD_PTR 0x3B #define I40E_SR_CORER_REGS_AUTO_LOAD_PTR 0x3C +#define I40E_SR_PHY_ACTIVITY_LIST_PTR 0x3D #define I40E_SR_PCIE_ALT_AUTO_LOAD_PTR 0x3E #define I40E_SR_SW_CHECKSUM_WORD 0x3F #define I40E_SR_1ST_FREE_PROVISION_AREA_PTR0x40 -- 2.4.11
[dpdk-dev] [PATCH 29/31] net/i40e/base: fix byte order
Big Endian platform will accidentally send the wrong data to the firmware command. This patch fixes the issue. Fixes: 788fc17b2dec ("i40e/base: support proxy config for X722") Fixes: 3c89193a36fd ("i40e/base: support WOL config for X722") Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index fdf9d9b..6a0362d 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -6852,7 +6852,7 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, CPU_TO_LE32(I40E_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)proxy_config)); - desc.datalen = sizeof(struct i40e_aqc_arp_proxy_data); + desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_arp_proxy_data)); status = i40e_asq_send_command(hw, , proxy_config, sizeof(struct i40e_aqc_arp_proxy_data), @@ -6889,7 +6889,7 @@ enum i40e_status_code i40e_aq_set_ns_proxy_table_entry(struct i40e_hw *hw, CPU_TO_LE32(I40E_HI_DWORD((u64)ns_proxy_table_entry)); desc.params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)ns_proxy_table_entry)); - desc.datalen = sizeof(struct i40e_aqc_ns_proxy_data); + desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_ns_proxy_data)); status = i40e_asq_send_command(hw, , ns_proxy_table_entry, sizeof(struct i40e_aqc_ns_proxy_data), @@ -6952,7 +6952,7 @@ enum i40e_status_code i40e_aq_set_clear_wol_filter(struct i40e_hw *hw, cmd->valid_flags = CPU_TO_LE16(valid_flags); buff_len = sizeof(*filter); - desc.datalen = buff_len; + desc.datalen = CPU_TO_LE16(buff_len); desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_RD); -- 2.4.11
[dpdk-dev] [PATCH 25/31] net/i40e/base: remove duplicate definitions
We already define I40E_AQ_PHY_TYPE_EXT_25G* flags in the response adminq structure above, and do not need to re-define these. See eee_capability for an example where we didn't re-define these. This prevents Linux driver from complaining about using these flags in an #ifdef when running cppkeep tool, and generally makes more sense to avoid duplicating the definitions. While we are here, replace 0X with 0x as normal style. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_adminq_cmd.h | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h index d4d2a7a..4e00516 100644 --- a/drivers/net/i40e/base/i40e_adminq_cmd.h +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h @@ -1785,8 +1785,8 @@ struct i40e_aq_get_phy_abilities_resp { u8 d3_lpan; #define I40E_AQ_SET_PHY_D3_LPAN_ENA0x01 u8 phy_type_ext; -#define I40E_AQ_PHY_TYPE_EXT_25G_KR0X01 -#define I40E_AQ_PHY_TYPE_EXT_25G_CR0X02 +#define I40E_AQ_PHY_TYPE_EXT_25G_KR0x01 +#define I40E_AQ_PHY_TYPE_EXT_25G_CR0x02 #define I40E_AQ_PHY_TYPE_EXT_25G_SR0x04 #define I40E_AQ_PHY_TYPE_EXT_25G_LR0x08 u8 fec_cfg_curr_mod_ext_info; @@ -1822,10 +1822,6 @@ struct i40e_aq_set_phy_config { /* same bits as above in all */ __le32 eeer; u8 low_power_ctrl; u8 phy_type_ext; -#define I40E_AQ_PHY_TYPE_EXT_25G_KR0X01 -#define I40E_AQ_PHY_TYPE_EXT_25G_CR0X02 -#define I40E_AQ_PHY_TYPE_EXT_25G_SR0x04 -#define I40E_AQ_PHY_TYPE_EXT_25G_LR0x08 u8 fec_config; #define I40E_AQ_SET_FEC_ABILITY_KR BIT(0) #define I40E_AQ_SET_FEC_ABILITY_RS BIT(1) -- 2.4.11
[dpdk-dev] [PATCH 20/31] net/i40e/base: add defines for new aq command
By default the device clears all MAC filter information on PF Reset. However, this will cause Wake-On-LAN to fail because the wake filters are deleted on transition to D3 power state. To get around this, firmware is adding functionality to preserve certain MAC filters during PFR. These bits allow the driver tell the FW which filters to preserve. Set the datalen field and add I40E_AQ_FLAG_BUF/I40E_AQ_FLAG_RD flags in the desc struct for the WoL/Proxy AQ descriptors. The WoL/Proxy AQ commands were failing because these were missing. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_adminq_cmd.h | 5 - drivers/net/i40e/base/i40e_common.c | 16 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h index 19af8b5..d4d2a7a 100644 --- a/drivers/net/i40e/base/i40e_adminq_cmd.h +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h @@ -541,7 +541,8 @@ struct i40e_aqc_mac_address_read { #define I40E_AQC_PORT_ADDR_VALID 0x40 #define I40E_AQC_WOL_ADDR_VALID0x80 #define I40E_AQC_MC_MAG_EN_VALID 0x100 -#define I40E_AQC_ADDR_VALID_MASK 0x1F0 +#define I40E_AQC_WOL_PRESERVE_STATUS 0x200 +#define I40E_AQC_ADDR_VALID_MASK 0x3F0 u8 reserved[6]; __le32 addr_high; __le32 addr_low; @@ -562,6 +563,7 @@ I40E_CHECK_STRUCT_LEN(24, i40e_aqc_mac_address_read_data); struct i40e_aqc_mac_address_write { __le16 command_flags; #define I40E_AQC_MC_MAG_EN 0x0100 +#define I40E_AQC_WOL_PRESERVE_ON_PFR 0x0200 #define I40E_AQC_WRITE_TYPE_LAA_ONLY 0x #define I40E_AQC_WRITE_TYPE_LAA_WOL0x4000 #define I40E_AQC_WRITE_TYPE_PORT 0x8000 @@ -601,6 +603,7 @@ struct i40e_aqc_set_wol_filter { __le16 cmd_flags; #define I40E_AQC_SET_WOL_FILTER0x8000 #define I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL 0x4000 +#define I40E_AQC_SET_WOL_FILTER_WOL_PRESERVE_ON_PFR0x2000 #define I40E_AQC_SET_WOL_FILTER_ACTION_CLEAR 0 #define I40E_AQC_SET_WOL_FILTER_ACTION_SET 1 __le16 valid_flags; diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 1095e68..e9376dd 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -6804,10 +6804,13 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, i40e_fill_default_direct_cmd_desc(, i40e_aqc_opc_set_proxy_config); + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_RD); desc.params.external.addr_high = CPU_TO_LE32(I40E_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)proxy_config)); + desc.datalen = sizeof(struct i40e_aqc_arp_proxy_data); status = i40e_asq_send_command(hw, , proxy_config, sizeof(struct i40e_aqc_arp_proxy_data), @@ -6838,10 +6841,13 @@ enum i40e_status_code i40e_aq_set_ns_proxy_table_entry(struct i40e_hw *hw, i40e_fill_default_direct_cmd_desc(, i40e_aqc_opc_set_ns_proxy_table_entry); + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_RD); desc.params.external.addr_high = CPU_TO_LE32(I40E_HI_DWORD((u64)ns_proxy_table_entry)); desc.params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)ns_proxy_table_entry)); + desc.datalen = sizeof(struct i40e_aqc_ns_proxy_data); status = i40e_asq_send_command(hw, , ns_proxy_table_entry, sizeof(struct i40e_aqc_ns_proxy_data), @@ -6888,9 +6894,11 @@ enum i40e_status_code i40e_aq_set_clear_wol_filter(struct i40e_hw *hw, if (set_filter) { if (!filter) return I40E_ERR_PARAM; + cmd_flags |= I40E_AQC_SET_WOL_FILTER; - buff_len = sizeof(*filter); + cmd_flags |= I40E_AQC_SET_WOL_FILTER_WOL_PRESERVE_ON_PFR; } + if (no_wol_tco) cmd_flags |= I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL; cmd->cmd_flags = CPU_TO_LE16(cmd_flags); @@ -6901,6 +6909,12 @@ enum i40e_status_code i40e_aq_set_clear_wol_filter(struct i40e_hw *hw, valid_flags |= I40E_AQC_SET_WOL_FILTER_NO_TCO_ACTION_VALID; cmd->valid_flags = CPU_TO_LE16(valid_flags); + buff_len = sizeof(*filter); + desc.datalen = buff_len; + + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); + desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_RD); + cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)filter)); cmd->address_low = CPU_TO_LE32(I40E_LO_DWORD((u64)filter)); -- 2.4.11
[dpdk-dev] [PATCH 23/31] net/i40e/base: change shift values to hex
Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_type.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h index 99e080e..3784c8f 100644 --- a/drivers/net/i40e/base/i40e_type.h +++ b/drivers/net/i40e/base/i40e_type.h @@ -365,9 +365,9 @@ enum i40e_acpi_programming_method { I40E_ACPI_PROGRAMMING_METHOD_AQC_FPK = 1 }; -#define I40E_WOL_SUPPORT_MASK 1 -#define I40E_ACPI_PROGRAMMING_METHOD_MASK (1 << 1) -#define I40E_PROXY_SUPPORT_MASK(1 << 2) +#define I40E_WOL_SUPPORT_MASK 0x1 +#define I40E_ACPI_PROGRAMMING_METHOD_MASK 0x2 +#define I40E_PROXY_SUPPORT_MASK0x4 #endif /* Capabilities of a PF or a VF or the whole device */ -- 2.4.11
[dpdk-dev] [PATCH 10/31] net/i40e/base: add protocols when discover capabilities
Add logical_id to I40E_AQ_CAP_ID_MNG_MODE capability starting from major version 2. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_common.c | 8 drivers/net/i40e/base/i40e_type.h | 4 2 files changed, 12 insertions(+) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 85c1c11..9591428 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -3611,6 +3611,14 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, break; case I40E_AQ_CAP_ID_MNG_MODE: p->management_mode = number; + if (major_rev > 1) { + p->mng_protocols_over_mctp = logical_id; + i40e_debug(hw, I40E_DEBUG_INIT, + "HW Capability: Protocols over MCTP = %d\n", + p->mng_protocols_over_mctp); + } else { + p->mng_protocols_over_mctp = 0; + } i40e_debug(hw, I40E_DEBUG_INIT, "HW Capability: Management Mode = %d\n", p->management_mode); diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h index 530ee5e..223f5fe 100644 --- a/drivers/net/i40e/base/i40e_type.h +++ b/drivers/net/i40e/base/i40e_type.h @@ -366,6 +366,10 @@ struct i40e_hw_capabilities { #define I40E_NVM_IMAGE_TYPE_UDP_CLOUD 0x3 u32 management_mode; + u32 mng_protocols_over_mctp; +#define I40E_MNG_PROTOCOL_PLDM 0x2 +#define I40E_MNG_PROTOCOL_OEM_COMMANDS 0x4 +#define I40E_MNG_PROTOCOL_NCSI 0x8 u32 npar_enable; u32 os2bmc; u32 valid_functions; -- 2.4.11
[dpdk-dev] [PATCH 06/31] net/i40e/base: fix long link down notification time
This patch fixes a problem where it could take a very long time (>100 msec) to print the link down notification. This problem is fixed by changing how often we update link info from fw, when link is down. Without this patch, it can take over 100msec to notify user link is down. Fixes: e6691b428eb1 ("i40e/base: fix PHY NVM interaction") Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_common.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index a2661cf..2ad9448 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -2746,7 +2746,10 @@ enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw) if (status) return status; - if (hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) { + /* extra checking needed to ensure link info to user is timely */ + if ((hw->phy.link_info.link_info & I40E_AQ_MEDIA_AVAILABLE) && + ((hw->phy.link_info.link_info & I40E_AQ_LINK_UP) || +!(hw->phy.link_info_old.link_info & I40E_AQ_LINK_UP))) { status = i40e_aq_get_phy_capabilities(hw, false, false, , NULL); if (status) -- 2.4.11
[dpdk-dev] [PATCH 09/31] net/i40e/base: add bus number info
Currently i40e_bus_info has PCI device and function info only. However in log messages slot number (i.e hw->bus.device) is being printed as bus number. Another field should be added to provide bus number info and preserve existing information. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_type.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h index 5a59ce2..530ee5e 100644 --- a/drivers/net/i40e/base/i40e_type.h +++ b/drivers/net/i40e/base/i40e_type.h @@ -561,6 +561,7 @@ struct i40e_bus_info { u16 func; u16 device; u16 lan_id; + u16 bus_id; }; /* Flow control (FC) parameters */ -- 2.4.11
[dpdk-dev] [PATCH 08/31] net/i40e/base: add clause22 and clause45 implementation
Some external PHYs require Clause22 and Clause45 method for accessing registers. Mostly used for X722 support. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_common.c| 245 +++-- drivers/net/i40e/base/i40e_prototype.h | 16 ++- drivers/net/i40e/base/i40e_type.h | 17 ++- 3 files changed, 226 insertions(+), 52 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 7eea189..85c1c11 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -6022,7 +6022,92 @@ enum i40e_status_code i40e_aq_configure_partition_bw(struct i40e_hw *hw, } /** - * i40e_read_phy_register + * i40e_read_phy_register_clause22 + * @hw: pointer to the HW structure + * @reg: register address in the page + * @phy_adr: PHY address on MDIO interface + * @value: PHY register value + * + * Reads specified PHY register value + **/ +enum i40e_status_code i40e_read_phy_register_clause22(struct i40e_hw *hw, + u16 reg, u8 phy_addr, u16 *value) +{ + enum i40e_status_code status = I40E_ERR_TIMEOUT; + u8 port_num = (u8)hw->func_caps.mdio_port_num; + u32 command = 0; + u16 retry = 1000; + + command = (reg << I40E_GLGEN_MSCA_DEVADD_SHIFT) | + (phy_addr << I40E_GLGEN_MSCA_PHYADD_SHIFT) | + (I40E_MDIO_CLAUSE22_OPCODE_READ_MASK) | + (I40E_MDIO_CLAUSE22_STCODE_MASK) | + (I40E_GLGEN_MSCA_MDICMD_MASK); + wr32(hw, I40E_GLGEN_MSCA(port_num), command); + do { + command = rd32(hw, I40E_GLGEN_MSCA(port_num)); + if (!(command & I40E_GLGEN_MSCA_MDICMD_MASK)) { + status = I40E_SUCCESS; + break; + } + i40e_usec_delay(10); + retry--; + } while (retry); + + if (status) { + i40e_debug(hw, I40E_DEBUG_PHY, + "PHY: Can't write command to external PHY.\n"); + } else { + command = rd32(hw, I40E_GLGEN_MSRWD(port_num)); + *value = (command & I40E_GLGEN_MSRWD_MDIRDDATA_MASK) >> +I40E_GLGEN_MSRWD_MDIRDDATA_SHIFT; + } + + return status; +} + +/** + * i40e_write_phy_register_clause22 + * @hw: pointer to the HW structure + * @reg: register address in the page + * @phy_adr: PHY address on MDIO interface + * @value: PHY register value + * + * Writes specified PHY register value + **/ +enum i40e_status_code i40e_write_phy_register_clause22(struct i40e_hw *hw, + u16 reg, u8 phy_addr, u16 value) +{ + enum i40e_status_code status = I40E_ERR_TIMEOUT; + u8 port_num = (u8)hw->func_caps.mdio_port_num; + u32 command = 0; + u16 retry = 1000; + + command = value << I40E_GLGEN_MSRWD_MDIWRDATA_SHIFT; + wr32(hw, I40E_GLGEN_MSRWD(port_num), command); + + command = (reg << I40E_GLGEN_MSCA_DEVADD_SHIFT) | + (phy_addr << I40E_GLGEN_MSCA_PHYADD_SHIFT) | + (I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK) | + (I40E_MDIO_CLAUSE22_STCODE_MASK) | + (I40E_GLGEN_MSCA_MDICMD_MASK); + + wr32(hw, I40E_GLGEN_MSCA(port_num), command); + do { + command = rd32(hw, I40E_GLGEN_MSCA(port_num)); + if (!(command & I40E_GLGEN_MSCA_MDICMD_MASK)) { + status = I40E_SUCCESS; + break; + } + i40e_usec_delay(10); + retry--; + } while (retry); + + return status; +} + +/** + * i40e_read_phy_register_clause45 * @hw: pointer to the HW structure * @page: registers page number * @reg: register address in the page @@ -6031,9 +6116,8 @@ enum i40e_status_code i40e_aq_configure_partition_bw(struct i40e_hw *hw, * * Reads specified PHY register value **/ -enum i40e_status_code i40e_read_phy_register(struct i40e_hw *hw, -u8 page, u16 reg, u8 phy_addr, -u16 *value) +enum i40e_status_code i40e_read_phy_register_clause45(struct i40e_hw *hw, + u8 page, u16 reg, u8 phy_addr, u16 *value) { enum i40e_status_code status = I40E_ERR_TIMEOUT; u32 command = 0; @@ -6043,8 +6127,8 @@ enum i40e_status_code i40e_read_phy_register(struct i40e_hw *hw, command = (reg << I40E_GLGEN_MSCA_MDIADD_SHIFT) | (page << I40E_GLGEN_MSCA_DEVADD_SHIFT) | (phy_addr << I40E_GLGEN_MSCA_PHYADD_SHIFT) | - (I40E_MDIO_OPCODE_ADDRESS) | - (I40E_MDIO_STCODE) | + (I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK) | + (I40E_MDIO_CLAUSE45_STCODE_MASK) | (I40E_GLGEN_MSCA_MDICMD_MASK) |
[dpdk-dev] [PATCH 05/31] net/i40e/base: group base mode VF offload flags
Group together the minimum set of offload capabilities that are always supported by VF in base mode. This define would be used by PF to make sure VF in base mode gets minimum of base capabilities. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_virtchnl.h | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/i40e/base/i40e_virtchnl.h b/drivers/net/i40e/base/i40e_virtchnl.h index 07e7472..8fba608 100644 --- a/drivers/net/i40e/base/i40e_virtchnl.h +++ b/drivers/net/i40e/base/i40e_virtchnl.h @@ -172,6 +172,10 @@ struct i40e_virtchnl_vsi_resource { #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF0X0008 #define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM0X0010 +#define I40E_VF_BASE_MODE_OFFLOADS (I40E_VIRTCHNL_VF_OFFLOAD_L2 | \ + I40E_VIRTCHNL_VF_OFFLOAD_VLAN | \ + I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF) + struct i40e_virtchnl_vf_resource { u16 num_vsis; u16 num_queue_pairs; -- 2.4.11
[dpdk-dev] [PATCH 04/31] net/i40e/base: fix bit test mask
Incorrect bit mask was used for testing "get link status" response. Instead of I40E_AQ_LSE_ENABLE (which is actually 0x03) it most probably should be I40E_AQ_LSE_IS_ENABLED (which is defined as 0x01). Fixes: 8db9e2a1b232 ("i40e: base driver") Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index aa346d1..a2661cf 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -1975,7 +1975,7 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40e_hw *hw, else hw_link_info->crc_enable = false; - if (resp->command_flags & CPU_TO_LE16(I40E_AQ_LSE_ENABLE)) + if (resp->command_flags & CPU_TO_LE16(I40E_AQ_LSE_IS_ENABLED)) hw_link_info->lse_enable = true; else hw_link_info->lse_enable = false; -- 2.4.11
[dpdk-dev] [PATCH 02/31] net/i40e/base: preserve extended PHY type field
Prevents 25G PHY types from being disabled when setting the flow control modes. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 9a6b3ed..d67ad90 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -1789,6 +1789,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures, config.abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK; /* Copy over all the old settings */ config.phy_type = abilities.phy_type; + config.phy_type_ext = abilities.phy_type_ext; config.link_speed = abilities.link_speed; config.eee_capability = abilities.eee_capability; config.eeer = abilities.eeer_val; -- 2.4.11
[dpdk-dev] [PATCH 03/31] net/i40e/base: remove unnecessary code
This patch changes some assignments and removing the unnecessary code to avoid error reported by static analysis tools. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_common.c | 4 drivers/net/i40e/base/i40e_lan_hmc.c | 5 - 2 files changed, 9 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index d67ad90..aa346d1 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -3833,7 +3833,6 @@ STATIC void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, else p->acpi_prog_method = I40E_ACPI_PROGRAMMING_METHOD_HW_FVL; p->proxy_support = (phys_id & I40E_PROXY_SUPPORT_MASK) ? 1 : 0; - p->proxy_support = p->proxy_support; i40e_debug(hw, I40E_DEBUG_INIT, "HW Capability: WOL proxy filters = %d\n", hw->num_wol_proxy_filters); @@ -6008,9 +6007,6 @@ enum i40e_status_code i40e_aq_configure_partition_bw(struct i40e_hw *hw, desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_BUF); desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_RD); - if (bwd_size > I40E_AQ_LARGE_BUF) - desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB); - desc.datalen = CPU_TO_LE16(bwd_size); status = i40e_asq_send_command(hw, , bw_data, bwd_size, cmd_details); diff --git a/drivers/net/i40e/base/i40e_lan_hmc.c b/drivers/net/i40e/base/i40e_lan_hmc.c index 2260648..f03f381 100644 --- a/drivers/net/i40e/base/i40e_lan_hmc.c +++ b/drivers/net/i40e/base/i40e_lan_hmc.c @@ -1239,11 +1239,6 @@ enum i40e_status_code i40e_hmc_get_object_va(struct i40e_hw *hw, u64 obj_offset_in_fpm; u32 sd_idx, sd_lmt; - if (NULL == hmc_info) { - ret_code = I40E_ERR_BAD_PTR; - DEBUGOUT("i40e_hmc_get_object_va: bad hmc_info ptr\n"); - goto exit; - } if (NULL == hmc_info->hmc_obj) { ret_code = I40E_ERR_BAD_PTR; DEBUGOUT("i40e_hmc_get_object_va: bad hmc_info->hmc_obj ptr\n"); -- 2.4.11
[dpdk-dev] [PATCH 01/31] net/i40e/base: add encap csum VF offload flag
Add ENCAP_CSUM offload negotiation flag. Currently VF assumes checksum offload for encapsulated packets is supported by default. Going forward, this feature needs to be negotiated with PF before advertising to the stack. Hence, we need a flag to control it. Signed-off-by: Jingjing Wu--- drivers/net/i40e/base/i40e_virtchnl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/i40e/base/i40e_virtchnl.h b/drivers/net/i40e/base/i40e_virtchnl.h index fd51ec3..07e7472 100644 --- a/drivers/net/i40e/base/i40e_virtchnl.h +++ b/drivers/net/i40e/base/i40e_virtchnl.h @@ -170,6 +170,7 @@ struct i40e_virtchnl_vsi_resource { #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING0x0002 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 0x0004 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF0X0008 +#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM0X0010 struct i40e_virtchnl_vf_resource { u16 num_vsis; -- 2.4.11
[dpdk-dev] [PATCH 00/31] net/i40e: base code update
i40e base code upate. The main changes are: - add clause22 and clause45 implementation for PHY registers accessing - replace existing legacy memcpy() calls with i40e_memcpy() calls. - use BIT() macro instead of bit fields - add clear all WoL filters implementation - add ERROR state for NVM update state machine - add broadcast promiscuous control per VLAN - remove unused X722_SUPPORT and I40E_NDIS_SUPPORT MARCOs Jingjing Wu (31): net/i40e/base: add encap csum VF offload flag net/i40e/base: preserve extended PHY type field net/i40e/base: remove unnecessary code net/i40e/base: fix bit test mask net/i40e/base: group base mode VF offload flags net/i40e/base: fix long link down notification time net/i40e/base: add media type detection for 25G link net/i40e/base: add clause22 and clause45 implementation net/i40e/base: add bus number info net/i40e/base: add protocols when discover capabilities net/i40e/base: pass unknown PHY type for unknown PHYs net/i40e/base: replace memcpy net/i40e/base: deprecating unused macro net/i40e/base: remove FPK HyperV VF device ID net/i40e/base: add FEC bits to PHY capabilities net/i40e/base: use BIT() macro instead of bit fields net/i40e/base: adjust 25G PHY type values net/i40e/base: implement clear all WoL filters net/i40e/base: implement set VSI full promisc mode net/i40e/base: add defines for new aq command net/i40e/base: save link FEC info from link up event net/i40e/base: acquire NVM lock before reads on all devices net/i40e/base: change shift values to hex net/i40e/base: comment that udp port must be in Host order net/i40e/base: remove duplicate definitions net/i40e/base: add ERROR state for NVM update state machine net/i40e/base: add broadcast promiscuous control per VLAN net/i40e/base: avoid division by zero net/i40e/base: fix byte order net/i40e/base: remove unused marco net/i40e: remove unused marco from PMD drivers/net/i40e/Makefile | 2 +- drivers/net/i40e/base/i40e_adminq.c | 4 +- drivers/net/i40e/base/i40e_adminq_cmd.h | 51 ++-- drivers/net/i40e/base/i40e_common.c | 425 ++-- drivers/net/i40e/base/i40e_devids.h | 3 - drivers/net/i40e/base/i40e_lan_hmc.c| 5 - drivers/net/i40e/base/i40e_nvm.c| 52 ++-- drivers/net/i40e/base/i40e_prototype.h | 30 ++- drivers/net/i40e/base/i40e_register.h | 2 - drivers/net/i40e/base/i40e_type.h | 94 +++ drivers/net/i40e/base/i40e_virtchnl.h | 5 + drivers/net/i40e/i40e_ethdev.c | 40 --- drivers/net/i40e/i40e_ethdev_vf.c | 1 - 13 files changed, 467 insertions(+), 247 deletions(-) -- 2.4.11
Re: [dpdk-dev] [PATCH v12 0/6] add Tx preparation
> -Original Message- > From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] > Sent: Wednesday, November 30, 2016 10:27 AM > To: Ananyev, Konstantin> Cc: Harish Patil ; dev@dpdk.org; Rahul Lakkireddy > ; Stephen Hurd > ; Jan Medala ; Jakub > Palider ; John Daley ; Adrien > Mazarguil ; Alejandro Lucero > ; Rasesh Mody > ; Jacob, Jerin ; > Yuanhan Liu ; Yong Wang > ; Kulasek, TomaszX > ; olivier.m...@6wind.com > Subject: Re: [dpdk-dev] [PATCH v12 0/6] add Tx preparation > > 2016-11-30 17:42, Ananyev, Konstantin: > > > >Please, we need a comment for each driver saying > > > >"it is OK, we do not need any checksum preparation for TSO" > > > >or > > > >"yes we have to implement tx_prepare or TSO will not work in this > mode" > > > > > > > > > > qede PMD doesn’t currently support TSO yet, it only supports Tx > TCP/UDP/IP > > > csum offloads. > > > So Tx preparation isn’t applicable. So as of now - > > > "it is OK, we do not need any checksum preparation for TSO" > > > > Thanks for the answer. > > Though please note that it not only for TSO. > > Oh yes, sorry, my wording was incorrect. > We need to know if any checksum preparation is needed prior > offloading its final computation to the hardware or driver. > So the question applies to TSO and simple checksum offload. > > We are still waiting answers for > bnxt, cxgbe, ena, nfp, thunderx, virtio and vmxnet3. The case for a virtual device is a little bit more complicated as packets offloaded from a virtual device can eventually be delivered to another virtual NIC or different physical NICs that have different offload requirements. In ESX, the hypervisor will enforce that the packets offloaded will be something that the hardware expects. The contract for vmxnet3 is that the guest needs to fill in pseudo header checksum for both l4 checksum only and TSO + l4 checksum offload cases. > > This is for any TX offload for which the upper layer SW would have > > to modify the contents of the packet. > > Though as I can see for qede neither PKT_TX_IP_CKSUM or > PKT_TX_TCP_CKSUM > > exhibits any extra requirements for the user. > > Is that correct?
Re: [dpdk-dev] [RFC] igb_uio: deprecate iomem and ioport mapping
On Thu, 1 Sep 2016 02:16:37 + Jianfeng Tanwrote: > Previously in igb_uio, iomem is mapped, and both ioport and io mem > are recorded into uio framework, which is duplicated and makes the > code too complex. > > For iomem, DPDK user space code never opens or reads files under > /sys/pci/bus/devices/:xx:xx.x/uio/uioY/maps/. Instead, > /sys/pci/bus/devices/:xx:xx.x/resourceY are used to map device > memory. > > For ioport, non-x86 platforms cannot read from files under > /sys/pci/bus/devices/:xx:xx.x/uio/uioY/portio/ directly, because > non-x86 platforms need to map port region for access in user space, > see non-x86 version pci_uio_ioport_map(). x86 platforms can use the > the same way as uio_pci_generic. > > This patch deprecates iomem and ioport mapping in igb_uio kernel > module, and adjusts the iomem implementation in both igb_uio and > uio_pci_generic: > - for x86 platform, get ports info from /proc/ioports; > - for non-x86 platform, map and get ports info by pci_uio_ioport_map(). > > Note: this will affect those applications who are using files under > /sys/pci/bus/devices/:xx:xx.x/uio/uioY/maps/ and > /sys/pci/bus/devices/:xx:xx.x/uio/uioY/portio/. > > Signed-off-by: Jianfeng Tan What about people using older kernels with the new DPDK EAL and vice versa? It makes sense to make igb_uio generic for non DPDK usage, so it should probably follow the other UIO drivers.
[dpdk-dev] Question about IXGBEVF reset
Hi I was having a discussion on the IXGBE mailing list regarding RESET due to lost link mailbox message and its handling in DPDK: http://lists.osuosl.org/pipermail/intel-wired-lan/Week-of-Mon-20161128/007389.html I was wondering what can be done regarding this issue. Particularly, the patch http://dpdk.org/dev/patchwork/patch/14009/ does seem to have an assumption that a link will be up sooner or later. The problem with that is the link may go down for arbitrarily long time (and the ixgbe driver will issue the reset mailbox message due to ’Tx work pending’). We can call ixgbevf_dev_stop at this point but we cannot safely run ixgbevf_dev_start. Do you have any suggestion how to handle this case? Also, is there any better (more recent) patch to handle this? Thanks, Ruslan Nikolaev
Re: [dpdk-dev] [RFC PATCH] eventdev: add buffered enqueue and flush APIs
On Fri, Dec 02, 2016 at 01:45:56PM -0600, Gage Eads wrote: > This commit adds buffered enqueue functionality to the eventdev API. > It is conceptually similar to the ethdev API's tx buffering, however > with a smaller API surface and no dropping of events. Hello Gage, Different implementation may have different strategies to hold the buffers. and some does not need to hold the buffers if it is DDR backed. IHMO, This may not be the candidate for common code. I guess you can move this to driver side and abstract under SW driver's enqueue_burst. > > Signed-off-by: Gage Eads> --- > lib/librte_eventdev/rte_eventdev.c | 29 ++ > lib/librte_eventdev/rte_eventdev.h | 106 > + > 2 files changed, 135 insertions(+) > > diff --git a/lib/librte_eventdev/rte_eventdev.c > b/lib/librte_eventdev/rte_eventdev.c > index 17ce5c3..564573f 100644 > --- a/lib/librte_eventdev/rte_eventdev.c > +++ b/lib/librte_eventdev/rte_eventdev.c > @@ -219,6 +219,7 @@ > uint16_t *links_map; > uint8_t *ports_dequeue_depth; > uint8_t *ports_enqueue_depth; > + struct rte_eventdev_enqueue_buffer *port_buffers; > unsigned int i; > > EDEV_LOG_DEBUG("Setup %d ports on device %u", nb_ports, > @@ -272,6 +273,19 @@ > "nb_ports %u", nb_ports); > return -(ENOMEM); > } > + > + /* Allocate memory to store port enqueue buffers */ > + dev->data->port_buffers = > + rte_zmalloc_socket("eventdev->port_buffers", > + sizeof(dev->data->port_buffers[0]) * nb_ports, > + RTE_CACHE_LINE_SIZE, dev->data->socket_id); > + if (dev->data->port_buffers == NULL) { > + dev->data->nb_ports = 0; > + EDEV_LOG_ERR("failed to get memory for port enq" > + " buffers, nb_ports %u", nb_ports); > + return -(ENOMEM); > + } > + > } else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */ > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP); > > @@ -279,6 +293,7 @@ > ports_dequeue_depth = dev->data->ports_dequeue_depth; > ports_enqueue_depth = dev->data->ports_enqueue_depth; > links_map = dev->data->links_map; > + port_buffers = dev->data->port_buffers; > > for (i = nb_ports; i < old_nb_ports; i++) > (*dev->dev_ops->port_release)(ports[i]); > @@ -324,6 +339,17 @@ > return -(ENOMEM); > } > > + /* Realloc memory to store port enqueue buffers */ > + port_buffers = rte_realloc(dev->data->port_buffers, > + sizeof(dev->data->port_buffers[0]) * nb_ports, > + RTE_CACHE_LINE_SIZE); > + if (port_buffers == NULL) { > + dev->data->nb_ports = 0; > + EDEV_LOG_ERR("failed to realloc mem for port enq" > + " buffers, nb_ports %u", nb_ports); > + return -(ENOMEM); > + } > + > if (nb_ports > old_nb_ports) { > uint8_t new_ps = nb_ports - old_nb_ports; > > @@ -336,12 +362,15 @@ > memset(links_map + > (old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV), > 0, sizeof(ports_enqueue_depth[0]) * new_ps); > + memset(port_buffers + old_nb_ports, 0, > + sizeof(port_buffers[0]) * new_ps); > } > > dev->data->ports = ports; > dev->data->ports_dequeue_depth = ports_dequeue_depth; > dev->data->ports_enqueue_depth = ports_enqueue_depth; > dev->data->links_map = links_map; > + dev->data->port_buffers = port_buffers; > } else if (dev->data->ports != NULL && nb_ports == 0) { > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP); > > diff --git a/lib/librte_eventdev/rte_eventdev.h > b/lib/librte_eventdev/rte_eventdev.h > index 778d6dc..3f24342 100644 > --- a/lib/librte_eventdev/rte_eventdev.h > +++ b/lib/librte_eventdev/rte_eventdev.h > @@ -246,6 +246,7 @@ > #include > #include > #include > +#include > > #define EVENTDEV_NAME_SKELETON_PMD event_skeleton > /**< Skeleton event device PMD name */ > @@ -965,6 +966,26 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, > struct rte_event ev[], > #define RTE_EVENTDEV_NAME_MAX_LEN(64) > /**< @internal Max length of name of event PMD */ > > +#define RTE_EVENT_BUF_MAX 16 > +/**< Maximum number of events in an enqueue buffer. */ > + > +/** > + * @internal > + * An enqueue buffer for each port. > + * > + * The reason this struct is in the header is for
Re: [dpdk-dev] [PATCH 01/22] ethdev: introduce generic flow API
On 12/01/2016 08:36 AM, Adrien Mazarguil wrote: > Hi Kevin, > > On Wed, Nov 30, 2016 at 05:47:17PM +, Kevin Traynor wrote: >> Hi Adrien, >> >> On 11/16/2016 04:23 PM, Adrien Mazarguil wrote: >>> This new API supersedes all the legacy filter types described in >>> rte_eth_ctrl.h. It is slightly higher level and as a result relies more on >>> PMDs to process and validate flow rules. >>> >>> Benefits: >>> >>> - A unified API is easier to program for, applications do not have to be >>> written for a specific filter type which may or may not be supported by >>> the underlying device. >>> >>> - The behavior of a flow rule is the same regardless of the underlying >>> device, applications do not need to be aware of hardware quirks. >>> >>> - Extensible by design, API/ABI breakage should rarely occur if at all. >>> >>> - Documentation is self-standing, no need to look up elsewhere. >>> >>> Existing filter types will be deprecated and removed in the near future. >> >> I'd suggest to add a deprecation notice to deprecation.rst, ideally with >> a target release. > > Will do, not a sure about the target release though. It seems a bit early > since no PMD really supports this API yet. > > [...] >>> diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c >>> new file mode 100644 >>> index 000..064963d >>> --- /dev/null >>> +++ b/lib/librte_ether/rte_flow.c >>> @@ -0,0 +1,159 @@ >>> +/*- >>> + * BSD LICENSE >>> + * >>> + * Copyright 2016 6WIND S.A. >>> + * Copyright 2016 Mellanox. >> >> There's Mellanox copyright but you are the only signed-off-by - is that >> right? > > Yes, I'm the primary maintainer for Mellanox PMDs and this API was designed > on their behalf to expose several features from mlx4/mlx5 as the existing > filter types had too many limitations. > > [...] >>> +/* Get generic flow operations structure from a port. */ >>> +const struct rte_flow_ops * >>> +rte_flow_ops_get(uint8_t port_id, struct rte_flow_error *error) >>> +{ >>> + struct rte_eth_dev *dev = _eth_devices[port_id]; >>> + const struct rte_flow_ops *ops; >>> + int code; >>> + >>> + if (unlikely(!rte_eth_dev_is_valid_port(port_id))) >>> + code = ENODEV; >>> + else if (unlikely(!dev->dev_ops->filter_ctrl || >>> + dev->dev_ops->filter_ctrl(dev, >>> + RTE_ETH_FILTER_GENERIC, >>> + RTE_ETH_FILTER_GET, >>> + ) || >>> + !ops)) >>> + code = ENOTSUP; >>> + else >>> + return ops; >>> + rte_flow_error_set(error, code, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, >>> + NULL, rte_strerror(code)); >>> + return NULL; >>> +} >>> + >> >> Is it expected that the application or pmd will provide locking between >> these functions if required? I think it's going to have to be the app. > > Locking is indeed expected to be performed by applications. This API only > documents places where locking would make sense if necessary and expected > behavior. > > Like all control path APIs, this one assumes a single control thread. > Applications must take the necessary precautions. If you look at OVS now it's quite possible that you have 2 rx queues serviced by different threads, that would also install the flow rules in the software flow caches - possibly that could extend to adding hardware flows. There could also be another thread that is querying for stats. So anything that can be done to minimise the locking would be helpful - maybe query() could be atomic and not require any locking? > > [...] >>> +/** >>> + * Flow rule attributes. >>> + * >>> + * Priorities are set on two levels: per group and per rule within groups. >>> + * >>> + * Lower values denote higher priority, the highest priority for both >>> levels >>> + * is 0, so that a rule with priority 0 in group 8 is always matched after >>> a >>> + * rule with priority 8 in group 0. >>> + * >>> + * Although optional, applications are encouraged to group similar rules as >>> + * much as possible to fully take advantage of hardware capabilities >>> + * (e.g. optimized matching) and work around limitations (e.g. a single >>> + * pattern type possibly allowed in a given group). >>> + * >>> + * Group and priority levels are arbitrary and up to the application, they >>> + * do not need to be contiguous nor start from 0, however the maximum >>> number >>> + * varies between devices and may be affected by existing flow rules. >>> + * >>> + * If a packet is matched by several rules of a given group for a given >>> + * priority level, the outcome is undefined. It can take any path, may be >>> + * duplicated or even cause unrecoverable errors. >> >> I get what you are trying to do here wrt supporting multiple >> pmds/hardware implementations and it's a good idea to keep it flexible. >> >> Given that the outcome is undefined, it would be nice that the >>
[dpdk-dev] [RFC PATCH] eventdev: add buffered enqueue and flush APIs
This commit adds buffered enqueue functionality to the eventdev API. It is conceptually similar to the ethdev API's tx buffering, however with a smaller API surface and no dropping of events. Signed-off-by: Gage Eads--- lib/librte_eventdev/rte_eventdev.c | 29 ++ lib/librte_eventdev/rte_eventdev.h | 106 + 2 files changed, 135 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 17ce5c3..564573f 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -219,6 +219,7 @@ uint16_t *links_map; uint8_t *ports_dequeue_depth; uint8_t *ports_enqueue_depth; + struct rte_eventdev_enqueue_buffer *port_buffers; unsigned int i; EDEV_LOG_DEBUG("Setup %d ports on device %u", nb_ports, @@ -272,6 +273,19 @@ "nb_ports %u", nb_ports); return -(ENOMEM); } + + /* Allocate memory to store port enqueue buffers */ + dev->data->port_buffers = + rte_zmalloc_socket("eventdev->port_buffers", + sizeof(dev->data->port_buffers[0]) * nb_ports, + RTE_CACHE_LINE_SIZE, dev->data->socket_id); + if (dev->data->port_buffers == NULL) { + dev->data->nb_ports = 0; + EDEV_LOG_ERR("failed to get memory for port enq" +" buffers, nb_ports %u", nb_ports); + return -(ENOMEM); + } + } else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP); @@ -279,6 +293,7 @@ ports_dequeue_depth = dev->data->ports_dequeue_depth; ports_enqueue_depth = dev->data->ports_enqueue_depth; links_map = dev->data->links_map; + port_buffers = dev->data->port_buffers; for (i = nb_ports; i < old_nb_ports; i++) (*dev->dev_ops->port_release)(ports[i]); @@ -324,6 +339,17 @@ return -(ENOMEM); } + /* Realloc memory to store port enqueue buffers */ + port_buffers = rte_realloc(dev->data->port_buffers, + sizeof(dev->data->port_buffers[0]) * nb_ports, + RTE_CACHE_LINE_SIZE); + if (port_buffers == NULL) { + dev->data->nb_ports = 0; + EDEV_LOG_ERR("failed to realloc mem for port enq" +" buffers, nb_ports %u", nb_ports); + return -(ENOMEM); + } + if (nb_ports > old_nb_ports) { uint8_t new_ps = nb_ports - old_nb_ports; @@ -336,12 +362,15 @@ memset(links_map + (old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV), 0, sizeof(ports_enqueue_depth[0]) * new_ps); + memset(port_buffers + old_nb_ports, 0, + sizeof(port_buffers[0]) * new_ps); } dev->data->ports = ports; dev->data->ports_dequeue_depth = ports_dequeue_depth; dev->data->ports_enqueue_depth = ports_enqueue_depth; dev->data->links_map = links_map; + dev->data->port_buffers = port_buffers; } else if (dev->data->ports != NULL && nb_ports == 0) { RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP); diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 778d6dc..3f24342 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -246,6 +246,7 @@ #include #include #include +#include #define EVENTDEV_NAME_SKELETON_PMD event_skeleton /**< Skeleton event device PMD name */ @@ -965,6 +966,26 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[], #define RTE_EVENTDEV_NAME_MAX_LEN (64) /**< @internal Max length of name of event PMD */ +#define RTE_EVENT_BUF_MAX 16 +/**< Maximum number of events in an enqueue buffer. */ + +/** + * @internal + * An enqueue buffer for each port. + * + * The reason this struct is in the header is for inlining the function calls + * to enqueue, as doing a function call per packet would incur significant + * performance overhead. + * + * \see rte_event_enqueue_buffer(), rte_event_enqueue_buffer_flush() + */ +struct rte_eventdev_enqueue_buffer { + /**> Count of events in this buffer */ + uint16_t count; + /**> Array of events in this buffer */ + struct rte_event events[RTE_EVENT_BUF_MAX]; +} __rte_cache_aligned; + /** * @internal * The data
Re: [dpdk-dev] [PATCH v2 00/55] Solarflare libefx-based PMD
On 11/29/2016 4:18 PM, Andrew Rybchenko wrote: > The patch series adds Solarflare libefx-based network PMD. > > This version of the driver supports Solarflare SFN7xxx and SFN8xxx > families of 10/40 Gbps adapters. > > libefx is a platform-independent library to implement drivers for > Solarflare network adapters. It provides unified adapter family > independent interface (if possible). FreeBSD [1] and illumos [2] > drivers are built on top of the library. > > The patch series could be logically structured into 5 sub-series: > 1. (1) add the driver skeleton including documentation > 2. (2-30) import libefx and include it in build with the latest patch > 3. (31-42) implement minimal device level operations in steps > 4. (43-50) implement Rx subsystem > 5. (51-55) implement Tx subsystem > > Functional driver with multi-queue support capable to send and receive > traffic appears with the last patch in the series. > > The following design decisions are made during development: > > 1. Since libefx uses positive errno return codes, positive errno > return codes are used inside the driver and coversion to negative > is done on return from eth_dev_ops callbacks. We think that it > is the less error-prone way. > > 2. Own event queue (a way to deliver events from HW to host CPU) is > used for house-keeping (e.g. link status notifications), each Tx > and each Rx queue. No locks on datapath are requires in this case. > > 3. Alarm is used to periodically poll house-keeping event queue. > The event queue is used to deliver link status change notifications, > Rx/Tx queue flush events, SRAM events. It is not used on datapath. > The event queue polling is protected using spin-lock since > concurrent access from different contexts is possible (e.g. device > stop when polling alarm is running). > > [1] https://svnweb.freebsd.org/base/head/sys/dev/sfxge/common/ > [2] > https://github.com/illumos/illumos-gate/tree/master/usr/src/uts/common/io/sfxge/common/ > > --- > > v2: > * Fix spelling > * Fix ICC and clang build warnings > * Remove efx subdirectory > * Fix bug in Makefile which results in duplication of warnings options > * Use WERROR_FLAGS and remove warnings disabling for the PMD itself > * Comment enabled EFSYS_OPT_ > * Use space after #define instead of TAB > * Update version map to upcoming release > * Use bool for boolean_t in efsys.h > > > Andrew Rybchenko (48): > net/sfc: libefx-based PMD stub sufficient to build and init > net/sfc: import libefx base > net/sfc: import libefx register definitions > net/sfc: import libefx filters support > net/sfc: import libefx MCDI definition > net/sfc: import libefx MCDI implementation > net/sfc: import libefx MCDI logging support > net/sfc: import libefx MCDI proxy authorization support > net/sfc: import libefx 5xxx/6xxx family support > net/sfc: import libefx SFN7xxx family support > net/sfc: import libefx SFN8xxx family support > net/sfc: import libefx diagnostics support > net/sfc: import libefx built-in selftest support > net/sfc: import libefx software per-queue statistics support > net/sfc: import libefx PHY flags control support > net/sfc: import libefx PHY statistics support > net/sfc: import libefx PHY LEDs control support > net/sfc: import libefx MAC statistics support > net/sfc: import libefx event prefetch support > net/sfc: import libefx Rx scatter support > net/sfc: import libefx RSS support > net/sfc: import libefx loopback control support > net/sfc: import libefx monitors statistics support > net/sfc: import libefx support to access monitors via MCDI > net/sfc: import libefx support for Rx packed stream mode > net/sfc: import libefx NVRAM support > net/sfc: import libefx VPD support > net/sfc: import libefx bootrom configuration support > net/sfc: import libefx licensing support > net/sfc: implement driver operation to init device on attach > net/sfc: add device configure and close stubs > net/sfc: add device configuration checks > net/sfc: implement device start and stop operations > net/sfc: make available resources estimation and allocation > net/sfc: interrupts support sufficient for event queue init > net/sfc: implement event queue support > net/sfc: implement EVQ dummy exception handling > net/sfc: maintain management event queue > net/sfc: periodic management EVQ polling using alarm > net/sfc: minimum port control sufficient to receive traffic > net/sfc: implement Rx subsystem stubs > net/sfc: check configured rxmode > net/sfc: implement Rx queue setup release operations > net/sfc: calculate Rx buffer size which may be used > net/sfc: validate Rx queue buffers setup > net/sfc: implement Rx queue start and stop operations > net/sfc: implement device callback to Rx burst of packets > net/sfc: discard scattered packet on Rx correctly > > Artem Andreev (2): > net/sfc: include libefx in build >
Re: [dpdk-dev] [PATCH] Scheduler: add driver for scheduler crypto pmd
On Fri, Dec 02, 2016 at 03:31:24PM +0100, Thomas Monjalon wrote: > 2016-12-02 14:15, Fan Zhang: > > This patch provides the initial implementation of the scheduler poll mode > > driver using DPDK cryptodev framework. > > > > Scheduler PMD is used to schedule and enqueue the crypto ops to the > > hardware and/or software crypto devices attached to it (slaves). The > > dequeue operation from the slave(s), and the possible dequeued crypto op > > reordering, are then carried out by the scheduler. > > > > The scheduler PMD can be used to fill the throughput gap between the > > physical core and the existing cryptodevs to increase the overall > > performance. For example, if a physical core has higher crypto op > > processing rate than a cryptodev, the scheduler PMD can be introduced to > > attach more than one cryptodevs. > > > > This initial implementation is limited to supporting the following > > scheduling modes: > > > > - CRYPTO_SCHED_SW_ROUND_ROBIN_MODE (round robin amongst attached software > > slave cryptodevs, to set this mode, the scheduler should have been > > attached 1 or more software cryptodevs. > > > > - CRYPTO_SCHED_HW_ROUND_ROBIN_MODE (round robin amongst attached hardware > > slave cryptodevs (QAT), to set this mode, the scheduler should have > > been attached 1 or more QATs. > > Could it be implemented on top of the eventdev API? > Not really. The eventdev API is for different types of scheduling between multiple sources that are all polling for packets, compared to this, which is more analgous - as I understand it - to the bonding PMD for ethdev. To make something like this work with an eventdev API you would need to use one of the following models: * have worker cores for offloading packets to the different crypto blocks pulling from the eventdev APIs. This would make it difficult to do any "smart" scheduling of crypto operations between the blocks, e.g. that one crypto instance may be better at certain types of operations than another. * move the logic in this driver into an existing eventdev instance, which uses the eventdev api rather than the crypto APIs and so has an extra level of "structure abstraction" that has to be worked though. It's just not really a good fit. So for this workload, I believe the pseudo-cryptodev instance is the best way to go. /Bruce
Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
2016-12-02 14:25, Iremonger, Bernard: > Hi Thomas, > > From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] > > > > Do you agree to copy the remaining VF-specific functions from the generic > > ethdev API to ixgbe in 17.02? > > After a deprecation notice, we could remove them from the generic API in > > 17.05. > > So we will have a consistent status in 17.05 regarding VF functions. > > > > After some time (and experience) we will be able to discuss wether we need > > something more to access to these specific features. > > I had intended to copy the remaining VF-specific functions from the generic > ethdev API to ixgbe in 17.02 and a deprecation notice was sent in 16.11. > > This work was parked in order work on the VF-specfic functionsfor the i40e. > Is it ok to submit patches for this work after the V1 deadline (today)? Yes, it is a kind of cleanup and it has been discussed earlier. So yes you can submit it later. Sooner is better though :) Thanks
Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
Do you agree to copy the remaining VF-specific functions from the generic ethdev API to ixgbe in 17.02? After a deprecation notice, we could remove them from the generic API in 17.05. So we will have a consistent status in 17.05 regarding VF functions. After some time (and experience) we will be able to discuss wether we need something more to access to these specific features.
[dpdk-dev] [PATCH 3/3] app/test: add DES tests to Intel QAT crypto test suite
This commit adds tests of Data Encryption Standard (DES) algorithm to Intel QuickAssist technology crypto test suites Signed-off-by: Arek Kusztal--- app/test/test_cryptodev.c | 18 + app/test/test_cryptodev_blockcipher.c | 5 ++ app/test/test_cryptodev_blockcipher.h | 3 +- app/test/test_cryptodev_des_test_vectors.h | 110 + 4 files changed, 135 insertions(+), 1 deletion(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 00dced5..23e56ec 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -3829,6 +3829,22 @@ test_3DES_chain_qat_all(void) } static int +test_DES_cipheronly_qat_all(void) +{ + struct crypto_testsuite_params *ts_params = _params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, ts_params->valid_devs[0], + RTE_CRYPTODEV_QAT_SYM_PMD, + BLKCIPHER_DES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int test_3DES_cipheronly_qat_all(void) { struct crypto_testsuite_params *ts_params = _params; @@ -6053,6 +6069,8 @@ static struct unit_test_suite cryptodev_qat_testsuite = { TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_qat_all), TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_qat_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_DES_cipheronly_qat_all), TEST_CASE_ST(ut_setup, ut_teardown, test_stats), /** AES GCM Authenticated Encryption */ diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index 37b10cf..03dd073 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -489,6 +489,11 @@ test_blockcipher_all_tests(struct rte_mempool *mbuf_pool, sizeof(triple_des_cipheronly_test_cases[0]); tcs = triple_des_cipheronly_test_cases; break; + case BLKCIPHER_DES_CIPHERONLY_TYPE: + n_test_cases = sizeof(des_cipheronly_test_cases) / + sizeof(des_cipheronly_test_cases[0]); + tcs = des_cipheronly_test_cases; + break; case BLKCIPHER_AUTHONLY_TYPE: n_test_cases = sizeof(hash_test_cases) / sizeof(hash_test_cases[0]); diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h index 04ff1ee..fe97e4c 100644 --- a/app/test/test_cryptodev_blockcipher.h +++ b/app/test/test_cryptodev_blockcipher.h @@ -67,7 +67,8 @@ enum blockcipher_test_type { BLKCIPHER_AES_CIPHERONLY_TYPE, /* use aes_cipheronly_test_cases[] */ BLKCIPHER_3DES_CHAIN_TYPE, /* use triple_des_chain_test_cases[] */ BLKCIPHER_3DES_CIPHERONLY_TYPE, /* triple_des_cipheronly_test_cases[] */ - BLKCIPHER_AUTHONLY_TYPE /* use hash_test_cases[] */ + BLKCIPHER_AUTHONLY_TYPE,/* use hash_test_cases[] */ + BLKCIPHER_DES_CIPHERONLY_TYPE /* use des_cipheronly_test_cases[] */ }; struct blockcipher_test_case { diff --git a/app/test/test_cryptodev_des_test_vectors.h b/app/test/test_cryptodev_des_test_vectors.h index a1d2d97..388d87e 100644 --- a/app/test/test_cryptodev_des_test_vectors.h +++ b/app/test/test_cryptodev_des_test_vectors.h @@ -474,6 +474,75 @@ static const uint8_t ciphertext512_des128cbc[] = { 0x43, 0xfe, 0xf1, 0x10, 0x14, 0xf1, 0x91, 0xcc }; + +static const uint8_t ciphertext512_des[] = { + 0x1A, 0x46, 0xDB, 0x69, 0x43, 0x45, 0x0F, 0x2F, + 0xDC, 0x27, 0xF9, 0x41, 0x0E, 0x01, 0x58, 0xB4, + 0x5E, 0xCC, 0x13, 0xF5, 0x92, 0x99, 0xE4, 0xF2, + 0xD5, 0xF9, 0x16, 0xFE, 0x0F, 0x7E, 0xDE, 0xA0, + 0xF5, 0x32, 0xFE, 0x20, 0x67, 0x93, 0xCA, 0xE1, + 0x8E, 0x4D, 0x72, 0xA3, 0x50, 0x72, 0x14, 0x15, + 0x70, 0xE7, 0xAB, 0x49, 0x25, 0x88, 0x0E, 0x01, + 0x5C, 0x52, 0x87, 0xE2, 0x27, 0xDC, 0xD4, 0xD1, + 0x14, 0x1B, 0x08, 0x9F, 0x42, 0x48, 0x93, 0xA9, + 0xD1, 0x2F, 0x2C, 0x69, 0x48, 0x16, 0x59, 0xCF, + 0x8B, 0xF6, 0x8B, 0xD9, 0x34, 0xD4, 0xD7, 0xE4, + 0xAE, 0x35, 0xFD, 0xDA, 0x73, 0xBE, 0xDC, 0x6B, + 0x10, 0x90, 0x75, 0x2D, 0x4C, 0x14, 0x37, 0x8B, + 0xC8, 0xC7, 0xDF, 0x6E, 0x6F, 0xED, 0xF3, 0xE3, + 0xD3, 0x21, 0x29, 0xCD, 0x06, 0xB6, 0x5B, 0xF4, + 0xB9, 0xBD, 0x77, 0xA2, 0xF7, 0x91, 0xF4, 0x95, + 0xF0, 0xE0, 0x62, 0x03, 0x46, 0xAE, 0x1B, 0xEB, + 0xE2, 0xA9, 0xCF, 0xB9, 0x0E, 0x3B, 0xB9, 0xDA, + 0x5C, 0x1B, 0x45, 0x3F, 0xDD, 0xCC, 0xCC, 0xB3, + 0xF0,
[dpdk-dev] [PATCH 2/3] crypto/qat: add DES capability to Intel QAT driver
This commit adds DES capability to Intel QuickAssist Technology Driver Signed-off-by: Arek Kusztal--- doc/guides/cryptodevs/qat.rst| 1 + doc/guides/rel_notes/release_17_02.rst | 6 + drivers/crypto/qat/qat_adf/qat_algs.h| 1 + drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 16 + drivers/crypto/qat/qat_crypto.c | 29 +++- 5 files changed, 52 insertions(+), 1 deletion(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 607d244..3e97403 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -54,6 +54,7 @@ Cipher algorithms: * ``RTE_CRYPTO_CIPHER_AES_GCM`` * ``RTE_CRYPTO_CIPHER_NULL`` * ``RTE_CRYPTO_CIPHER_KASUMI_F8`` +* ``RTE_CRYPTO_CIPHER_DES_CBC`` Hash algorithms: diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst index 3b65038..8fd67ab 100644 --- a/doc/guides/rel_notes/release_17_02.rst +++ b/doc/guides/rel_notes/release_17_02.rst @@ -38,6 +38,12 @@ New Features Also, make sure to start the actual text at the margin. = +* **Updated the QAT PMD.** + + The QAT PMD was updated with additional support for: + + * DES algorithm. + Resolved Issues --- diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index dcc0df5..5409e1e 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -144,4 +144,5 @@ int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg); +int qat_alg_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg); #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index f4e24b3..fbeef0a 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -518,6 +518,10 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, total_key_size = ICP_QAT_HW_3DES_KEY_SZ; cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_3DES_BLK_SZ >> 3; proto = ICP_QAT_FW_LA_PROTO_GET(header->serv_specif_flags); + } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_DES) { + total_key_size = ICP_QAT_HW_DES_KEY_SZ; + cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_DES_BLK_SZ >> 3; + proto = ICP_QAT_FW_LA_PROTO_GET(header->serv_specif_flags); } else { total_key_size = cipherkeylen; cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3; @@ -858,6 +862,18 @@ int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg) return 0; } +int qat_alg_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg) +{ + switch (key_len) { + case ICP_QAT_HW_DES_KEY_SZ: + *alg = ICP_QAT_HW_CIPHER_ALGO_DES; + break; + default: + return -EINVAL; + } + return 0; +} + int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg) { switch (key_len) { diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 6a6bd2e..4ee1ef8 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -496,6 +496,26 @@ static const struct rte_cryptodev_capabilities qat_pmd_capabilities[] = { }, } }, } }, + { /* DES CBC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, + {.cipher = { + .algo = RTE_CRYPTO_CIPHER_DES_CBC, + .block_size = 8, + .key_size = { + .min = 8, + .max = 8, + .increment = 0 + }, + .iv_size = { + .min = 8, + .max = 8, + .increment = 0 + } + }, } + }, } + }, RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() }; @@ -637,6 +657,14 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev, } session->qat_mode = ICP_QAT_HW_CIPHER_CBC_MODE;
Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e
Hi Bernard, On 12/02/2016 01:58 PM, Iremonger, Bernard wrote: -Original Message- From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Andrew Rybchenko Sent: Friday, December 2, 2016 9:00 AM To: Lu, Wenzhuo; dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 00/31] Support VFD and DPDK PF + kernel VF on i40e On 12/02/2016 03:11 AM, Wenzhuo Lu wrote: 1, VF Daemon (VFD) VFD is an idea to control all the VFs from PF. As we need to support the scenario kernel PF + DPDK VF, DPDK follows the interface between kernel PF + kernel VF. We don't want to introduce too many new messages between PF and VF. So this patch set adds some new APIs to control VFs directly from PF. The new APIs include, 1) set VF MAC anti-spoofing 2) set VF VLAN anti-spoofing 3) set TX loopback 4) set VF unicast promiscuous mode 5) set VF multicast promiscuous mode 6) set VF MTU 7) get/reset VF stats 8) set VF MAC address 9) set VF VLAN stripping 10) VF VLAN insertion 12) set VF broadcast mode 12) set VF VLAN tag 13) set VF VLAN filter VFD also includes VF to PF mailbox message management by APP. When PF receives mailbox messages from VF, PF should call the callback provided by APP to know if they're permitted to be processed. The patch series adds i40e-specific API functions for VF control (advertise link status change, MAC anti-spoofing, VLAN anti-spoofing, promiscuous mode, MAC change, VLAN controls), but RTE API is added to get VF stats. I'm wondering why. Corresponding patches do not explain why i40e-specific API is added instead of generic RTE API. IMHO, it is hardly convenient for applications. (I guess it was a discussion and decision, but I've failed to find in the archive). Andrew. There was a discussion previously in DPDK 16.11 about this approach being used for the ixgbe PMD. I have attached the email thread. Many thanks. I see that it is a staging area waiting for a later generalization. Andrew.
[dpdk-dev] [PATCH] app/testpmd: supported offload capabilities query
Add two new commands "show port capa " and "show port capa all"to diaplay what offload capabilities supported in ports. It will not only display all the capabilities of the port, but also the enabling condition for each capability in the running time. Signed-off-by: Qiming Yang--- app/test-pmd/cmdline.c | 15 +++-- app/test-pmd/config.c | 172 + app/test-pmd/testpmd.h | 1 + 3 files changed, 184 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 63b55dc..4a9bcd3 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -5766,6 +5766,9 @@ static void cmd_showportall_parsed(void *parsed_result, else if (!strcmp(res->what, "dcb_tc")) FOREACH_PORT(i, ports) port_dcb_info_display(i); + else if (!strcmp(res->what, "capa")) + FOREACH_PORT(i, ports) + port_offload_capa_display(i); } cmdline_parse_token_string_t cmd_showportall_show = @@ -5775,13 +5778,14 @@ cmdline_parse_token_string_t cmd_showportall_port = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port"); cmdline_parse_token_string_t cmd_showportall_what = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what, -"info#stats#xstats#fdir#stat_qmap#dcb_tc"); + "info#stats#xstats#fdir#stat_qmap#dcb_tc#capa"); cmdline_parse_token_string_t cmd_showportall_all = TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all"); cmdline_parse_inst_t cmd_showportall = { .f = cmd_showportall_parsed, .data = NULL, - .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all", + .help_str = "show|clear port" + "info|stats|xstats|fdir|stat_qmap|dcb_tc|capa all", .tokens = { (void *)_showportall_show, (void *)_showportall_port, @@ -5821,6 +5825,8 @@ static void cmd_showport_parsed(void *parsed_result, nic_stats_mapping_display(res->portnum); else if (!strcmp(res->what, "dcb_tc")) port_dcb_info_display(res->portnum); + else if (!strcmp(res->what, "capa")) + port_offload_capa_display(res->portnum); } cmdline_parse_token_string_t cmd_showport_show = @@ -5830,14 +5836,15 @@ cmdline_parse_token_string_t cmd_showport_port = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port"); cmdline_parse_token_string_t cmd_showport_what = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what, -"info#stats#xstats#fdir#stat_qmap#dcb_tc"); + "info#stats#xstats#fdir#stat_qmap#dcb_tc#capa"); cmdline_parse_token_num_t cmd_showport_portnum = TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT8); cmdline_parse_inst_t cmd_showport = { .f = cmd_showport_parsed, .data = NULL, - .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X (X = port number)", + .help_str = "show|clear port" + "info|stats|xstats|fdir|stat_qmap|dcb_tc|capa X (X = port number)", .tokens = { (void *)_showport_show, (void *)_showport_port, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 36c47ab..9571426 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -536,6 +536,178 @@ port_infos_display(portid_t port_id) dev_info.tx_desc_lim.nb_min); printf("TXDs number alignment: %hu\n", dev_info.tx_desc_lim.nb_align); } +void +port_offload_capa_display(portid_t port_id) +{ + struct rte_eth_dev *dev; + struct rte_eth_dev_info dev_info; + static const char *info_border = ""; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + dev = _eth_devices[port_id]; + rte_eth_dev_info_get(port_id, _info); + + printf("\n%s Port %d supported offload features: %s\n", + info_border, port_id, info_border); + + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { + printf("VLAN stripped: "); + if (dev->data->dev_conf.rxmode.hw_vlan_strip) + printf("on\n"); + else + printf("off\n"); + } + + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) { + printf("RX IPv4 checksum: "); + if (dev->data->dev_conf.rxmode.hw_ip_checksum) + printf("on\n"); + else + printf("off\n"); + } + + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { + printf("RX UDP checksum: "); + if (dev->data->dev_conf.rxmode.hw_ip_checksum) +
Re: [dpdk-dev] [PATCH 30/31] net/i40e: support Linux VF to configure IRQ link list
On 12/2/2016 12:12 AM, Wenzhuo Lu wrote: > i40e PF host only support to work with DPDK VF driver, Linux > VF driver is not supported. This change will enhance in > configuring IRQ link list. > > This Change will identify VF client by number of vector > requested. DPDK VF will ask only single one while Linux VF > will request at least 2. It will have different configuration > for different clients. DPDK VF will be configured to link all > queue together, while Linux VF will be configured per request. > > Signed-off-by: Chen Jing D(Mark)> --- > drivers/net/i40e/i40e_pf.c | 151 > + > 1 file changed, 138 insertions(+), 13 deletions(-) > > diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c > index 1ad5ed1..4b0da75 100644 > --- a/drivers/net/i40e/i40e_pf.c > +++ b/drivers/net/i40e/i40e_pf.c > @@ -585,14 +585,116 @@ > return ret; > } > > +static void > +i40e_pf_config_irq_link_list(struct i40e_pf_vf *vf, > + struct i40e_virtchnl_vector_map *vvm) > +{ > + uint64_t linklistmap = 0, tempmap; > + struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf); > + uint16_t qid; > + bool b_first_q = true; > + enum i40e_queue_type qtype; > + uint16_t vector_id; > + uint32_t reg, reg_idx; > + uint16_t itr_idx = 0, i; > + > + vector_id = vvm->vector_id; > + /* setup the head */ > + if (!vector_id) > + reg_idx = I40E_VPINT_LNKLST0(vf->vf_idx); > + else > + reg_idx = I40E_VPINT_LNKLSTN( > + ((hw->func_caps.num_msix_vectors_vf - 1) * vf->vf_idx) > + + (vector_id - 1)); > + > + if (vvm->rxq_map == 0 && vvm->txq_map == 0) { > + I40E_WRITE_REG(hw, reg_idx, > +I40E_VPINT_LNKLST0_FIRSTQ_INDX_MASK); > + goto cfg_irq_done; > + } > + > + /* sort all rx and tx queues */ > + tempmap = vvm->rxq_map; > + for (i = 0; i < sizeof(vvm->rxq_map) * 8; i++) { > + if (tempmap & 0x1) > + linklistmap |= (1 << (2 * i)); > + tempmap >>= 1; > + } > + > + tempmap = vvm->txq_map; > + for (i = 0; i < sizeof(vvm->txq_map) * 8; i++) { > + if (tempmap & 0x1) > + linklistmap |= (1 << (2 * i + 1)); > + tempmap >>= 1; > + } > + > + /* Link all rx and tx queues into a chained list */ > + tempmap = linklistmap; > + i = 0; > + b_first_q = true; > + do { > + if (tempmap & 0x1) { > + qtype = i % 2; This cause ICC compilation error: .../app/test-pmd/cmdline.c:(.text+0x79d4): undefined reference to `rte_pmd_i40e_set_vf_vlan_stripq'
Re: [dpdk-dev] [PATCH 12/31] net/i40e: set VF MAC from PF support
On 12/2/2016 12:11 AM, Wenzhuo Lu wrote: > Support setting VF MAC address from PF. > User can call the API on PF to set a speific VF's s/speific/specific > MAC address. > > Signed-off-by: Ferruh Yigit<..>
Re: [dpdk-dev] [PATCH 05/31] net/i40e: set TX loopback from PF
On 12/2/2016 12:11 AM, Wenzhuo Lu wrote: > Support enabling/disabling TX loopback from PF. > User can call the API on PF to enable/disable TX loopback > for all the PF and VFs. > > Signed-off-by: Wenzhuo Lu> --- > drivers/net/i40e/i40e_ethdev.c| 219 > ++ > drivers/net/i40e/rte_pmd_i40e.h | 16 +++ > drivers/net/i40e/rte_pmd_i40e_version.map | 1 + > 3 files changed, 236 insertions(+) > > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index ec863b9..9fe9672 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -9938,3 +9938,222 @@ static void i40e_set_default_mac_addr(struct > rte_eth_dev *dev, <...> > +static int > +i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on) > +{ > + struct i40e_vsi_context ctxt; > + struct i40e_hw *hw; > + int ret; > + > + hw = I40E_VSI_TO_HW(vsi); > + > + /* Use the FW API if FW >= v5.0 */ > + if (hw->aq.fw_maj_ver < 5) { > + PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback"); > + return -ENOSYS; Checkpatch complains about ENOSYS usage: WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else What is intended error code here?
Re: [dpdk-dev] [PATCH 1/3] doc: update AESNI MB PMD guide
> -Original Message- > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Pablo de Lara > Sent: Thursday, December 1, 2016 9:37 AM > To: Doherty, Declan> Cc: dev@dpdk.org; De Lara Guarch, Pablo > Subject: [dpdk-dev] [PATCH 1/3] doc: update AESNI MB PMD guide > > The Intel(R) Multi Buffer Crypto library used in the AESNI MB PMD has been > moved to a new repository, in github. > This patch updates the link where it can be downloaded. > > Signed-off-by: Pablo de Lara Acked-by: John McNamara
Re: [dpdk-dev] [PATCH 3/3] doc: add missing supported algos for AESNI MB PMD
> -Original Message- > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Pablo de Lara > Sent: Thursday, December 1, 2016 9:37 AM > To: Doherty, Declan> Cc: dev@dpdk.org; De Lara Guarch, Pablo > Subject: [dpdk-dev] [PATCH 3/3] doc: add missing supported algos for AESNI > MB PMD > > AESNI MB PMD supports SHA224-HMAC and SHA384-HMAC, but the documentation > was not updated with this. > > Signed-off-by: Pablo de Lara Acked-by: John McNamara
Re: [dpdk-dev] [PATCH] nfp: add doc about supported features
> -Original Message- > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Alejandro Lucero > Sent: Friday, December 2, 2016 8:18 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] nfp: add doc about supported features > > Signed-off-by: Alejandro LuceroAcked-by: John McNamara
[dpdk-dev] [PATCH 11/18] net/ixgbe: parse n-tuple filter
From: wei zhao1Add rule validate function and check if the rule is a n-tuple rule, and get the n-tuple info. Signed-off-by: wei zhao1 Signed-off-by: Wenzhuo Lu --- drivers/net/ixgbe/ixgbe_ethdev.c | 349 +++ 1 file changed, 349 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index f84ca17..d3768c6 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -61,6 +61,8 @@ #include #include #include +#include +#include #include "ixgbe_logs.h" #include "base/ixgbe_api.h" @@ -393,6 +395,26 @@ static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, static int ixgbe_filter_restore(struct rte_eth_dev *dev); static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev); int ixgbe_flush_all_filter(struct rte_eth_dev *dev); +static enum +rte_flow_error_type cons_parse_ntuple_filter(const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_eth_ntuple_filter *filter); +static enum +rte_flow_error_type ixgbe_parse_ntuple_filter(const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_eth_ntuple_filter *filter); +enum rte_flow_error_type +ixgbe_flow_rule_validate(__rte_unused struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[]); +int ixgbe_flow_validate(struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_flow_error *error); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -778,6 +800,14 @@ static const struct rte_ixgbe_xstats_name_off rte_ixgbevf_stats_strings[] = { #define IXGBEVF_NB_XSTATS (sizeof(rte_ixgbevf_stats_strings) / \ sizeof(rte_ixgbevf_stats_strings[0])) +static const struct rte_flow_ops ixgbe_flow_ops = { + ixgbe_flow_validate, + NULL, + NULL, + NULL, + NULL, +}; + /** * Atomically reads the link status information from global * structure rte_eth_dev. @@ -6311,6 +6341,11 @@ ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, case RTE_ETH_FILTER_L2_TUNNEL: ret = ixgbe_dev_l2_tunnel_filter_handle(dev, filter_op, arg); break; + case RTE_ETH_FILTER_GENERIC: + if (filter_op != RTE_ETH_FILTER_GET) + return -EINVAL; + *(const void **)arg = _flow_ops; + break; default: PMD_DRV_LOG(WARNING, "Filter type (%d) not supported", filter_type); @@ -7995,6 +8030,320 @@ ixgbe_flush_all_filter(struct rte_eth_dev *dev) return 0; } +static inline uint32_t +rte_be_to_cpu_24(uint32_t x) +{ + return ((x & 0x00ffUL) << 16) | + (x & 0xff00UL) | + ((x & 0x00ffUL) >> 16); +} +#define IXGBE_MIN_N_TUPLE_PRIO 1 +#define IXGBE_MAX_N_TUPLE_PRIO 7 +#define PATTERN_SKIP_VOID(filter, filter_struct, ret)\ + do {\ + if (!pattern) {\ + memset(filter, 0, sizeof(filter_struct));\ + return ret;\ + } \ + item = pattern + i;\ + while (item->type == RTE_FLOW_ITEM_TYPE_VOID) {\ + i++;\ + item = pattern + i;\ + } \ + } while (0) + +#define ACTION_SKIP_VOID(filter, filter_struct, ret)\ + do {\ + if (!actions) {\ + memset(filter, 0, sizeof(filter_struct));\ + return ret;\ + } \ + act = actions + i;\ + while (act->type == RTE_FLOW_ACTION_TYPE_VOID) {\ + i++;\ + act = actions + i;\ + } \ + } while (0) + +/** + * Please aware there's an asumption for all the parsers. + * rte_flow_item is using big endian, rte_flow_attr and + * rte_flow_action are using CPU order. + * Because the pattern is used to describe the packets, + * normally the packets should use network order. + */ + +/** + * Parse the rule to see if it is
[dpdk-dev] [PATCH 00/18] net/ixgbe: Consistent filter API
From: wei zhao1The patches mainly finish following functions: 1) Store and restore all kinds of filters. 2) Parse all kinds of filters. 3) Add flow validate function. 4) Add flow create function. 5) Add flow destroy function. 6) Add flow flush function. wei zhao1 (18): net/ixgbe: store SYN filter net/ixgbe: store flow director filter net/ixgbe: store L2 tunnel filter net/ixgbe: restore n-tuple filter net/ixgbe: restore ether type filter net/ixgbe: restore SYN filter net/ixgbe: restore flow director filter net/ixgbe: restore L2 tunnel filter net/ixgbe: store and restore L2 tunnel configuration net/ixgbe: flush all the filters net/ixgbe: parse n-tuple filter net/ixgbe: parse ethertype filter net/ixgbe: parse SYN filter net/ixgbe: parse L2 tunnel filter net/ixgbe: parse flow director filter net/ixgbe: create consistent filter net/ixgbe: destroy consistent filter net/ixgbe: flush consistent filter drivers/net/ixgbe/ixgbe_ethdev.c | 2570 -- drivers/net/ixgbe/ixgbe_ethdev.h | 173 ++- drivers/net/ixgbe/ixgbe_fdir.c | 403 -- drivers/net/ixgbe/ixgbe_pf.c | 26 +- 4 files changed, 2982 insertions(+), 190 deletions(-) -- 2.5.5
Re: [dpdk-dev] [PATCH 4/4] lib/librte_vhost: improve vhost perf using rte_memset
2016-12-05 16:26, Zhiyong Yang: > +* **Introduced rte_memset and related test on IA platform.** > + > + Performance drop had been caused in some cases on Ivybridge when DPDK code > calls glibc > + function memset. It was necessary to introduce more high efficient > function to fix it. > + The function rte_memset supported three types of instruction sets > including sse & avx(128 bits), > + avx2(256 bits) and avx512(512bits). > + > + * Added rte_memset support on IA platform. > + * Added functional autotest support for rte_memset. > + * Added performance autotest support for rte_memset. No need to reference autotests in the release notes. > + * Improved performance to use rte_memset instead of copy_virtio_net_hdr in > lib/librte_vhost. Please describe this change at a higher level. Which case it is improving?
[dpdk-dev] [PATCH v3] nfp: report link speed using hardware info
Previous reported speed was hardcoded. v3: remove unsed macro v2: using RTE_DIM instead of own macro Signed-off-by: Alejandro Lucero--- drivers/net/nfp/nfp_net.c | 28 ++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index c6b1587..24f3164 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -816,6 +816,17 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) struct rte_eth_link link, old; uint32_t nn_link_status; + static const uint32_t ls_to_ethtool[] = { + [NFP_NET_CFG_STS_LINK_RATE_UNSUPPORTED] = ETH_SPEED_NUM_NONE, + [NFP_NET_CFG_STS_LINK_RATE_UNKNOWN] = ETH_SPEED_NUM_NONE, + [NFP_NET_CFG_STS_LINK_RATE_1G] = ETH_SPEED_NUM_1G, + [NFP_NET_CFG_STS_LINK_RATE_10G] = ETH_SPEED_NUM_10G, + [NFP_NET_CFG_STS_LINK_RATE_25G] = ETH_SPEED_NUM_25G, + [NFP_NET_CFG_STS_LINK_RATE_40G] = ETH_SPEED_NUM_40G, + [NFP_NET_CFG_STS_LINK_RATE_50G] = ETH_SPEED_NUM_50G, + [NFP_NET_CFG_STS_LINK_RATE_100G]= ETH_SPEED_NUM_100G, + }; + PMD_DRV_LOG(DEBUG, "Link update\n"); hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -831,8 +842,21 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) link.link_status = ETH_LINK_UP; link.link_duplex = ETH_LINK_FULL_DUPLEX; - /* Other cards can limit the tx and rx rate per VF */ - link.link_speed = ETH_SPEED_NUM_40G; + + nn_link_status = (nn_link_status >> NFP_NET_CFG_STS_LINK_RATE_SHIFT) & +NFP_NET_CFG_STS_LINK_RATE_MASK; + + if ((NFD_CFG_MAJOR_VERSION_of(hw->ver) < 4) || + ((NFD_CFG_MINOR_VERSION_of(hw->ver) == 4) && + (NFD_CFG_MINOR_VERSION_of(hw->ver) == 0))) + link.link_speed = ETH_SPEED_NUM_40G; + else { + if (nn_link_status == NFP_NET_CFG_STS_LINK_RATE_UNKNOWN || + nn_link_status >= RTE_DIM(ls_to_ethtool)) + link.link_speed = ETH_SPEED_NUM_NONE; + else + link.link_speed = ls_to_ethtool[nn_link_status]; + } if (old.link_status != link.link_status) { nfp_net_dev_atomic_write_link_status(dev, ); -- 1.9.1
[dpdk-dev] [PATCH 3/4] app/test: add performance autotest for rte_memset
The file implements the perf autotest for rte_memset. The perf data can be gotten compared between memset and rte_memset when you run it. The first column shows the N size for memset. The second column lists a set of numbers for memset in cache, The third column lists a set of numbers for memset in memory. Usage: step 1: run ./x86_64-native-linuxapp-gcc/app/test step 2: run command memset_perf_autotest at the run time. Signed-off-by: Zhiyong Yang--- app/test/Makefile | 1 + app/test/test_memset_perf.c | 348 2 files changed, 349 insertions(+) create mode 100644 app/test/test_memset_perf.c diff --git a/app/test/Makefile b/app/test/Makefile index 82da3f3..1c3e7f1 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -124,6 +124,7 @@ SRCS-y += test_memcpy.c SRCS-y += test_memcpy_perf.c SRCS-y += test_memset.c +SRCS-y += test_memset_perf.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash.c SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_thash.c diff --git a/app/test/test_memset_perf.c b/app/test/test_memset_perf.c new file mode 100644 index 000..83b15b5 --- /dev/null +++ b/app/test/test_memset_perf.c @@ -0,0 +1,348 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "test.h" + +/* + * Set this to the maximum buffer size you want to test. If it is 0, then the + * values in the buf_sizes[] array below will be used. + */ +#define TEST_VALUE_RANGE0 + +/* List of buffer sizes to test */ +#if TEST_VALUE_RANGE == 0 +static size_t buf_sizes[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 31, 32, 33, 63, 64, 65, + 70, 85, 96, 105, 115, 127, 128, 129, 161, 191, 192, 193, 255, 256, + 257, 319, 320, 321, 383, 384, 385, 447, 448, 449, 511, 512, 513, + 767, 768, 769, 1023, 1024, 1025, 1518, 1522, 1536, 1600, 2048, 2560, + 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192 +}; +/* MUST be as large as largest packet size above */ +#define SMALL_BUFFER_SIZE 8192 +#else /* TEST_VALUE_RANGE != 0 */ +static size_t buf_sizes[TEST_VALUE_RANGE]; +#define SMALL_BUFFER_SIZE TEST_VALUE_RANGE +#endif /* TEST_VALUE_RANGE == 0 */ + +/* + * Arrays of this size are used for measuring uncached memory accesses by + * picking a random location within the buffer. Make this smaller if there are + * memory allocation errors. + */ +#define LARGE_BUFFER_SIZE (100 * 1024 * 1024) + +/* How many times to run timing loop for performance tests */ +#define TEST_ITERATIONS 100 +#define TEST_BATCH_SIZE 100 + +/* Data is aligned on this many bytes (power of 2) */ +#ifdef RTE_MACHINE_CPUFLAG_AVX512F +#define ALIGNMENT_UNIT 64 +#elif defined RTE_MACHINE_CPUFLAG_AVX2 +#define ALIGNMENT_UNIT 32 +#else /* RTE_MACHINE_CPUFLAG */ +#define ALIGNMENT_UNIT 16 +#endif /* RTE_MACHINE_CPUFLAG */ + +/* + * Pointers used in performance tests. The two large buffers are for uncached + * access where random addresses within the buffer are used for each + * memset. The two small buffers are for cached access. + */ +static uint8_t *large_buf_read, *large_buf_write; +static uint8_t *small_buf_read, *small_buf_write; + +/*
[dpdk-dev] [PATCH 0/4] eal/common: introduce rte_memset and related test
DPDK code has met performance drop badly in some case when calling glibc function memset. Reference to discussions about memset in http://dpdk.org/ml/archives/dev/2016-October/048628.html It is necessary to introduce more high efficient function to fix it. One important thing about rte_memset is that we can get clear control on what instruction flow is used. This patchset introduces rte_memset to bring more high efficient implementation, and will bring obvious perf improvement, especially for small N bytes in the most application scenarios. Patch 1 implements rte_memset in the file rte_memset.h on IA platform The file supports three types of instruction sets including sse & avx (128bits), avx2(256bits) and avx512(512bits). rte_memset makes use of vectorization and inline function to improve the perf on IA. In addition, cache line and memory alignment are fully taken into consideration. Patch 2 implements functional autotest to validates the function whether to work in a right way. Patch 3 implements performance autotest separately in cache and memory. Patch 4 Using rte_memset instead of copy_virtio_net_hdr can bring 3%~4% performance improvements on IA platform from virtio/vhost non-mergeable loopback testing. Zhiyong Yang (4): eal/common: introduce rte_memset on IA platform app/test: add functional autotest for rte_memset app/test: add performance autotest for rte_memset lib/librte_vhost: improve vhost perf using rte_memset app/test/Makefile | 3 + app/test/test_memset.c | 158 + app/test/test_memset_perf.c| 348 +++ doc/guides/rel_notes/release_17_02.rst | 11 + .../common/include/arch/x86/rte_memset.h | 376 + lib/librte_eal/common/include/generic/rte_memset.h | 51 +++ lib/librte_vhost/virtio_net.c | 18 +- 7 files changed, 958 insertions(+), 7 deletions(-) create mode 100644 app/test/test_memset.c create mode 100644 app/test/test_memset_perf.c create mode 100644 lib/librte_eal/common/include/arch/x86/rte_memset.h create mode 100644 lib/librte_eal/common/include/generic/rte_memset.h -- 2.7.4
[dpdk-dev] [PATCH] vhost: optimize vhost memcpy
This patch optimizes Vhost performance for large packets when the Mergeable Rx buffer feature is enabled. It introduces a dedicated memcpy function for vhost enqueue/dequeue to replace rte_memcpy. The reason is that rte_memcpy is for general cases, it handles unaligned copies and make store aligned, it even makes load aligned for micro architectures like Ivy Bridge. However alignment handling comes at a price: It introduces extra load/store instructions. Vhost memcpy is rather special: The copy is aligned, and remote, and there is header write along which is also remote. In this case the memcpy instruction stream should be simplified, to reduce extra load/store, therefore reduce the probability of load/store buffer full caused pipeline stall, to let the actual memcpy instructions be issued and let H/W prefetcher goes to work as early as possible. Performance gain is visible when packet size: 1. Larger than 512 bytes on AVX/SSE platforms like Ivy Bridge 2. Larger than 256 bytes on AVX2 platforms like Haswell 3. Larger than 512 bytes on AVX512 platforms like Skylake Up to 20% gain can be achieved by this patch for PVP traffic. The test can also be conducted without NIC, by using loopback traffic between Vhost and Virtio. For example, increase TXONLY_DEF_PACKET_LEN to the requested packet size in testpmd.h, rebuild and start testpmd in both host and guest, then "start" on one side and "start tx_first 32" on the other. Signed-off-by: Zhihong Wang--- lib/librte_vhost/virtio_net.c | 72 +-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 595f67c..cd6f21a 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -50,6 +50,72 @@ #define MAX_PKT_BURST 32 #define VHOST_LOG_PAGE 4096 +/** + * This function is used to for vhost memcpy, to replace rte_memcpy. + * The reason is that rte_memcpy is for general cases, where vhost + * memcpy is a rather special case: The copy is aligned, and remote, + * and there is header write along which is also remote. In this case + * the memcpy instruction stream should be simplified to reduce extra + * load/store, therefore reduce the probability of load/store buffer + * full caused pipeline stall, to let the actual memcpy instructions + * be issued and let H/W prefetcher goes to work as early as possible. + */ +static inline void __attribute__((always_inline)) +vhost_memcpy(void *dst, const void *src, size_t n) +{ + /* Copy size <= 16 bytes */ + if (n < 16) { + if (n & 0x01) { + *(uint8_t *)dst = *(const uint8_t *)src; + src = (const uint8_t *)src + 1; + dst = (uint8_t *)dst + 1; + } + if (n & 0x02) { + *(uint16_t *)dst = *(const uint16_t *)src; + src = (const uint16_t *)src + 1; + dst = (uint16_t *)dst + 1; + } + if (n & 0x04) { + *(uint32_t *)dst = *(const uint32_t *)src; + src = (const uint32_t *)src + 1; + dst = (uint32_t *)dst + 1; + } + if (n & 0x08) + *(uint64_t *)dst = *(const uint64_t *)src; + + return; + } + + /* Copy 16 <= size <= 32 bytes */ + if (n <= 32) { + rte_mov16((uint8_t *)dst, (const uint8_t *)src); + rte_mov16((uint8_t *)dst - 16 + n, + (const uint8_t *)src - 16 + n); + + return; + } + + /* Copy 32 < size <= 64 bytes */ + if (n <= 64) { + rte_mov32((uint8_t *)dst, (const uint8_t *)src); + rte_mov32((uint8_t *)dst - 32 + n, + (const uint8_t *)src - 32 + n); + + return; + } + + /* Copy 64 bytes blocks */ + for (; n >= 64; n -= 64) { + rte_mov64((uint8_t *)dst, (const uint8_t *)src); + dst = (uint8_t *)dst + 64; + src = (const uint8_t *)src + 64; + } + + /* Copy whatever left */ + rte_mov64((uint8_t *)dst - 64 + n, + (const uint8_t *)src - 64 + n); +} + static inline void __attribute__((always_inline)) vhost_log_page(uint8_t *log_base, uint64_t page) { @@ -246,7 +312,7 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vring_desc *descs, } cpy_len = RTE_MIN(desc_avail, mbuf_avail); - rte_memcpy((void *)((uintptr_t)(desc_addr + desc_offset)), + vhost_memcpy((void *)((uintptr_t)(desc_addr + desc_offset)), rte_pktmbuf_mtod_offset(m, void *, mbuf_offset), cpy_len); vhost_log_write(dev, desc->addr + desc_offset, cpy_len); @@ -522,7 +588,7 @@
Re: [dpdk-dev] [PATCH v12 1/6] ethdev: add Tx preparation
Hi Konstantin, On Fri, 2 Dec 2016 01:06:30 +, "Ananyev, Konstantin"wrote: > > > > 2016-11-23 18:36, Tomasz Kulasek: > > > +/** > > > + * Process a burst of output packets on a transmit queue of an > > > Ethernet device. > > > + * > > > + * The rte_eth_tx_prepare() function is invoked to prepare > > > output packets to be > > > + * transmitted on the output queue *queue_id* of the Ethernet > > > device designated > > > + * by its *port_id*. > > > + * The *nb_pkts* parameter is the number of packets to be > > > prepared which are > > > + * supplied in the *tx_pkts* array of *rte_mbuf* structures, > > > each of them > > > + * allocated from a pool created with rte_pktmbuf_pool_create(). > > > + * For each packet to send, the rte_eth_tx_prepare() function > > > performs > > > + * the following operations: > > > + * > > > + * - Check if packet meets devices requirements for tx offloads. > > > + * > > > + * - Check limitations about number of segments. > > > + * > > > + * - Check additional requirements when debug is enabled. > > > + * > > > + * - Update and/or reset required checksums when tx offload is > > > set for packet. > > > + * > > > + * Since this function can modify packet data, provided mbufs > > > must be safely > > > + * writable (e.g. modified data cannot be in shared segment). > > > > I think we will have to remove this limitation in next releases. > > As we don't know how it could affect the API, I suggest to declare > > this API EXPERIMENTAL. > > While I don't really mind to mart it as experimental, I don't really > understand the reasoning: Why " this function can modify packet data, > provided mbufs must be safely writable" suddenly becomes a problem? > That seems like and obvious limitation to me and let say tx_burst() > has the same one. Second, I don't see how you are going to remove it > without introducing a heavy performance impact. Konstantin > About tx_burst(), I don't think we should force the user to provide a writable mbuf. There are many use cases where passing a clone already works as of today and it avoids duplicating the mbuf data. For instance: traffic generator, multicast, bridging/tap, etc... Moreover, this requirement would be inconsistent with the model you are proposing in case of pipeline: - tx_prepare() on core X, may update the data - tx_burst() on core Y, should not touch the data to avoid cache misses Regards, Olivier
[dpdk-dev] [PATCH 31/31] i40e: enhance in sanity check of mac
When VF sends request to add a new mac address, PF host will check if it's a non-zero or uncast address, or it will return with error. In fact, VF still can set multicast address. This change remove to check if it's a unicast address. Signed-off-by: Chen Jing D(Mark)--- drivers/net/i40e/i40e_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 4b0da75..c9cca1e 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -890,7 +890,7 @@ mac = (struct ether_addr *)(addr_list->list[i].addr); (void)rte_memcpy(_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - if(!is_valid_assigned_ether_addr(mac) || + if(is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, )) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; -- 1.9.3
[dpdk-dev] [PATCH 28/31] net/i40e: return correct vsi_id
PF host didn't return correct VSI id to VF. This change fix it. Signed-off-by: Chen Jing D(Mark)--- drivers/net/i40e/i40e_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 0f582ed..8319c2c 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -351,8 +351,7 @@ /* Change below setting if PF host can support more VSIs for VF */ vf_res->vsi_res[0].vsi_type = I40E_VSI_SRIOV; - /* As assume Vf only has single VSI now, always return 0 */ - vf_res->vsi_res[0].vsi_id = 0; + vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; ether_addr_copy(>mac_addr, (struct ether_addr *)vf_res->vsi_res[0].default_mac_addr); -- 1.9.3
[dpdk-dev] [PATCH 20/31] app/testpmd: use VFD APIs on i40e
The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd code to use them, inlcuding VF MAC anti-spoofing, VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN insert. Signed-off-by: Wenzhuo LuSigned-off-by: Chen Jing D(Mark) Signed-off-by: Bernard Iremonger --- app/test-pmd/cmdline.c | 92 ++ 1 file changed, 85 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 63b55dc..1284d6c 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -90,6 +90,9 @@ #ifdef RTE_LIBRTE_IXGBE_PMD #include #endif +#ifdef RTE_LIBRTE_I40E_PMD +#include +#endif #include "testpmd.h" static struct cmdline *testpmd_cl; @@ -10806,9 +10809,22 @@ struct cmd_vf_vlan_anti_spoof_result { struct cmd_vf_vlan_anti_spoof_result *res = parsed_result; int ret = 0; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; + + memset(_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, _info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, + res->vf_id, + is_on); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_vf_vlan_anti_spoof(res->port_id, + res->vf_id, + is_on); + else + ret = -ENOSYS; - ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, - is_on); switch (ret) { case 0: break; @@ -10818,6 +10834,9 @@ struct cmd_vf_vlan_anti_spoof_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOSYS: + printf("function not implemented\n"); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -10891,9 +10910,22 @@ struct cmd_vf_mac_anti_spoof_result { struct cmd_vf_mac_anti_spoof_result *res = parsed_result; int ret; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; + + memset(_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, _info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, + res->vf_id, + is_on); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_vf_mac_anti_spoof(res->port_id, +res->vf_id, +is_on); + else + ret = -ENOSYS; - ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id, - is_on); switch (ret) { case 0: break; @@ -10903,6 +10935,9 @@ struct cmd_vf_mac_anti_spoof_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOSYS: + printf("function not implemented\n"); + break; default: printf("programming error: (%s)\n", strerror(-ret)); } @@ -10976,8 +11011,20 @@ struct cmd_vf_vlan_stripq_result { struct cmd_vf_vlan_stripq_result *res = parsed_result; int ret = 0; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; + + memset(_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, _info); + + if (strstr(dev_info.driver_name, "ixgbe") != NULL) + ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, + res->vf_id, is_on); + else if (strstr(dev_info.driver_name, "i40e") != NULL) + ret = rte_pmd_i40e_set_vf_vlan_stripq(res->port_id, + res->vf_id, is_on); + else + ret = -ENOSYS; - ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on); switch (ret) { case 0: break; @@ -10987,6 +11034,9 @@ struct cmd_vf_vlan_stripq_result { case -ENODEV: printf("invalid port_id %d\n", res->port_id); break; + case -ENOSYS: + printf("function not implemented\n"); + break; default:
[dpdk-dev] [PATCH 12/31] net/i40e: set VF MAC from PF support
Support setting VF MAC address from PF. User can call the API on PF to set a speific VF's MAC address. Signed-off-by: Ferruh Yigit--- app/test/Makefile | 8 +++ app/test/test_pmd_i40e.c | 96 +++ drivers/net/i40e/i40e_ethdev.c| 42 ++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 + 5 files changed, 167 insertions(+) create mode 100644 app/test/test_pmd_i40e.c diff --git a/app/test/Makefile b/app/test/Makefile index 5be023a..b3f6ecb 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -199,6 +199,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c +SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += test_pmd_i40e.c + CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) @@ -228,6 +230,12 @@ endif endif endif +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y) +LDLIBS += -lrte_pmd_i40e +endif +endif + ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y) LDLIBS += -larchive endif diff --git a/app/test/test_pmd_i40e.c b/app/test/test_pmd_i40e.c new file mode 100644 index 000..c901e89 --- /dev/null +++ b/app/test/test_pmd_i40e.c @@ -0,0 +1,96 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2016 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include + +#include "test.h" + +#define I40E_DRV_NAME "net_i40e" + +static struct ether_addr mac_addr = { + { 0xAA, 0xBB, 0xCC, 0xDD, 0x00, 0x00 } +}; + +static const int max_vfs = 3; + +static int +test_i40e(void) +{ + struct rte_eth_dev_info dev_info; + struct ether_addr current_mac_addr; + uint8_t nb_ports; + uint8_t port; + int ret = 0; + int i; + + nb_ports = rte_eth_dev_count(); + printf("nb_ports=%d\n", nb_ports); + + for (port = 0; port < nb_ports; port++) { + rte_eth_dev_info_get(port, _info); + + printf("%d: %s\n", port, dev_info.driver_name); + + if (strcmp(dev_info.driver_name, I40E_DRV_NAME)) + continue; + + rte_eth_macaddr_get(port, _mac_addr); + + printf("%d: mac address:", port); + for (i = 0; i < ETHER_ADDR_LEN - 1; i++) + printf("%x:", current_mac_addr.addr_bytes[i]); + printf("%x\n", current_mac_addr.addr_bytes[ETHER_ADDR_LEN - 1]); + + for (i = 0; i < max_vfs; i++) { + if (i >= dev_info.max_vfs) + break; + + mac_addr.addr_bytes[ETHER_ADDR_LEN - 2] = port + 1; + mac_addr.addr_bytes[ETHER_ADDR_LEN - 1] = i + 1; + + ret = rte_pmd_i40e_set_vf_mac_addr(port, i, _addr); + printf("port:%d vf:%d set mac %s\n", + port, i, ret ? "failed" : "succeed"); + } + } + + return 0; +} + +REGISTER_TEST_COMMAND(i40e_autotest, test_i40e); diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 319080e..bfc9169 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -10293,3 +10293,45 @@ static void
[dpdk-dev] [PATCH 07/31] net/i40e: set VF multicast promisc mode from PF
Support enabling/disabling VF multicast promicscuous mode from PF. User can call the API on PF to enable/disable a specific VF's multicast promiscuous mode. Signed-off-by: Wenzhuo Lu--- drivers/net/i40e/i40e_ethdev.c| 36 +++ drivers/net/i40e/rte_pmd_i40e.h | 19 drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 56 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 3aaa07d..728061d 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -10193,3 +10193,39 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev, return ret; } + +int +rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on) +{ + struct rte_eth_dev *dev; + struct rte_eth_dev_info dev_info; + struct i40e_pf *pf; + struct i40e_pf_vf *vf; + struct i40e_hw *hw; + int ret; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); + + dev = _eth_devices[port]; + rte_eth_dev_info_get(port, _info); + + if (vf_id >= dev_info.max_vfs) + return -EINVAL; + + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); + + if (vf_id > pf->vf_num - 1 || !pf->vfs) { + PMD_DRV_LOG(ERR, "Invalid argument."); + return -EINVAL; + } + + vf = >vfs[vf_id]; + hw = I40E_VSI_TO_HW(vf->vsi); + + ret = i40e_aq_set_vsi_multicast_promiscuous(hw, vf->vsi->seid, + on, NULL); + if (ret != I40E_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to set multicast promiscuous mode"); + + return ret; +} diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h index 4c98136..9091520 100644 --- a/drivers/net/i40e/rte_pmd_i40e.h +++ b/drivers/net/i40e/rte_pmd_i40e.h @@ -149,4 +149,23 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on); +/** + * Enable/Disable VF multicast promiscuous mode. + * + * @param port + *The port identifier of the Ethernet device. + * @param vf + *VF on which to set. + * @param on + *1 - Enable. + *0 - Disable. + * @return + * - (0) if successful. + * - (-ENODEV) if *port* invalid. + * - (-EINVAL) if bad parameter. + */ +int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, + uint16_t vf_id, + uint8_t on); + #endif /* _PMD_I40E_H_ */ diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map index 24b78ce..08d3028 100644 --- a/drivers/net/i40e/rte_pmd_i40e_version.map +++ b/drivers/net/i40e/rte_pmd_i40e_version.map @@ -11,4 +11,5 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_anti_spoof; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_unicast_promisc; + rte_pmd_i40e_set_vf_multicast_promisc; } DPDK_2.0; -- 1.9.3
[dpdk-dev] [PATCH 02/31] net/i40e: add callback to user on VF to PF mbox msg
The callback asks the user application if it is allowed to perform the mailbox messages. If the return value from user is RTE_PMD_I40E_MB_EVENT_PROCEED then continue. If ACK or NACK, do nothing and send not_supported to VF. Signed-off-by: Wenzhuo Lu--- drivers/net/i40e/i40e_pf.c | 230 ++-- drivers/net/i40e/rte_pmd_i40e.h | 21 2 files changed, 216 insertions(+), 35 deletions(-) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index f70712b..8b8a14f 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -55,6 +55,7 @@ #include "i40e_ethdev.h" #include "i40e_rxtx.h" #include "i40e_pf.h" +#include "rte_pmd_i40e.h" #define I40E_CFG_CRCSTRIP_DEFAULT 1 @@ -272,14 +273,23 @@ } static void -i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf, bool b_op) { struct i40e_virtchnl_version_info info; info.major = I40E_DPDK_VERSION_MAJOR; info.minor = I40E_DPDK_VERSION_MINOR; - i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION, - I40E_SUCCESS, (uint8_t *), sizeof(info)); + + if (b_op) + i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION, + I40E_SUCCESS, + (uint8_t *), + sizeof(info)); + else + i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION, + I40E_NOT_SUPPORTED, + (uint8_t *), + sizeof(info)); } static int @@ -292,13 +302,20 @@ } static int -i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op) { struct i40e_virtchnl_vf_resource *vf_res = NULL; struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf); uint32_t len = 0; int ret = I40E_SUCCESS; + if (!b_op) { + i40e_pf_host_send_msg_to_vf(vf, + I40E_VIRTCHNL_OP_GET_VF_RESOURCES, + I40E_NOT_SUPPORTED, NULL, 0); + return ret; + } + /* only have 1 VSI by default */ len = sizeof(struct i40e_virtchnl_vf_resource) + I40E_DEFAULT_VF_VSI_NUM * @@ -423,7 +440,8 @@ static int i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf); struct i40e_vsi *vsi = vf->vsi; @@ -432,6 +450,13 @@ struct i40e_virtchnl_queue_pair_info *vc_qpi; int i, ret = I40E_SUCCESS; + if (!b_op) { + i40e_pf_host_send_msg_to_vf(vf, + I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES, + I40E_NOT_SUPPORTED, NULL, 0); + return ret; + } + if (!msg || vc_vqci->num_queue_pairs > vsi->nb_qps || vc_vqci->num_queue_pairs > I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci, @@ -482,7 +507,8 @@ static int i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf); struct i40e_vsi *vsi = vf->vsi; @@ -491,6 +517,14 @@ struct i40e_virtchnl_queue_pair_ext_info *vc_qpei; int i, ret = I40E_SUCCESS; + if (!b_op) { + i40e_pf_host_send_msg_to_vf( + vf, + I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT, + I40E_NOT_SUPPORTED, NULL, 0); + return ret; + } + if (!msg || vc_vqcei->num_queue_pairs > vsi->nb_qps || vc_vqcei->num_queue_pairs > I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei, @@ -539,12 +573,21 @@ static int i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, - uint8_t *msg, uint16_t msglen) + uint8_t *msg, uint16_t msglen, + bool b_op) { int ret = I40E_SUCCESS; struct i40e_virtchnl_irq_map_info *irqmap = (struct i40e_virtchnl_irq_map_info *)msg; + if (!b_op)
[dpdk-dev] [PATCH 25/31] net/sfc: add basic stubs for RSS support on driver attach
From: Ivan MalovReviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- doc/guides/nics/sfc_efx.rst | 2 ++ drivers/net/sfc/efsys.h | 2 +- drivers/net/sfc/sfc.c| 76 + drivers/net/sfc/sfc.h| 17 ++ drivers/net/sfc/sfc_ethdev.c | 8 + drivers/net/sfc/sfc_rx.c | 81 +++- drivers/net/sfc/sfc_rx.h | 8 + 7 files changed, 192 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index ee2ba27..4f674c0 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -66,6 +66,8 @@ SFC EFX PMD has support for: - Received packet type information +- Receive side scaling (RSS) + - Scattered Rx DMA for packet that are larger that a single Rx descriptor - Deferred receive and transmit queue start diff --git a/drivers/net/sfc/efsys.h b/drivers/net/sfc/efsys.h index 0f941e6..fb2f3b5 100644 --- a/drivers/net/sfc/efsys.h +++ b/drivers/net/sfc/efsys.h @@ -195,7 +195,7 @@ prefetch_read_once(const volatile void *addr) #define EFSYS_OPT_BOOTCFG 0 #define EFSYS_OPT_DIAG 0 -#define EFSYS_OPT_RX_SCALE 0 +#define EFSYS_OPT_RX_SCALE 1 #define EFSYS_OPT_QSTATS 0 /* Filters support is required for SFN7xxx and SFN8xx */ #define EFSYS_OPT_FILTER 1 diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index e2e6c9e..e79367d 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -484,6 +484,73 @@ sfc_mem_bar_fini(struct sfc_adapter *sa) memset(ebp, 0, sizeof(*ebp)); } +#if EFSYS_OPT_RX_SCALE +/* + * A fixed RSS key which has a property of being symmetric + * (symmetrical flows are distributed to the same CPU) + * and also known to give a uniform distribution + * (a good distribution of traffic between different CPUs) + */ +static const uint8_t default_rss_key[SFC_RSS_KEY_SIZE] = { + 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, + 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, + 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, + 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, + 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, 0x6d, 0x5a, +}; +#endif + +static int +sfc_set_rss_defaults(struct sfc_adapter *sa) +{ +#if EFSYS_OPT_RX_SCALE + int rc; + + rc = efx_intr_init(sa->nic, sa->intr.type, NULL); + if (rc != 0) + goto fail_intr_init; + + rc = efx_ev_init(sa->nic); + if (rc != 0) + goto fail_ev_init; + + rc = efx_rx_init(sa->nic); + if (rc != 0) + goto fail_rx_init; + + rc = efx_rx_scale_support_get(sa->nic, >rss_support); + if (rc != 0) + goto fail_scale_support_get; + + rc = efx_rx_hash_support_get(sa->nic, >hash_support); + if (rc != 0) + goto fail_hash_support_get; + + efx_rx_fini(sa->nic); + efx_ev_fini(sa->nic); + efx_intr_fini(sa->nic); + + sa->rss_hash_types = sfc_rte_to_efx_hash_type(SFC_RSS_OFFLOADS); + + rte_memcpy(sa->rss_key, default_rss_key, sizeof(sa->rss_key)); + + return 0; + +fail_hash_support_get: +fail_scale_support_get: +fail_rx_init: + efx_ev_fini(sa->nic); + +fail_ev_init: + efx_intr_fini(sa->nic); + +fail_intr_init: + return rc; +#else + return 0; +#endif +} + int sfc_attach(struct sfc_adapter *sa) { @@ -550,6 +617,10 @@ sfc_attach(struct sfc_adapter *sa) efx_phy_adv_cap_get(sa->nic, EFX_PHY_CAP_PERM, >port.phy_adv_cap_mask); + rc = sfc_set_rss_defaults(sa); + if (rc != 0) + goto fail_set_rss_defaults; + sfc_log_init(sa, "fini nic"); efx_nic_fini(enp); @@ -558,7 +629,12 @@ sfc_attach(struct sfc_adapter *sa) sfc_log_init(sa, "done"); return 0; +fail_set_rss_defaults: + sfc_intr_detach(sa); + fail_intr_attach: + efx_nic_fini(sa->nic); + fail_estimate_rsrc_limits: fail_nic_reset: sfc_log_init(sa, "unprobe nic"); diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index f0bbaf8..01dbfb6 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -42,6 +42,13 @@ extern "C" { #endif +#if EFSYS_OPT_RX_SCALE +/** RSS key length (bytes) */ +#defineSFC_RSS_KEY_SIZE40 +/** RSS hash offloads mask */ +#defineSFC_RSS_OFFLOADS(ETH_RSS_IP | ETH_RSS_TCP) +#endif + /* * +---+ * | UNINITIALIZED |<---+ @@ -187,6 +194,16 @@ struct sfc_adapter { unsigned inttxq_count; struct sfc_txq_info *txq_info; + + unsigned intrss_channels; + +#if EFSYS_OPT_RX_SCALE + efx_rx_scale_support_t rss_support; +
[dpdk-dev] [PATCH 30/31] net/sfc: add callback to update RSS redirection table
From: Ivan MalovReviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + drivers/net/sfc/sfc_ethdev.c | 60 2 files changed, 61 insertions(+) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 4f6f117..07c58d5 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -16,6 +16,7 @@ Allmulticast mode= Y Multicast MAC filter = Y RSS hash = Y RSS key update = Y +RSS reta update = Y Flow control = Y VLAN offload = P L3 checksum offload = Y diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 0cd96ac..09cc46b 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1117,6 +1117,65 @@ sfc_dev_rss_reta_query(struct rte_eth_dev *dev, return 0; } + +static int +sfc_dev_rss_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ + struct sfc_adapter *sa = dev->data->dev_private; + unsigned int *rss_tbl_new; + uint16_t entry; + int rc; + + + if ((sa->rss_channels == 1) || + (sa->rss_support != EFX_RX_SCALE_EXCLUSIVE)) { + sfc_err(sa, "RSS is not available"); + return -ENOTSUP; + } + + if (reta_size != EFX_RSS_TBL_SIZE) { + sfc_err(sa, "RETA size is wrong (should be %hu)", + EFX_RSS_TBL_SIZE); + return -EINVAL; + } + + rss_tbl_new = rte_zmalloc("rss_tbl_new", sizeof(sa->rss_tbl), 0); + if (rss_tbl_new == NULL) + return -ENOMEM; + + sfc_adapter_lock(sa); + + rte_memcpy(rss_tbl_new, sa->rss_tbl, sizeof(sa->rss_tbl)); + + for (entry = 0; entry < reta_size; entry++) { + int grp_idx = entry % RTE_RETA_GROUP_SIZE; + struct rte_eth_rss_reta_entry64 *grp; + + grp = _conf[entry / RTE_RETA_GROUP_SIZE]; + + if (grp->mask & (1ull << grp_idx)) { + if (grp->reta[grp_idx] >= sa->rss_channels) { + rc = EINVAL; + goto bad_reta_entry; + } + rss_tbl_new[entry] = grp->reta[grp_idx]; + } + } + + rc = efx_rx_scale_tbl_set(sa->nic, rss_tbl_new, EFX_RSS_TBL_SIZE); + if (rc == 0) + rte_memcpy(sa->rss_tbl, rss_tbl_new, sizeof(sa->rss_tbl)); + +bad_reta_entry: + sfc_adapter_unlock(sa); + + rte_free(rss_tbl_new); + + SFC_ASSERT(rc >= 0); + return -rc; +} #endif static const struct eth_dev_ops sfc_eth_dev_ops = { @@ -1151,6 +1210,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .flow_ctrl_set = sfc_flow_ctrl_set, .mac_addr_set = sfc_mac_addr_set, #if EFSYS_OPT_RX_SCALE + .reta_update= sfc_dev_rss_reta_update, .reta_query = sfc_dev_rss_reta_query, .rss_hash_update= sfc_dev_rss_hash_update, .rss_hash_conf_get = sfc_dev_rss_hash_conf_get, -- 2.5.5
[dpdk-dev] [PATCH 27/31] net/sfc: add callback to query RSS key and hash types config
From: Ivan MalovReviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 33 + drivers/net/sfc/sfc_rx.c | 22 ++ drivers/net/sfc/sfc_rx.h | 1 + 3 files changed, 56 insertions(+) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index b17607f..c78d798 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -997,6 +997,36 @@ sfc_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) return 0; } +#if EFSYS_OPT_RX_SCALE +static int +sfc_dev_rss_hash_conf_get(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) +{ + struct sfc_adapter *sa = dev->data->dev_private; + + if ((sa->rss_channels == 1) || + (sa->rss_support != EFX_RX_SCALE_EXCLUSIVE)) + return -ENOTSUP; + + sfc_adapter_lock(sa); + + /* +* Mapping of hash configuration between RTE and EFX is not one-to-one, +* hence, conversion is done here to derive a correct set of ETH_RSS +* flags which corresponds to the active EFX configuration stored +* locally in 'sfc_adapter' and kept up-to-date +*/ + rss_conf->rss_hf = sfc_efx_to_rte_hash_type(sa->rss_hash_types); + rss_conf->rss_key_len = SFC_RSS_KEY_SIZE; + if (rss_conf->rss_key != NULL) + rte_memcpy(rss_conf->rss_key, sa->rss_key, SFC_RSS_KEY_SIZE); + + sfc_adapter_unlock(sa); + + return 0; +} +#endif + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -1028,6 +1058,9 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .flow_ctrl_get = sfc_flow_ctrl_get, .flow_ctrl_set = sfc_flow_ctrl_set, .mac_addr_set = sfc_mac_addr_set, +#if EFSYS_OPT_RX_SCALE + .rss_hash_conf_get = sfc_dev_rss_hash_conf_get, +#endif .set_mc_addr_list = sfc_set_mc_addr_list, .rxq_info_get = sfc_rx_queue_info_get, .txq_info_get = sfc_tx_queue_info_get, diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 1e254a8..ca26b1e 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -785,6 +785,28 @@ sfc_rte_to_efx_hash_type(uint64_t rss_hf) return efx_hash_types; } + +uint64_t +sfc_efx_to_rte_hash_type(unsigned int efx_hash_types) +{ + uint64_t rss_hf = 0; + + if ((efx_hash_types & (1 << EFX_RX_HASH_IPV4)) != 0) + rss_hf |= (ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | + ETH_RSS_NONFRAG_IPV4_OTHER); + + if ((efx_hash_types & (1 << EFX_RX_HASH_TCPIPV4)) != 0) + rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP; + + if ((efx_hash_types & (1 << EFX_RX_HASH_IPV6)) != 0) + rss_hf |= (ETH_RSS_IPV6 | ETH_RSS_FRAG_IPV6 | + ETH_RSS_NONFRAG_IPV6_OTHER | ETH_RSS_IPV6_EX); + + if ((efx_hash_types & (1 << EFX_RX_HASH_TCPIPV6)) != 0) + rss_hf |= (ETH_RSS_NONFRAG_IPV6_TCP | ETH_RSS_IPV6_TCP_EX); + + return rss_hf; +} #endif static int diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 2b8b9eb..aa7264c 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -152,6 +152,7 @@ int sfc_rx_qdesc_done(struct sfc_rxq *rxq, unsigned int offset); #if EFSYS_OPT_RX_SCALE unsigned int sfc_rte_to_efx_hash_type(uint64_t rss_hf); +uint64_t sfc_efx_to_rte_hash_type(unsigned int efx_hash_types); #endif #ifdef __cplusplus -- 2.5.5
[dpdk-dev] [PATCH 17/31] net/sfc: add callback to get RxQ pending descriptors count
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 11 +++ drivers/net/sfc/sfc_rx.c | 16 drivers/net/sfc/sfc_rx.h | 3 +++ 3 files changed, 30 insertions(+) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 1d7993f..163f9ed 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -845,6 +845,16 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, sfc_adapter_unlock(sa); } +static uint32_t +sfc_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) +{ + struct sfc_adapter *sa = dev->data->dev_private; + + sfc_log_init(sa, "RxQ=%u", rx_queue_id); + + return sfc_rx_qdesc_npending(sa, rx_queue_id); +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -865,6 +875,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .mtu_set= sfc_dev_set_mtu, .rx_queue_setup = sfc_rx_queue_setup, .rx_queue_release = sfc_rx_queue_release, + .rx_queue_count = sfc_rx_queue_count, .tx_queue_setup = sfc_tx_queue_setup, .tx_queue_release = sfc_tx_queue_release, .flow_ctrl_get = sfc_flow_ctrl_get, diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 278d583..ff9d799 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -257,6 +257,22 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) return done_pkts; } +unsigned int +sfc_rx_qdesc_npending(struct sfc_adapter *sa, unsigned int sw_index) +{ + struct sfc_rxq *rxq; + + SFC_ASSERT(sw_index < sa->rxq_count); + rxq = sa->rxq_info[sw_index].rxq; + + if (rxq == NULL || (rxq->state & SFC_RXQ_RUNNING) == 0) + return 0; + + sfc_ev_qpoll(rxq->evq); + + return rxq->pending - rxq->completed; +} + static void sfc_rx_qpurge(struct sfc_rxq *rxq) { diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 69318ab..8064af6 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -140,6 +140,9 @@ void sfc_rx_qflush_failed(struct sfc_rxq *rxq); uint16_t sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); +unsigned int sfc_rx_qdesc_npending(struct sfc_adapter *sa, + unsigned int sw_index); + #ifdef __cplusplus } #endif -- 2.5.5
[dpdk-dev] [PATCH 16/31] net/sfc: support Rx free threshold
Rx free threshold defines minimum number of free Rx descriptors when Rx ring refill should be done. Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/sfc/sfc_rx.c | 16 drivers/net/sfc/sfc_rx.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index e67ca61..1d7993f 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -838,6 +838,7 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, SFC_ASSERT(rxq != NULL); qinfo->mp = rxq->refill_mb_pool; + qinfo->conf.rx_free_thresh = rxq->refill_threshold; qinfo->conf.rx_drop_en = 1; qinfo->nb_desc = rxq_info->entries; diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index be8fa23..278d583 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -87,6 +87,10 @@ sfc_rx_qrefill(struct sfc_rxq *rxq) free_space = EFX_RXQ_LIMIT(rxq->ptr_mask + 1) - (added - rxq->completed); + + if (free_space < rxq->refill_threshold) + return; + bulks = free_space / RTE_DIM(objs); id = added & rxq->ptr_mask; @@ -410,9 +414,10 @@ sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index) } static int -sfc_rx_qcheck_conf(struct sfc_adapter *sa, +sfc_rx_qcheck_conf(struct sfc_adapter *sa, uint16_t nb_rx_desc, const struct rte_eth_rxconf *rx_conf) { + const uint16_t rx_free_thresh_max = EFX_RXQ_LIMIT(nb_rx_desc); int rc = 0; if (rx_conf->rx_thresh.pthresh != 0 || @@ -423,8 +428,10 @@ sfc_rx_qcheck_conf(struct sfc_adapter *sa, rc = EINVAL; } - if (rx_conf->rx_free_thresh != 0) { - sfc_err(sa, "RxQ free threshold is not supported"); + if (rx_conf->rx_free_thresh > rx_free_thresh_max) { + sfc_err(sa, + "RxQ free threshold too large: %u vs maximum %u", + rx_conf->rx_free_thresh, rx_free_thresh_max); rc = EINVAL; } @@ -555,7 +562,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, struct sfc_evq *evq; struct sfc_rxq *rxq; - rc = sfc_rx_qcheck_conf(sa, rx_conf); + rc = sfc_rx_qcheck_conf(sa, nb_rx_desc, rx_conf); if (rc != 0) goto fail_bad_conf; @@ -615,6 +622,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, evq->rxq = rxq; rxq->evq = evq; rxq->ptr_mask = rxq_info->entries - 1; + rxq->refill_threshold = rx_conf->rx_free_thresh; rxq->refill_mb_pool = mb_pool; rxq->buf_size = buf_size; rxq->hw_index = sw_index; diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index e4385b9..69318ab 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -87,6 +87,7 @@ struct sfc_rxq { /* Used on refill */ unsigned intadded; unsigned intpushed; + unsigned intrefill_threshold; uint8_t port_id; uint16_tbuf_size; struct rte_mempool *refill_mb_pool; -- 2.5.5
[dpdk-dev] [PATCH 20/31] net/sfc: support deferred start of receive queues
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + doc/guides/nics/sfc_efx.rst | 2 ++ drivers/net/sfc/sfc_ethdev.c | 51 drivers/net/sfc/sfc_rx.c | 18 +++-- drivers/net/sfc/sfc_rx.h | 2 ++ 5 files changed, 66 insertions(+), 8 deletions(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 74cc942..4a887f0 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -7,6 +7,7 @@ Speed capabilities = Y Link status = Y Link status event= Y +Queue start/stop = P MTU update = Y Jumbo frame = Y Scattered Rx = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index a0f25d3..3d705bc 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -68,6 +68,8 @@ SFC EFX PMD has support for: - Scattered Rx DMA for packet that are larger that a single Rx descriptor +- Deferred receive queue start + Non-supported Features -- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index f1b655b..c531fdb 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -840,6 +840,7 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, qinfo->mp = rxq->refill_mb_pool; qinfo->conf.rx_free_thresh = rxq->refill_threshold; qinfo->conf.rx_drop_en = 1; + qinfo->conf.rx_deferred_start = rxq_info->deferred_start; qinfo->scattered_rx = (rxq_info->type == EFX_RXQ_TYPE_SCATTER); qinfo->nb_desc = rxq_info->entries; @@ -864,6 +865,54 @@ sfc_rx_descriptor_done(void *queue, uint16_t offset) return sfc_rx_qdesc_done(rxq, offset); } +static int +sfc_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) +{ + struct sfc_adapter *sa = dev->data->dev_private; + int rc; + + sfc_log_init(sa, "RxQ=%u", rx_queue_id); + + sfc_adapter_lock(sa); + + rc = EINVAL; + if (sa->state != SFC_ADAPTER_STARTED) + goto fail_not_started; + + rc = sfc_rx_qstart(sa, rx_queue_id); + if (rc != 0) + goto fail_rx_qstart; + + sa->rxq_info[rx_queue_id].deferred_started = B_TRUE; + + sfc_adapter_unlock(sa); + + return 0; + +fail_rx_qstart: +fail_not_started: + sfc_adapter_unlock(sa); + SFC_ASSERT(rc > 0); + return -rc; +} + +static int +sfc_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) +{ + struct sfc_adapter *sa = dev->data->dev_private; + + sfc_log_init(sa, "RxQ=%u", rx_queue_id); + + sfc_adapter_lock(sa); + sfc_rx_qstop(sa, rx_queue_id); + + sa->rxq_info[rx_queue_id].deferred_started = B_FALSE; + + sfc_adapter_unlock(sa); + + return 0; +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -882,6 +931,8 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_infos_get = sfc_dev_infos_get, .dev_supported_ptypes_get = sfc_dev_supported_ptypes_get, .mtu_set= sfc_dev_set_mtu, + .rx_queue_start = sfc_rx_queue_start, + .rx_queue_stop = sfc_rx_queue_stop, .rx_queue_setup = sfc_rx_queue_setup, .rx_queue_release = sfc_rx_queue_release, .rx_queue_count = sfc_rx_queue_count, diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 2909ec0..3bfce1c 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -444,6 +444,9 @@ sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index) rxq_info = >rxq_info[sw_index]; rxq = rxq_info->rxq; + + if (rxq->state == SFC_RXQ_INITIALIZED) + return; SFC_ASSERT(rxq->state & SFC_RXQ_STARTED); /* It seems to be used by DPDK for debug purposes only ('rte_ether') */ @@ -491,11 +494,6 @@ sfc_rx_qcheck_conf(struct sfc_adapter *sa, uint16_t nb_rx_desc, rc = EINVAL; } - if (rx_conf->rx_deferred_start != 0) { - sfc_err(sa, "RxQ deferred start is not supported"); - rc = EINVAL; - } - return rc; } @@ -688,6 +686,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, rxq->state = SFC_RXQ_INITIALIZED; rxq_info->rxq = rxq; + rxq_info->deferred_start = (rx_conf->rx_deferred_start != 0); return 0; @@ -742,9 +741,12 @@ sfc_rx_start(struct sfc_adapter *sa) goto fail_rx_init; for (sw_index = 0;
[dpdk-dev] [PATCH 19/31] net/sfc: support scattered Rx DMA
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + doc/guides/nics/sfc_efx.rst | 4 ++-- drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/sfc/sfc_rx.c | 39 +++- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index b5887d5..74cc942 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -9,6 +9,7 @@ Link status = Y Link status event= Y MTU update = Y Jumbo frame = Y +Scattered Rx = Y Promiscuous mode = Y Allmulticast mode= Y Multicast MAC filter = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 57e8318..a0f25d3 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -66,6 +66,8 @@ SFC EFX PMD has support for: - Received packet type information +- Scattered Rx DMA for packet that are larger that a single Rx descriptor + Non-supported Features -- @@ -86,8 +88,6 @@ The features not yet supported include: - VLAN stripping -- Scattered receive - - LRO diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 59dcdb4..f1b655b 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -840,6 +840,7 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, qinfo->mp = rxq->refill_mb_pool; qinfo->conf.rx_free_thresh = rxq->refill_threshold; qinfo->conf.rx_drop_en = 1; + qinfo->scattered_rx = (rxq_info->type == EFX_RXQ_TYPE_SCATTER); qinfo->nb_desc = rxq_info->entries; sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 802beb2..2909ec0 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -193,6 +193,7 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) unsigned int prefix_size = rxq->prefix_size; unsigned int done_pkts = 0; boolean_t discard_next = B_FALSE; + struct rte_mbuf *scatter_pkt = NULL; if (unlikely((rxq->state & SFC_RXQ_RUNNING) == 0)) return 0; @@ -218,9 +219,6 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (desc_flags & (EFX_ADDR_MISMATCH | EFX_DISCARD)) goto discard; - if (desc_flags & EFX_PKT_CONT) - goto discard; - if (desc_flags & EFX_PKT_PREFIX_LEN) { uint16_t tmp_size; int rc __rte_unused; @@ -237,6 +235,29 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rte_pktmbuf_data_len(m) = seg_len; rte_pktmbuf_pkt_len(m) = seg_len; + if (scatter_pkt != NULL) { + if (rte_pktmbuf_chain(scatter_pkt, m) != 0) { + rte_mempool_put(rxq->refill_mb_pool, + scatter_pkt); + goto discard; + } + /* The packet to deliver */ + m = scatter_pkt; + } + + if (desc_flags & EFX_PKT_CONT) { + /* The packet is scattered, more fragments to come */ + scatter_pkt = m; + /* Futher fragments have no prefix */ + prefix_size = 0; + continue; + } + + /* Scattered packet is done */ + scatter_pkt = NULL; + /* The first fragment of the packet has prefix */ + prefix_size = rxq->prefix_size; + m->ol_flags = sfc_rx_desc_flags_to_offload_flags(desc_flags); m->packet_type = sfc_rx_desc_flags_to_packet_type(desc_flags); @@ -250,6 +271,9 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxd->mbuf = NULL; } + /* pending is only moved when entire packet is received */ + SFC_ASSERT(scatter_pkt == NULL); + rxq->completed = completed; sfc_rx_qrefill(rxq); @@ -618,7 +642,9 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, SFC_ASSERT(nb_rx_desc <= rxq_info->max_entries); rxq_info->entries = nb_rx_desc; - rxq_info->type = EFX_RXQ_TYPE_DEFAULT; + rxq_info->type = + sa->eth_dev->data->dev_conf.rxmode.enable_scatter ? + EFX_RXQ_TYPE_SCATTER : EFX_RXQ_TYPE_DEFAULT; evq_index = sfc_evq_index_by_rxq_sw_index(sa, sw_index); @@ -806,11 +832,6 @@ sfc_rx_check_mode(struct
[dpdk-dev] [PATCH 14/31] net/sfc: handle received packet type info provided by HW
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + doc/guides/nics/sfc_efx.rst | 2 ++ drivers/net/sfc/sfc_ethdev.c | 19 +++ drivers/net/sfc/sfc_rx.c | 14 +- 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index ec1d1db..b5887d5 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -15,6 +15,7 @@ Multicast MAC filter = Y Flow control = Y L3 checksum offload = Y L4 checksum offload = Y +Packet type parsing = Y Basic stats = Y Extended stats = Y BSD nic_uio = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 452a9ff..57e8318 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -64,6 +64,8 @@ SFC EFX PMD has support for: - IPv4/IPv6 TCP/UDP receive checksum offload +- Received packet type information + Non-supported Features -- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 235582d..03c9a01 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -97,6 +97,24 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_desc_lim.nb_align = EFX_TXQ_MINNDESCS; } +static const uint32_t * +sfc_dev_supported_ptypes_get(struct rte_eth_dev *dev) +{ + static const uint32_t ptypes[] = { + RTE_PTYPE_L2_ETHER, + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN, + RTE_PTYPE_L3_IPV6_EXT_UNKNOWN, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN + }; + + if (dev->rx_pkt_burst == sfc_recv_pkts) + return ptypes; + + return NULL; +} + static int sfc_dev_configure(struct rte_eth_dev *dev) { @@ -819,6 +837,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .xstats_get = sfc_xstats_get, .xstats_get_names = sfc_xstats_get_names, .dev_infos_get = sfc_dev_infos_get, + .dev_supported_ptypes_get = sfc_dev_supported_ptypes_get, .mtu_set= sfc_dev_set_mtu, .rx_queue_setup = sfc_rx_queue_setup, .rx_queue_release = sfc_rx_queue_release, diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 4df4132..be8fa23 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -169,6 +169,18 @@ sfc_rx_desc_flags_to_offload_flags(const unsigned int desc_flags) return mbuf_flags; } +static uint32_t +sfc_rx_desc_flags_to_packet_type(const unsigned int desc_flags) +{ + return RTE_PTYPE_L2_ETHER | + ((desc_flags & EFX_PKT_IPV4) ? + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN : 0) | + ((desc_flags & EFX_PKT_IPV6) ? + RTE_PTYPE_L3_IPV6_EXT_UNKNOWN : 0) | + ((desc_flags & EFX_PKT_TCP) ? RTE_PTYPE_L4_TCP : 0) | + ((desc_flags & EFX_PKT_UDP) ? RTE_PTYPE_L4_UDP : 0); +} + uint16_t sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { @@ -222,7 +234,7 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rte_pktmbuf_pkt_len(m) = seg_len; m->ol_flags = sfc_rx_desc_flags_to_offload_flags(desc_flags); - m->packet_type = RTE_PTYPE_L2_ETHER; + m->packet_type = sfc_rx_desc_flags_to_packet_type(desc_flags); *rx_pkts++ = m; done_pkts++; -- 2.5.5
[dpdk-dev] [PATCH 18/31] net/sfc: add RxQ descriptor done callback
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 9 + drivers/net/sfc/sfc_rx.c | 11 +++ drivers/net/sfc/sfc_rx.h | 1 + 3 files changed, 21 insertions(+) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 163f9ed..59dcdb4 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -855,6 +855,14 @@ sfc_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) return sfc_rx_qdesc_npending(sa, rx_queue_id); } +static int +sfc_rx_descriptor_done(void *queue, uint16_t offset) +{ + struct sfc_rxq *rxq = queue; + + return sfc_rx_qdesc_done(rxq, offset); +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -876,6 +884,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .rx_queue_setup = sfc_rx_queue_setup, .rx_queue_release = sfc_rx_queue_release, .rx_queue_count = sfc_rx_queue_count, + .rx_descriptor_done = sfc_rx_descriptor_done, .tx_queue_setup = sfc_tx_queue_setup, .tx_queue_release = sfc_tx_queue_release, .flow_ctrl_get = sfc_flow_ctrl_get, diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index ff9d799..802beb2 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -273,6 +273,17 @@ sfc_rx_qdesc_npending(struct sfc_adapter *sa, unsigned int sw_index) return rxq->pending - rxq->completed; } +int +sfc_rx_qdesc_done(struct sfc_rxq *rxq, unsigned int offset) +{ + if ((rxq->state & SFC_RXQ_RUNNING) == 0) + return 0; + + sfc_ev_qpoll(rxq->evq); + + return offset < (rxq->pending - rxq->completed); +} + static void sfc_rx_qpurge(struct sfc_rxq *rxq) { diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 8064af6..8d8e709 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -142,6 +142,7 @@ uint16_t sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, unsigned int sfc_rx_qdesc_npending(struct sfc_adapter *sa, unsigned int sw_index); +int sfc_rx_qdesc_done(struct sfc_rxq *rxq, unsigned int offset); #ifdef __cplusplus } -- 2.5.5
[dpdk-dev] [PATCH 12/31] net/sfc: support multicast addresses list controls
From: Ivan MalovReviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + doc/guides/nics/sfc_efx.rst | 2 ++ drivers/net/sfc/sfc_ethdev.c | 40 3 files changed, 43 insertions(+) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index aaea993..35633cb 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -11,6 +11,7 @@ MTU update = Y Jumbo frame = Y Promiscuous mode = Y Allmulticast mode= Y +Multicast MAC filter = Y Flow control = Y L3 checksum offload = P L4 checksum offload = P diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 360ed98..529928d 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -60,6 +60,8 @@ SFC EFX PMD has support for: - Allmulticast mode +- Multicast MAC filter + Non-supported Features -- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 79e2761..268b76a 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -759,6 +759,45 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) } +static int +sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +uint32_t nb_mc_addr) +{ + struct sfc_adapter *sa = dev->data->dev_private; + uint8_t *mc_addrs_p; + uint8_t *mc_addrs; + int rc; + unsigned int i; + + if (nb_mc_addr > EFX_MAC_MULTICAST_LIST_MAX) { + sfc_err(sa, "too many multicast addresses: %u > %u", +nb_mc_addr, EFX_MAC_MULTICAST_LIST_MAX); + return -EINVAL; + } + + mc_addrs_p = rte_calloc("mc-addrs", nb_mc_addr, EFX_MAC_ADDR_LEN, 0); + if (mc_addrs_p == NULL) + return -ENOMEM; + + mc_addrs = mc_addrs_p; + + for (i = 0; i < nb_mc_addr; ++i) { + (void)rte_memcpy(mc_addrs, mc_addr_set[i].addr_bytes, +EFX_MAC_ADDR_LEN); + mc_addrs += EFX_MAC_ADDR_LEN; + } + + rc = efx_mac_multicast_list_set(sa->nic, mc_addrs_p, nb_mc_addr); + + rte_free(mc_addrs_p); + + if (rc != 0) + sfc_err(sa, "cannot set multicast address list (rc = %u)", rc); + + SFC_ASSERT(rc > 0); + return -rc; +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -783,6 +822,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .flow_ctrl_get = sfc_flow_ctrl_get, .flow_ctrl_set = sfc_flow_ctrl_set, .mac_addr_set = sfc_mac_addr_set, + .set_mc_addr_list = sfc_set_mc_addr_list, }; static int -- 2.5.5
[dpdk-dev] [PATCH 11/31] net/sfc: support main (the first) MAC address change
From: Ivan MalovReviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 53 1 file changed, 53 insertions(+) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index c6095ad..79e2761 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -706,6 +706,58 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) SFC_ASSERT(rc > 0); return -rc; } +static void +sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +{ + struct sfc_adapter *sa = dev->data->dev_private; + const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); + int rc; + + sfc_adapter_lock(sa); + + if (sa->state != SFC_ADAPTER_STARTED) { + sfc_info(sa, "the port is not started"); + sfc_info(sa, "the new MAC address will be set on port start"); + + goto unlock; + } + + if (encp->enc_allow_set_mac_with_installed_filters) { + rc = efx_mac_addr_set(sa->nic, mac_addr->addr_bytes); + if (rc != 0) { + sfc_err(sa, "cannot set MAC address (rc = %u)", rc); + goto unlock; + } + + /* +* Changing the MAC address by means of MCDI request +* has no effect on received traffic, therefore +* we also need to update unicast filters +*/ + rc = sfc_set_rx_mode(sa); + if (rc != 0) + sfc_err(sa, "cannot set filter (rc = %u)", rc); + } else { + sfc_warn(sa, "cannot set MAC address with filters installed"); + sfc_warn(sa, "adapter will be restarted to pick the new MAC"); + sfc_warn(sa, "(some traffic may be dropped)"); + + /* +* Since setting MAC address with filters installed is not +* allowed on the adapter, one needs to simply restart adapter +* so that the new MAC address will be taken from an outer +* storage and set flawlessly by means of sfc_start() call +*/ + sfc_stop(sa); + rc = sfc_start(sa); + if (rc != 0) + sfc_err(sa, "cannot restart adapter (rc = %u)", rc); + } + +unlock: + sfc_adapter_unlock(sa); +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, @@ -730,6 +782,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .tx_queue_release = sfc_tx_queue_release, .flow_ctrl_get = sfc_flow_ctrl_get, .flow_ctrl_set = sfc_flow_ctrl_set, + .mac_addr_set = sfc_mac_addr_set, }; static int -- 2.5.5
[dpdk-dev] [PATCH 09/31] net/sfc: support link up/down
From: Artem AndreevReviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Artem Andreev Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 32 1 file changed, 32 insertions(+) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 42c488e..1716d78 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -195,6 +195,36 @@ sfc_dev_stop(struct rte_eth_dev *dev) sfc_log_init(sa, "done"); } +static int +sfc_dev_set_link_up(struct rte_eth_dev *dev) +{ + struct sfc_adapter *sa = dev->data->dev_private; + int rc; + + sfc_log_init(sa, "entry"); + + sfc_adapter_lock(sa); + rc = sfc_start(sa); + sfc_adapter_unlock(sa); + + SFC_ASSERT(rc >= 0); + return -rc; +} + +static int +sfc_dev_set_link_down(struct rte_eth_dev *dev) +{ + struct sfc_adapter *sa = dev->data->dev_private; + + sfc_log_init(sa, "entry"); + + sfc_adapter_lock(sa); + sfc_stop(sa); + sfc_adapter_unlock(sa); + + return 0; +} + static void sfc_dev_close(struct rte_eth_dev *dev) { @@ -628,6 +658,8 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, .dev_stop = sfc_dev_stop, + .dev_set_link_up= sfc_dev_set_link_up, + .dev_set_link_down = sfc_dev_set_link_down, .dev_close = sfc_dev_close, .link_update= sfc_dev_link_update, .stats_get = sfc_stats_get, -- 2.5.5
[dpdk-dev] [PATCH 15/31] net/sfc: support callback to get receive queue information
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ethdev.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 03c9a01..e67ca61 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -821,6 +821,29 @@ sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, return -rc; } +static void +sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, + struct rte_eth_rxq_info *qinfo) +{ + struct sfc_adapter *sa = dev->data->dev_private; + struct sfc_rxq_info *rxq_info; + struct sfc_rxq *rxq; + + sfc_adapter_lock(sa); + + SFC_ASSERT(rx_queue_id < sa->rxq_count); + + rxq_info = >rxq_info[rx_queue_id]; + rxq = rxq_info->rxq; + SFC_ASSERT(rxq != NULL); + + qinfo->mp = rxq->refill_mb_pool; + qinfo->conf.rx_drop_en = 1; + qinfo->nb_desc = rxq_info->entries; + + sfc_adapter_unlock(sa); +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -847,6 +870,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .flow_ctrl_set = sfc_flow_ctrl_set, .mac_addr_set = sfc_mac_addr_set, .set_mc_addr_list = sfc_set_mc_addr_list, + .rxq_info_get = sfc_rx_queue_info_get, }; static int -- 2.5.5
[dpdk-dev] [PATCH 13/31] net/sfc: support checksum offloads on receive
IPv4 header and TCP/UDP checksums for both IPv4 and IPv6 are supported. Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 4 ++-- doc/guides/nics/sfc_efx.rst | 2 ++ drivers/net/sfc/sfc_ethdev.c | 5 + drivers/net/sfc/sfc_rx.c | 40 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 35633cb..ec1d1db 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -13,8 +13,8 @@ Promiscuous mode = Y Allmulticast mode= Y Multicast MAC filter = Y Flow control = Y -L3 checksum offload = P -L4 checksum offload = P +L3 checksum offload = Y +L4 checksum offload = Y Basic stats = Y Extended stats = Y BSD nic_uio = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 529928d..452a9ff 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -62,6 +62,8 @@ SFC EFX PMD has support for: - Multicast MAC filter +- IPv4/IPv6 TCP/UDP receive checksum offload + Non-supported Features -- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 268b76a..235582d 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -68,6 +68,11 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) /* By default packets are dropped if no descriptors are available */ dev_info->default_rxconf.rx_drop_en = 1; + dev_info->rx_offload_capa = + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM | diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index bd41131..4df4132 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -130,6 +130,45 @@ sfc_rx_qrefill(struct sfc_rxq *rxq) } } +static uint64_t +sfc_rx_desc_flags_to_offload_flags(const unsigned int desc_flags) +{ + uint64_t mbuf_flags = 0; + + switch (desc_flags & (EFX_PKT_IPV4 | EFX_CKSUM_IPV4)) { + case (EFX_PKT_IPV4 | EFX_CKSUM_IPV4): + mbuf_flags |= PKT_RX_IP_CKSUM_GOOD; + break; + case EFX_PKT_IPV4: + mbuf_flags |= PKT_RX_IP_CKSUM_BAD; + break; + default: + RTE_BUILD_BUG_ON(PKT_RX_IP_CKSUM_UNKNOWN != 0); + SFC_ASSERT((mbuf_flags & PKT_RX_IP_CKSUM_MASK) == + PKT_RX_IP_CKSUM_UNKNOWN); + break; + } + + switch ((desc_flags & +(EFX_PKT_TCP | EFX_PKT_UDP | EFX_CKSUM_TCPUDP))) { + case (EFX_PKT_TCP | EFX_CKSUM_TCPUDP): + case (EFX_PKT_UDP | EFX_CKSUM_TCPUDP): + mbuf_flags |= PKT_RX_L4_CKSUM_GOOD; + break; + case EFX_PKT_TCP: + case EFX_PKT_UDP: + mbuf_flags |= PKT_RX_L4_CKSUM_BAD; + break; + default: + RTE_BUILD_BUG_ON(PKT_RX_L4_CKSUM_UNKNOWN != 0); + SFC_ASSERT((mbuf_flags & PKT_RX_L4_CKSUM_MASK) == + PKT_RX_L4_CKSUM_UNKNOWN); + break; + } + + return mbuf_flags; +} + uint16_t sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { @@ -182,6 +221,7 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rte_pktmbuf_data_len(m) = seg_len; rte_pktmbuf_pkt_len(m) = seg_len; + m->ol_flags = sfc_rx_desc_flags_to_offload_flags(desc_flags); m->packet_type = RTE_PTYPE_L2_ETHER; *rx_pkts++ = m; -- 2.5.5
[dpdk-dev] [PATCH 10/31] net/sfc: support promiscuous and all-multicast control
From: Ivan MalovReviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 2 ++ doc/guides/nics/sfc_efx.rst | 4 +++ drivers/net/sfc/sfc.h| 11 +++ drivers/net/sfc/sfc_ethdev.c | 57 drivers/net/sfc/sfc_port.c | 18 +++- 5 files changed, 91 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 60ecca0..aaea993 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -9,6 +9,8 @@ Link status = Y Link status event= Y MTU update = Y Jumbo frame = Y +Promiscuous mode = Y +Allmulticast mode= Y Flow control = Y L3 checksum offload = P L4 checksum offload = P diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index adab9fd..360ed98 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -56,6 +56,10 @@ SFC EFX PMD has support for: - Jumbo frames up to 9K +- Promiscuous mode + +- Allmulticast mode + Non-supported Features -- diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 5883547..f0bbaf8 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -93,6 +93,13 @@ enum sfc_adapter_state { SFC_ADAPTER_NSTATES }; +enum sfc_dev_filter_mode { + SFC_DEV_FILTER_MODE_PROMISC = 0, + SFC_DEV_FILTER_MODE_ALLMULTI, + + SFC_DEV_FILTER_NMODES +}; + enum sfc_mcdi_state { SFC_MCDI_UNINITIALIZED = 0, SFC_MCDI_INITIALIZED, @@ -130,6 +137,9 @@ struct sfc_port { boolean_t flow_ctrl_autoneg; size_t pdu; + boolean_t promisc; + boolean_t allmulti; + rte_spinlock_t mac_stats_lock; uint64_t*mac_stats_buf; efsys_mem_t mac_stats_dma_mem; @@ -243,6 +253,7 @@ void sfc_port_stop(struct sfc_adapter *sa); void sfc_port_link_mode_to_info(efx_link_mode_t link_mode, struct rte_eth_link *link_info); int sfc_port_update_mac_stats(struct sfc_adapter *sa); +int sfc_set_rx_mode(struct sfc_adapter *sa); #ifdef __cplusplus diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 1716d78..c6095ad 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -253,6 +253,59 @@ sfc_dev_close(struct rte_eth_dev *dev) sfc_log_init(sa, "done"); } +static void +sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode, + boolean_t enabled) +{ + struct sfc_port *port; + boolean_t *toggle; + struct sfc_adapter *sa = dev->data->dev_private; + boolean_t allmulti = (mode == SFC_DEV_FILTER_MODE_ALLMULTI); + const char *desc = (allmulti) ? "all-multi" : "promiscuous"; + + sfc_adapter_lock(sa); + + port = >port; + toggle = (allmulti) ? (>allmulti) : (>promisc); + + if (*toggle != enabled) { + *toggle = enabled; + + if ((sa->state == SFC_ADAPTER_STARTED) && + (sfc_set_rx_mode(sa) != 0)) { + *toggle = !(enabled); + sfc_warn(sa, "Failed to %s %s mode", +((enabled) ? "enable" : "disable"), desc); + } + } + + sfc_adapter_unlock(sa); +} + +static void +sfc_dev_promisc_enable(struct rte_eth_dev *dev) +{ + sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_TRUE); +} + +static void +sfc_dev_promisc_disable(struct rte_eth_dev *dev) +{ + sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_FALSE); +} + +static void +sfc_dev_allmulti_enable(struct rte_eth_dev *dev) +{ + sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_ALLMULTI, B_TRUE); +} + +static void +sfc_dev_allmulti_disable(struct rte_eth_dev *dev) +{ + sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_ALLMULTI, B_FALSE); +} + static int sfc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, @@ -661,6 +714,10 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_set_link_up= sfc_dev_set_link_up, .dev_set_link_down = sfc_dev_set_link_down, .dev_close = sfc_dev_close, + .promiscuous_enable = sfc_dev_promisc_enable, + .promiscuous_disable= sfc_dev_promisc_disable, + .allmulticast_enable= sfc_dev_allmulti_enable, + .allmulticast_disable =
[dpdk-dev] [PATCH 03/31] net/sfc: implement ethdev hook to get basic statistics
Does not implement any deprecated statistics. No per-queue statistics yet. Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + doc/guides/nics/sfc_efx.rst | 2 + drivers/net/sfc/efsys.h | 2 +- drivers/net/sfc/sfc.h| 7 drivers/net/sfc/sfc_ethdev.c | 69 + drivers/net/sfc/sfc_port.c | 75 6 files changed, 155 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 67df1c6..f55a988 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -7,6 +7,7 @@ Link status = Y L3 checksum offload = P L4 checksum offload = P +Basic stats = Y BSD nic_uio = Y Linux UIO= Y Linux VFIO = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 36d0974..cbb51de 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -48,6 +48,8 @@ SFC EFX PMD has support for: - IPv4/IPv6 TCP/UDP transmit checksum offload +- Port hardware statistics + Non-supported Features -- diff --git a/drivers/net/sfc/efsys.h b/drivers/net/sfc/efsys.h index d48eb4c..fe8615f 100644 --- a/drivers/net/sfc/efsys.h +++ b/drivers/net/sfc/efsys.h @@ -178,7 +178,7 @@ prefetch_read_once(const volatile void *addr) #define EFSYS_OPT_MCDI_LOGGING 1 #define EFSYS_OPT_MCDI_PROXY_AUTH 0 -#define EFSYS_OPT_MAC_STATS 0 +#define EFSYS_OPT_MAC_STATS 1 #define EFSYS_OPT_LOOPBACK 0 diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index d0aafa3..1189283 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -122,6 +122,12 @@ struct sfc_port { unsigned intflow_ctrl; boolean_t flow_ctrl_autoneg; size_t pdu; + + rte_spinlock_t mac_stats_lock; + uint64_t*mac_stats_buf; + efsys_mem_t mac_stats_dma_mem; + + uint32_tmac_stats_mask[EFX_MAC_STATS_MASK_NPAGES]; }; /* Adapter private data */ @@ -229,6 +235,7 @@ int sfc_port_start(struct sfc_adapter *sa); void sfc_port_stop(struct sfc_adapter *sa); void sfc_port_link_mode_to_info(efx_link_mode_t link_mode, struct rte_eth_link *link_info); +int sfc_port_update_mac_stats(struct sfc_adapter *sa); #ifdef __cplusplus diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 1df227e..f31330c 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -324,12 +324,81 @@ sfc_tx_queue_release(void *queue) sfc_adapter_unlock(sa); } +static void +sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + struct sfc_adapter *sa = dev->data->dev_private; + struct sfc_port *port = >port; + uint64_t *mac_stats; + + rte_spinlock_lock(>mac_stats_lock); + + if (sfc_port_update_mac_stats(sa) != 0) + goto unlock; + + mac_stats = port->mac_stats_buf; + + if (EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, + EFX_MAC_VADAPTER_RX_UNICAST_PACKETS)) { + stats->ipackets = + mac_stats[EFX_MAC_VADAPTER_RX_UNICAST_PACKETS] + + mac_stats[EFX_MAC_VADAPTER_RX_MULTICAST_PACKETS] + + mac_stats[EFX_MAC_VADAPTER_RX_BROADCAST_PACKETS]; + stats->opackets = + mac_stats[EFX_MAC_VADAPTER_TX_UNICAST_PACKETS] + + mac_stats[EFX_MAC_VADAPTER_TX_MULTICAST_PACKETS] + + mac_stats[EFX_MAC_VADAPTER_TX_BROADCAST_PACKETS]; + stats->ibytes = + mac_stats[EFX_MAC_VADAPTER_RX_UNICAST_BYTES] + + mac_stats[EFX_MAC_VADAPTER_RX_MULTICAST_BYTES] + + mac_stats[EFX_MAC_VADAPTER_RX_BROADCAST_BYTES]; + stats->obytes = + mac_stats[EFX_MAC_VADAPTER_TX_UNICAST_BYTES] + + mac_stats[EFX_MAC_VADAPTER_TX_MULTICAST_BYTES] + + mac_stats[EFX_MAC_VADAPTER_TX_BROADCAST_BYTES]; + stats->imissed = mac_stats[EFX_MAC_VADAPTER_RX_OVERFLOW]; + stats->ierrors = mac_stats[EFX_MAC_VADAPTER_RX_BAD_PACKETS]; + stats->oerrors = mac_stats[EFX_MAC_VADAPTER_TX_BAD_PACKETS]; + } else { + stats->ipackets = mac_stats[EFX_MAC_RX_PKTS]; + stats->opackets = mac_stats[EFX_MAC_TX_PKTS]; + stats->ibytes = mac_stats[EFX_MAC_RX_OCTETS]; + stats->obytes = mac_stats[EFX_MAC_TX_OCTETS]; +
[dpdk-dev] [PATCH 08/31] net/sfc: support link speed and duplex settings
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + drivers/net/sfc/sfc.c| 38 ++-- drivers/net/sfc/sfc.h| 3 +++ drivers/net/sfc/sfc_ethdev.c | 9 + drivers/net/sfc/sfc_port.c | 6 ++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index a845bfc..60ecca0 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -4,6 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Speed capabilities = Y Link status = Y Link status event= Y MTU update = Y diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 36044a0..e2e6c9e 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -85,6 +85,33 @@ sfc_dma_free(const struct sfc_adapter *sa, efsys_mem_t *esmp) memset(esmp, 0, sizeof(*esmp)); } +static uint32_t +sfc_phy_cap_from_link_speeds(uint32_t speeds) +{ + uint32_t phy_caps = 0; + + if (~speeds & ETH_LINK_SPEED_FIXED) { + phy_caps |= (1 << EFX_PHY_CAP_AN); + /* +* If no speeds are specified in the mask, any supported +* may be negotiated +*/ + if (speeds == ETH_LINK_SPEED_AUTONEG) + phy_caps |= + (1 << EFX_PHY_CAP_1000FDX) | + (1 << EFX_PHY_CAP_1FDX) | + (1 << EFX_PHY_CAP_4FDX); + } + if (speeds & ETH_LINK_SPEED_1G) + phy_caps |= (1 << EFX_PHY_CAP_1000FDX); + if (speeds & ETH_LINK_SPEED_10G) + phy_caps |= (1 << EFX_PHY_CAP_1FDX); + if (speeds & ETH_LINK_SPEED_40G) + phy_caps |= (1 << EFX_PHY_CAP_4FDX); + + return phy_caps; +} + /* * Check requested device level configuration. * Receive and transmit configuration is checked in corresponding @@ -96,8 +123,12 @@ sfc_check_conf(struct sfc_adapter *sa) const struct rte_eth_conf *conf = >eth_dev->data->dev_conf; int rc = 0; - if (conf->link_speeds != ETH_LINK_SPEED_AUTONEG) { - sfc_err(sa, "Manual link speed/duplex choice not supported"); + sa->port.phy_adv_cap = + sfc_phy_cap_from_link_speeds(conf->link_speeds) & + sa->port.phy_adv_cap_mask; + if ((sa->port.phy_adv_cap & ~(1 << EFX_PHY_CAP_AN)) == 0) { + sfc_err(sa, "No link speeds from mask %#x are supported", + conf->link_speeds); rc = EINVAL; } @@ -516,6 +547,9 @@ sfc_attach(struct sfc_adapter *sa) if (rc != 0) goto fail_intr_attach; + efx_phy_adv_cap_get(sa->nic, EFX_PHY_CAP_PERM, + >port.phy_adv_cap_mask); + sfc_log_init(sa, "fini nic"); efx_nic_fini(enp); diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 257622f..5883547 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -123,6 +123,9 @@ struct sfc_txq_info; struct sfc_port { unsigned intlsc_seq; + uint32_tphy_adv_cap_mask; + uint32_tphy_adv_cap; + unsigned intflow_ctrl; boolean_t flow_ctrl_autoneg; size_t pdu; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 6690755..42c488e 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -53,6 +53,15 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX; + /* Autonegotiation may be disabled */ + dev_info->speed_capa = ETH_LINK_SPEED_FIXED; + if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_1000FDX) + dev_info->speed_capa |= ETH_LINK_SPEED_1G; + if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_1FDX) + dev_info->speed_capa |= ETH_LINK_SPEED_10G; + if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_4FDX) + dev_info->speed_capa |= ETH_LINK_SPEED_40G; + dev_info->max_rx_queues = sa->rxq_max; dev_info->max_tx_queues = sa->txq_max; diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index ccc0854..1241af7 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -86,6 +86,11 @@ sfc_port_start(struct sfc_adapter *sa) if (rc != 0) goto fail_mac_fcntl_set; + sfc_log_init(sa, "set phy adv caps to %#x", port->phy_adv_cap); + rc =
[dpdk-dev] [PATCH 05/31] net/sfc: support flow control settings get/set
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 1 + doc/guides/nics/sfc_efx.rst | 2 + drivers/net/sfc/sfc_ethdev.c | 98 drivers/net/sfc/sfc_port.c | 8 +++ 4 files changed, 109 insertions(+) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 698553c..25472f8 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -5,6 +5,7 @@ ; [Features] Link status = Y +Flow control = Y L3 checksum offload = P L4 checksum offload = P Basic stats = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index cbb51de..1cfed6a 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -50,6 +50,8 @@ SFC EFX PMD has support for: - Port hardware statistics +- Basic flow control + Non-supported Features -- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index d5ae1a0..eff648b 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -453,6 +453,102 @@ sfc_xstats_get_names(struct rte_eth_dev *dev, return nstats; } +static int +sfc_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +{ + struct sfc_adapter *sa = dev->data->dev_private; + unsigned int wanted_fc, link_fc; + + memset(fc_conf, 0, sizeof(*fc_conf)); + + sfc_adapter_lock(sa); + + if (sa->state == SFC_ADAPTER_STARTED) + efx_mac_fcntl_get(sa->nic, _fc, _fc); + else + link_fc = sa->port.flow_ctrl; + + switch (link_fc) { + case 0: + fc_conf->mode = RTE_FC_NONE; + break; + case EFX_FCNTL_RESPOND: + fc_conf->mode = RTE_FC_RX_PAUSE; + break; + case EFX_FCNTL_GENERATE: + fc_conf->mode = RTE_FC_TX_PAUSE; + break; + case (EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE): + fc_conf->mode = RTE_FC_FULL; + break; + default: + sfc_err(sa, "%s: unexpected flow control value %#x", + __func__, link_fc); + } + + fc_conf->autoneg = sa->port.flow_ctrl_autoneg; + + sfc_adapter_unlock(sa); + + return 0; +} + +static int +sfc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +{ + struct sfc_adapter *sa = dev->data->dev_private; + struct sfc_port *port = >port; + unsigned int fcntl; + int rc; + + if (fc_conf->high_water != 0 || fc_conf->low_water != 0 || + fc_conf->pause_time != 0 || fc_conf->send_xon != 0 || + fc_conf->mac_ctrl_frame_fwd != 0) { + sfc_err(sa, "unsupported flow control settings specified"); + rc = EINVAL; + goto fail_inval; + } + + switch (fc_conf->mode) { + case RTE_FC_NONE: + fcntl = 0; + break; + case RTE_FC_RX_PAUSE: + fcntl = EFX_FCNTL_RESPOND; + break; + case RTE_FC_TX_PAUSE: + fcntl = EFX_FCNTL_GENERATE; + break; + case RTE_FC_FULL: + fcntl = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE; + break; + default: + rc = EINVAL; + goto fail_inval; + } + + sfc_adapter_lock(sa); + + if (sa->state == SFC_ADAPTER_STARTED) { + rc = efx_mac_fcntl_set(sa->nic, fcntl, fc_conf->autoneg); + if (rc != 0) + goto fail_mac_fcntl_set; + } + + port->flow_ctrl = fcntl; + port->flow_ctrl_autoneg = fc_conf->autoneg; + + sfc_adapter_unlock(sa); + + return 0; + +fail_mac_fcntl_set: + sfc_adapter_unlock(sa); +fail_inval: + SFC_ASSERT(rc > 0); + return -rc; +} + static const struct eth_dev_ops sfc_eth_dev_ops = { .dev_configure = sfc_dev_configure, .dev_start = sfc_dev_start, @@ -467,6 +563,8 @@ static const struct eth_dev_ops sfc_eth_dev_ops = { .rx_queue_release = sfc_rx_queue_release, .tx_queue_setup = sfc_tx_queue_setup, .tx_queue_release = sfc_tx_queue_release, + .flow_ctrl_get = sfc_flow_ctrl_get, + .flow_ctrl_set = sfc_flow_ctrl_set, }; static int diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index d8ff097..ccc0854 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -79,6 +79,13 @@ sfc_port_start(struct sfc_adapter *sa) if (rc != 0) goto fail_port_init; + sfc_log_init(sa, "set flow control to %#x
[dpdk-dev] [PATCH 01/31] net/sfc: implement MCDI logging callback
Reviewed-by: Andrew LeeReviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/sfc_efx.rst | 6 drivers/net/sfc/efsys.h | 2 +- drivers/net/sfc/sfc.h| 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/sfc/sfc_kvargs.c | 1 + drivers/net/sfc/sfc_kvargs.h | 2 ++ drivers/net/sfc/sfc_mcdi.c | 69 7 files changed, 81 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index aadd775..2cca287 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -155,3 +155,9 @@ boolean parameters value. - ``debug_init`` [bool] (default **n**) Enable extra logging during device intialization and startup. + +- ``mcdi_logging`` [bool] (default **n**) + + Enable extra logging of the communication with the NIC's management CPU. + The logging is done using RTE_LOG() with INFO level and PMD type. + The format is consumed by the Solarflare netlogdecode cross-platform tool. diff --git a/drivers/net/sfc/efsys.h b/drivers/net/sfc/efsys.h index e4d5035..d48eb4c 100644 --- a/drivers/net/sfc/efsys.h +++ b/drivers/net/sfc/efsys.h @@ -175,7 +175,7 @@ prefetch_read_once(const volatile void *addr) /* MCDI is required for SFN7xxx and SFN8xx */ #define EFSYS_OPT_MCDI 1 -#define EFSYS_OPT_MCDI_LOGGING 0 +#define EFSYS_OPT_MCDI_LOGGING 1 #define EFSYS_OPT_MCDI_PROXY_AUTH 0 #define EFSYS_OPT_MAC_STATS 0 diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 29d3a6b..0064fcb 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -107,6 +107,7 @@ struct sfc_mcdi { efsys_mem_t mem; enum sfc_mcdi_state state; efx_mcdi_transport_ttransport; + boollogging; }; struct sfc_intr { diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index c28082c..12309ee 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -464,4 +464,5 @@ static struct eth_driver sfc_efx_pmd = { RTE_PMD_REGISTER_PCI(net_sfc_efx, sfc_efx_pmd.pci_drv); RTE_PMD_REGISTER_PCI_TABLE(net_sfc_efx, pci_id_sfc_efx_map); RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx, + SFC_KVARG_MCDI_LOGGING "=" SFC_KVARG_VALUES_BOOL " " SFC_KVARG_DEBUG_INIT "=" SFC_KVARG_VALUES_BOOL); diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c index f1bab28..bbbd026 100644 --- a/drivers/net/sfc/sfc_kvargs.c +++ b/drivers/net/sfc/sfc_kvargs.c @@ -42,6 +42,7 @@ sfc_kvargs_parse(struct sfc_adapter *sa) struct rte_devargs *devargs = sa->eth_dev->pci_dev->device.devargs; const char **params = (const char *[]){ SFC_KVARG_DEBUG_INIT, + SFC_KVARG_MCDI_LOGGING, NULL, }; diff --git a/drivers/net/sfc/sfc_kvargs.h b/drivers/net/sfc/sfc_kvargs.h index 0b53963..ffce851 100644 --- a/drivers/net/sfc/sfc_kvargs.h +++ b/drivers/net/sfc/sfc_kvargs.h @@ -40,6 +40,8 @@ extern "C" { #define SFC_KVARG_DEBUG_INIT "debug_init" +#define SFC_KVARG_MCDI_LOGGING "mcdi_logging" + struct sfc_adapter; int sfc_kvargs_parse(struct sfc_adapter *sa); diff --git a/drivers/net/sfc/sfc_mcdi.c b/drivers/net/sfc/sfc_mcdi.c index 9ba28e1..3bed2e0 100644 --- a/drivers/net/sfc/sfc_mcdi.c +++ b/drivers/net/sfc/sfc_mcdi.c @@ -35,6 +35,7 @@ #include "sfc.h" #include "sfc_log.h" +#include "sfc_kvargs.h" #define SFC_MCDI_POLL_INTERVAL_MIN_US 10 /* 10us in 1us units */ #define SFC_MCDI_POLL_INTERVAL_MAX_US (US_PER_S / 10) /* 100ms in 1us units */ @@ -125,6 +126,65 @@ sfc_mcdi_exception(void *arg, efx_mcdi_exception_t eme) sfc_panic(sa, "MCDI exceptions handling is not implemented\n"); } +#define SFC_MCDI_LOG_BUF_SIZE 128 + +static size_t +sfc_mcdi_do_log(const struct sfc_adapter *sa, + char *buffer, void *data, size_t data_size, + size_t pfxsize, size_t position) +{ + uint32_t *words = data; + /* Space separator plus 2 characters per byte */ + const size_t word_str_space = 1 + 2 * sizeof(*words); + size_t i; + + for (i = 0; i < data_size; i += sizeof(*words)) { + if (position + word_str_space >= + SFC_MCDI_LOG_BUF_SIZE) { + /* Flush at SFC_MCDI_LOG_BUF_SIZE with backslash +* at the end which is required by netlogdecode. +*/ + buffer[position] = '\0'; + sfc_info(sa, "%s \\", buffer); + /* Preserve prefix for the next log message */ + position = pfxsize; + } + position += snprintf(buffer + position, +SFC_MCDI_LOG_BUF_SIZE - position, +
[dpdk-dev] [PATCH 00/31] Support more features in Solarflare PMD
The patch series adds a number of features to Solarflare libefx-based PMD. Basically one patch per feature. The patches are grouped into one series since they touch nearby lines in either PMD feature list, or dev_ops structure, or documentation. So, patches cannot be applied in arbitrary order. The patch series should be applied after [PATCH v2 00/55] Solarflare libefx-based PMD (Message-ID: 1480436367-20749-1-git-send-email-arybche...@solarflare.com) Andrew Rybchenko (16): net/sfc: implement MCDI logging callback net/sfc: support parameter to choose performance profile net/sfc: implement ethdev hook to get basic statistics net/sfc: support extended statistics net/sfc: support flow control settings get/set net/sfc: support link status change interrupt net/sfc: implement device operation to change MTU net/sfc: support link speed and duplex settings net/sfc: support checksum offloads on receive net/sfc: handle received packet type info provided by HW net/sfc: support callback to get receive queue information net/sfc: support Rx free threshold net/sfc: add callback to get RxQ pending descriptors count net/sfc: add RxQ descriptor done callback net/sfc: support scattered Rx DMA net/sfc: support deferred start of receive queues Artem Andreev (1): net/sfc: support link up/down Ivan Malov (14): net/sfc: support promiscuous and all-multicast control net/sfc: support main (the first) MAC address change net/sfc: support multicast addresses list controls net/sfc: add callback to get transmit queue information net/sfc: support Tx free threshold net/sfc: support deferred start of transmit queues net/sfc: support VLAN offload on transmit path net/sfc: add basic stubs for RSS support on driver attach net/sfc: support RSS hash offload net/sfc: add callback to query RSS key and hash types config net/sfc: add callback to set RSS key and hash types config net/sfc: add callback to query RSS redirection table net/sfc: add callback to update RSS redirection table net/sfc: support firmware-assisted TSOv2 config/common_base | 1 + doc/guides/nics/features/sfc_efx.ini | 22 +- doc/guides/nics/sfc_efx.rst | 55 ++- drivers/net/sfc/Makefile | 4 + drivers/net/sfc/efsys.h | 8 +- drivers/net/sfc/sfc.c| 126 - drivers/net/sfc/sfc.h| 46 ++ drivers/net/sfc/sfc_ethdev.c | 893 ++- drivers/net/sfc/sfc_ev.c | 64 ++- drivers/net/sfc/sfc_ev.h | 2 + drivers/net/sfc/sfc_intr.c | 204 drivers/net/sfc/sfc_kvargs.c | 2 + drivers/net/sfc/sfc_kvargs.h | 12 + drivers/net/sfc/sfc_mcdi.c | 69 +++ drivers/net/sfc/sfc_port.c | 107 - drivers/net/sfc/sfc_rx.c | 288 ++- drivers/net/sfc/sfc_rx.h | 16 + drivers/net/sfc/sfc_tso.c| 203 drivers/net/sfc/sfc_tweak.h | 3 + drivers/net/sfc/sfc_tx.c | 165 ++- drivers/net/sfc/sfc_tx.h | 41 +- 21 files changed, 2259 insertions(+), 72 deletions(-) create mode 100644 drivers/net/sfc/sfc_tso.c -- 2.5.5