Re: [dpdk-dev] crypto/qat: fix process type handling
On Mon, Feb 28, 2022 at 6:36 PM Kai Ji wrote: > > This patch fix the process type handling in QAT PMDs where > only primary and secondary process are supported in qat > build request > > Signed-off-by: Kai Ji > --- > drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 3 +++ > drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c | 3 +++ > drivers/crypto/qat/dev/qat_sym_pmd_gen1.c| 3 +++ > drivers/crypto/qat/qat_sym.c | 8 > 4 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c > b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c > index 5084a5fcd1..739404b1d4 100644 > --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c > +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c > @@ -358,6 +358,9 @@ qat_sym_crypto_set_session_gen3(void *cdev __rte_unused, > void *session) > enum rte_proc_type_t proc_type = rte_eal_process_type(); > int ret; > > + if (proc_type < 0 || proc_type == RTE_PROC_INVALID) > + return -EINVAL; This is not supposed to happen after rte_eal_init() is called. I have a doubt on Windows init because I can't see where rte_config.process_type is initialised. Are you seeing this issue on Windows? In any case, the commitlog needs more explanation. -- David Marchand
Re: [PATCH v2] app/testpmd: add help messages for multi-process
01/03/2022 04:39, Min Hu (Connor): > From: Huisong Li > > This patch adds help messages for multi-process. > > Fixes: a550baf24af9 ("app/testpmd: support multi-process") > Cc: sta...@dpdk.org > > Signed-off-by: Huisong Li > --- > v2: > * adjust the position of parameters. > --- > app/test-pmd/parameters.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c > index daf6a31b2b..3e6a2e88b5 100644 > --- a/app/test-pmd/parameters.c > +++ b/app/test-pmd/parameters.c > @@ -92,6 +92,8 @@ usage(char* progname) > printf(" --max-pkt-len=N: set the maximum size of packet to N > bytes.\n"); > printf(" --max-lro-pkt-size=N: set the maximum LRO aggregated packet " > "size to N bytes.\n"); > + printf(" --num-procs: the number of processes which will be used\n"); > + printf(" --proc-id : the id of the current process (id < > num-procs)\n"); > #ifdef RTE_LIB_CMDLINE > printf(" --eth-peers-configfile=name: config file with ethernet > addresses " > "of peer ports.\n"); Why adding the multiprocess options in the middle of packet and Ethernet config? I think it would fit better before --nb-cores. Why no testpmd maintainer is Cc'ed? Do you know the command --cc-cmd devtools/get-maintainer.sh ?
Re: [PATCH] app/testpmd: add help messages for multi-process
01/03/2022 04:41, Min Hu (Connor): > Hi, Thomas, > I have adjust the postions in v2. I think the new postion will > be OK. No, I think you just picked a random position. I expect more from a regular contributor like you.
RE: [EXT] [PATCH] test/crypto: remove mod exp smaller modulus cases
Hi Anoob, > -Original Message- > From: Anoob Joseph > Sent: Wednesday, February 23, 2022 11:09 AM > To: Kusztal, ArkadiuszX > Cc: Akhil Goyal ; Zhang, Roy Fan > ; Umesh Kartha ; > Ramkumar Balu ; dev@dpdk.org > Subject: RE: [EXT] [PATCH] test/crypto: remove mod exp smaller modulus cases > > Hi Arek, > > I agree that these cases may not be particularly useful from cryptographic > standpoint, but how do we say from what values a PMD "must" support? Are > you having some trouble supporting some of these values? Should we consider > extending capabilities to help with this rather than just removing the test > vectors? As for QAT PMD yes, we stopped to support such vectors, for me these vectors are only waste of space. When extending test cases I would go for PWCT (pairwise conditional tests) between hardware and OpenSSL, it is similar what I am doing when testing it internally. As for capability we could consider such addition. I will send proposal for capability change soon, right now we cannot even check what padding is supported, which curve etc. > > Thanks, > Anoob > > > -Original Message- > > From: Arek Kusztal > > Sent: Tuesday, February 8, 2022 4:25 PM > > To: dev@dpdk.org > > Cc: Akhil Goyal ; roy.fan.zh...@intel.com; Arek > > Kusztal > > Subject: [EXT] [PATCH] test/crypto: remove mod exp smaller modulus > > cases > > > > External Email > > > > -- > > Even if mod exp tests cases where modulus is not the biggest number > > are mathematically correct and can be computed, cryptographically it > > is useless and PMD does not need to support it. > > > > Signed-off-by: Arek Kusztal > > --- > > app/test/test_cryptodev_mod_test_vectors.h | 501 > > > > - > > 1 file changed, 501 deletions(-) > > > > diff --git a/app/test/test_cryptodev_mod_test_vectors.h > > b/app/test/test_cryptodev_mod_test_vectors.h > > index c66f4b18bc..d108059624 100644 > > --- a/app/test/test_cryptodev_mod_test_vectors.h > > +++ b/app/test/test_cryptodev_mod_test_vectors.h > > @@ -167,141 +167,6 @@ modex_test_data modex_test_case[] = { }, { > > .description = "Modular Exponentiation " > > - "(mod=8, base=65, exp=17, res=8)", > > - .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX, > > - .base = { > > - .data = { > > - 0x25, 0x74, 0x41, 0xCE, 0xFA, 0x5C, 0x07, 0x2A, > > - 0xD1, 0x74, 0xF3, 0x3D, 0xE1, 0xCC, 0xC3, 0x18, > > - 0x7E, 0x4A, 0x21, 0x9F, 0x97, 0xA3, 0x26, 0x85, > > - 0x85, 0xD9, 0x9B, 0xE3, 0xBA, 0xB3, 0x70, 0xC9, > > - 0x26, 0x68, 0xE4, 0xB7, 0x4C, 0x88, 0x48, 0xC1, > > - 0x6B, 0xC6, 0x3C, 0x00, 0x8C, 0x6B, 0xC6, 0x11, > > - 0xD0, 0xD6, 0x61, 0x5D, 0xEC, 0xAA, 0xBA, 0x3B, > > - 0x7D, 0xB3, 0x0D, 0x3F, 0xA5, 0x4D, 0xEE, 0xE4, > > - 0xAC > > - }, > > - .len = 65 > > - }, > > - .exponent = { > > - .data = { > > - 0x1C, 0x54, 0x2F, 0xCA, 0xDE, 0x4F, 0x17, 0x38, > > - 0x69, 0x87, 0xB4, 0xFF, 0x3A, 0x6C, 0x82, 0x70, > > - 0x53 > > - }, > > - .len = 17 > > - }, > > - .reminder = { > > - .data = { > > - 0x52, 0x06, 0x1A, 0x35, 0x70, 0x33, 0x78, 0x45 > > - }, > > - .len = 8 > > - }, > > - .modulus = { > > - .data = { > > - 0x6B, 0x6D, 0xFA, 0xCB, 0x09, 0x5D, 0x9C, 0xFD > > - }, > > - .len = 8 > > - }, > > - .result_len = 8 > > -}, > > -{ > > - .description = "Modular Exponentiation " > > - "(mod=100, base=150, exp=192, res=100)", > > - .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX, > > - .base = { > > - .data = { > > - 0xC1, 0xA1, 0x04, 0xE4, 0x4D, 0x4A, 0xD3, 0x5C, > > - 0xB3, 0xD0, 0x16, 0x51, 0xA7, 0xF4, 0x82, 0x6C, > > - 0x22, 0xDD, 0x4D, 0xAA, 0x70, 0x30, 0x25, 0xA7, > > - 0xFA, 0xA9, 0xF2, 0x20, 0x55, 0x9B, 0xEA, 0x26, > > - 0xF6, 0xB5, 0xF8, 0x9C, 0x46, 0x21, 0x85, 0x0E, > > - 0x38, 0x73, 0x01, 0xC6, 0x72, 0x67, 0x9B, 0x49, > > - 0xCE, 0x48, 0xB7, 0x4A, 0xEE, 0x08, 0x21, 0x26, > > - 0xF3, 0x21, 0x77, 0xE7, 0x3C, 0x77, 0xF4, 0x0A, > > - 0x82, 0xC8, 0x16, 0x94, 0x6C, 0xBF, 0xA8, 0xD8, > > - 0x8B, 0x7D, 0x27, 0x60, 0xAC, 0x06, 0x69, 0x7E, > > - 0x46, 0x2C, 0xE2, 0xD1, 0x13, 0x50, 0x7D, 0xCE, > > - 0x4D, 0xC4, 0x5D, 0x81, 0xFB, 0x6B, 0x11, 0x4A, > > - 0x2D, 0xA2, 0x03, 0x55, 0x77, 0x8C, 0x3D, 0xA1, > > - 0xAD, 0xBE, 0x9C, 0x72, 0xE5, 0xA5, 0xFB, 0x49, > > - 0x5F, 0x13, 0x48, 0xC7, 0xAC, 0x
RE: [PATCH v1] net/vhost: clear data of packet mbuf after sending pkts
> -Original Message- > From: Yuying Zhang > Sent: Tuesday, March 1, 2022 3:28 PM > To: dev@dpdk.org; maxime.coque...@redhat.com; Xia, Chenbo > > Cc: Zhang, Yuying ; sta...@dpdk.org > Subject: [PATCH v1] net/vhost: clear data of packet mbuf after sending pkts > > The PMD frees a packet mbuf back into its original mempool after sending a > packet. However, old data is not cleaned up which causes error in payload of > new packets. This patch clear data of packet mbuf before freeing mbuf. > > Fixes: ee584e9710b9 ("vhost: add driver on top of the library") > Cc: sta...@dpdk.org > > Signed-off-by: Yuying Zhang > --- Tested-by: Wei Ling
Re: [PATCH v1] net/vhost: clear data of packet mbuf after sending pkts
On Tue, Mar 1, 2022 at 8:29 AM Yuying Zhang wrote: > > The PMD frees a packet mbuf back into its original mempool > after sending a packet. However, old data is not cleaned up > which causes error in payload of new packets. This patch clear > data of packet mbuf before freeing mbuf. This patch looks wrong to me. What is the actual issue you want to fix? -- David Marchand
[Bug 943] BUG: scheduling while atomic
https://bugs.dpdk.org/show_bug.cgi?id=943 Bug ID: 943 Summary: BUG: scheduling while atomic Product: DPDK Version: 21.11 Hardware: All OS: Linux Status: UNCONFIRMED Severity: critical Priority: Normal Component: examples Assignee: dev@dpdk.org Reporter: yun.z...@windriver.com Target Milestone: --- Hi all, There is a "scheduling while atomic" bug when enslave a macvlan of kni interface to a bond master. This issue can be reproduced on dpdk from 528057df4c4fb5(kni: support promiscuous mode set). > The kernel message is like this. [ 697.574325] igb :03:00.0: removed PHC on ens8f0 [ 697.738976] igb_uio :03:00.0: mapping 1K dma=0x40a98a000 host=0d71c45b [ 697.738981] igb_uio :03:00.0: unmapping 1K dma=0x40a98a000 host=0d71c45b [ 1200.157918] igb_uio :03:00.0: uio device registered with irq 127 [ 1235.846792] igb_uio :03:00.0: uio device registered with irq 127 [ 1236.441082] rte_kni: Creating kni... [ 1236.463488] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready [ 1238.272115] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready [ 1271.311470] rte_kni: Successfully release kni named vEth0_0 [ 1273.749487] igb_uio :03:00.0: uio device registered with irq 127 [ 1274.345550] rte_kni: Creating kni... [ 1274.367822] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready [ 1276.275826] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready [ 1396.811992] Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) [ 1426.711326] bonding: remux0 is being created... [ 1459.463366] device vEth0_0 entered promiscuous mode [ 1459.463368] BUG: scheduling while atomic: bash/3560/0x0200 [ 1459.463369] Modules linked in: bonding macvlan rte_kni(OE) iptable_filter igb_uio(OE) uio vmnet(OE) vmw_vsock_vmci_transport vsock vmw_vmci vmmon(OE) dell_rbu dcdbas nls_iso8859_1 intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec_hdmi pcbc hp_wmi sparse_keymap aesni_intel aes_x86_64 snd_hda_codec_realtek wmi_bmof snd_hda_codec_generic crypto_simd snd_hda_intel snd_hda_codec glue_helper cryptd serio_raw intel_cstate intel_rapl_perf joydev input_leds snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi mei_me mei snd_seq snd_seq_device snd_timer wmi acpi_pad i915 snd drm_kms_helper drm fb_sys_fops syscopyarea sysfillrect sysimgblt intel_pch_thermal video soundcore shpchp mac_hid sch_fq_codel [ 1459.463389] nfsd auth_rpcgss parport_pc ppdev nfs_acl lockd lp parport grace sunrpc ip_tables x_tables autofs4 psmouse e1000e igb i2c_algo_bit dca ptp ahci pps_core libahci hid_generic usbhid hid [ 1459.463396] CPU: 2 PID: 3560 Comm: bash Tainted: G OE 4.15.0-167-generic #175-Ubuntu [ 1459.463397] Hardware name: HP HP EliteDesk 800 G2 SFF/8054, BIOS N01 Ver. 02.15 06/02/2016 [ 1459.463397] Call Trace: [ 1459.463403] dump_stack+0x6d/0x8b [ 1459.463405] __schedule_bug+0x55/0x70 [ 1459.463407] __schedule+0x658/0x890 [ 1459.463408] ? log_store+0x226/0x270 [ 1459.463409] schedule+0x2c/0x80 [ 1459.463410] schedule_timeout+0x15d/0x370 > in wait_event_interruptible_timeout [ 1459.463412] ? __next_timer_interrupt+0xe0/0xe0 [ 1459.463415] kni_net_process_request+0x277/0x300 [rte_kni] [ 1459.463416] ? wait_woken+0x80/0x80 [ 1459.463418] kni_net_change_rx_flags+0x6b/0x90 [rte_kni] [ 1459.463420] __dev_set_promiscuity+0x121/0x1d0 [ 1459.463421] __dev_set_rx_mode+0x83/0x90 [ 1459.463423] dev_uc_add+0x56/0x70 > enter atomic context by calling netif_addr_lock_bh() [ 1459.463424] macvlan_open+0x15e/0x1d0 [macvlan] [ 1459.463426] __dev_open+0xd3/0x160 [ 1459.463427] dev_open+0x4e/0x90 [ 1459.463431] bond_enslave+0x62a/0x1530 [bonding] [ 1459.463433] ? vsscanf+0x805/0x8d0 [ 1459.463434] ? sscanf+0x49/0x70 [ 1459.463438] bond_option_slaves_set+0xd0/0x1a0 [bonding] [ 1459.463441] __bond_opt_set+0x101/0x3a0 [bonding] [ 1459.463444] __bond_opt_set_notify+0x2c/0x80 [bonding] [ 1459.463447] bond_opt_tryset_rtnl+0x56/0xa0 [bonding] [ 1459.463450] bonding_sysfs_store_option+0x35/0x60 [bonding] [ 1459.463452] dev_attr_store+0x1b/0x30 [ 1459.463453] sysfs_kf_write+0x3c/0x50 [ 1459.463454] kernfs_fop_write+0x125/0x1a0 [ 1459.463456] __vfs_write+0x1b/0x40 [ 1459.463456] vfs_write+0xb1/0x1a0 [ 1459.463457] SyS_write+0x5c/0xe0 [ 1459.463459] do_syscall_64+0x73/0x130 > write /sys/class/net/remux0/bonding/slaves to enslave eth5 [ 1459.463460] entry_SYSCALL_64_after_hwframe+0x41/0xa6 [ 1459.463461] RIP: 0033:0x7fdda9a41224 [ 1459.463462] RSP: 002b:7ffe02de1b68 EFLAGS: 0246 ORIG_RAX: 0001 [ 1459.463463] RAX: ffda RBX: 0006 RCX: 7fdda9a41224 [ 1459.463463] RDX: 0006 RSI: 55d2b3e046f0 RDI: 0001 [ 1459.463464] RBP: 55d2b3e046f0 R08: 000a R09: 0
[PATCH v1] raw/ifpga: fix monitor thread issues
Monitor thread handles graceful shutdown according to the value of specific sensors in device, two issues are found below. 1. Thread is not created when card is probed. 2. Thread is canceled without checking presence of other cards. To fix them, thread is created in pci device probe function, a reference count is checked before canceling the thread. Fixes: 9c006c45 ("raw/ifpga: scan PCIe BDF device tree") Cc: sta...@dpdk.org Signed-off-by: Wei Huang Acked-by: Tianfei Zhang --- drivers/raw/ifpga/ifpga_rawdev.c | 62 ++-- drivers/raw/ifpga/ifpga_rawdev.h | 2 ++ 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index f341f4a..d36cf61 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -68,7 +68,7 @@ static struct ifpga_rawdev ifpga_rawdevices[IFPGA_RAWDEV_NUM]; -static int ifpga_monitor_start; +static int ifpga_monitor_refcnt; static pthread_t ifpga_monitor_start_thread; static struct ifpga_rawdev * @@ -133,6 +133,7 @@ struct ifpga_rawdev * dev->dev_id = dev_id; for (i = 0; i < IFPGA_MAX_IRQ; i++) dev->intr_handle[i] = NULL; + dev->poll_enabled = 0; return dev; } @@ -207,10 +208,11 @@ static int ifpga_get_dev_vendor_id(const char *bdf, return 0; } -static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev, - const char *bdf) + +static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev) { - char path[1024] = "/sys/bus/pci/devices/:"; + struct opae_adapter *adapter = NULL; + char path[1024] = "/sys/bus/pci/devices/"; char link[1024], link1[1024]; char dir[1024] = "/sys/devices/"; char *c; @@ -225,7 +227,11 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev, int func; uint32_t dev_id, vendor_id; - strlcat(path, bdf, sizeof(path)); + adapter = ifpga_dev ? ifpga_rawdev_get_priv(ifpga_dev->rawdev) : NULL; + if (!adapter) + return -ENODEV; + + strlcat(path, adapter->name, sizeof(path)); memset(link, 0, sizeof(link)); memset(link1, 0, sizeof(link1)); ret = readlink(path, link, (sizeof(link)-1)); @@ -375,7 +381,7 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev, /* monitor temperature sensors */ if (!strcmp(sensor->name, "Board Temperature") || !strcmp(sensor->name, "FPGA Die Temperature")) { - IFPGA_RAWDEV_PMD_INFO("read sensor %s %d %d %d\n", + IFPGA_RAWDEV_PMD_DEBUG("read sensor %s %d %d %d\n", sensor->name, value, sensor->high_warn, sensor->high_fatal); @@ -417,7 +423,7 @@ static int set_surprise_link_check_aer( bool enable = 0; uint32_t aer_new0, aer_new1; - if (!ifpga_rdev) { + if (!ifpga_rdev || !ifpga_rdev->rawdev) { printf("\n device does not exist\n"); return -EFAULT; } @@ -496,11 +502,11 @@ static int set_surprise_link_check_aer( int gsd_enable, ret; #define MS 1000 - while (__atomic_load_n(&ifpga_monitor_start, __ATOMIC_RELAXED)) { + while (__atomic_load_n(&ifpga_monitor_refcnt, __ATOMIC_RELAXED)) { gsd_enable = 0; for (i = 0; i < IFPGA_RAWDEV_NUM; i++) { ifpga_rdev = &ifpga_rawdevices[i]; - if (ifpga_rdev->rawdev) { + if (ifpga_rdev->poll_enabled) { ret = set_surprise_link_check_aer(ifpga_rdev, gsd_enable); if (ret == 1 && !gsd_enable) { @@ -520,32 +526,46 @@ static int set_surprise_link_check_aer( } static int -ifpga_monitor_start_func(void) +ifpga_monitor_start_func(struct ifpga_rawdev *dev) { int ret; - if (!__atomic_load_n(&ifpga_monitor_start, __ATOMIC_RELAXED)) { + if (!dev) + return -ENODEV; + + ret = ifpga_rawdev_fill_info(dev); + if (ret) + return ret; + + dev->poll_enabled = 1; + + if (!__atomic_fetch_add(&ifpga_monitor_refcnt, 1, __ATOMIC_RELAXED)) { ret = rte_ctrl_thread_create(&ifpga_monitor_start_thread, "ifpga-monitor", NULL, ifpga_rawdev_gsd_handle, NULL); if (ret != 0) { + ifpga_monitor_start_thread = 0; IFPGA_RAWDEV_PMD_ERR( "Fail to create ifpga monitor thread"); return -1; } - __atomic_store_n(&ifpga_monitor_start, 1, __ATOMIC_RELAXED); } return 0; } + s
[PATCH v3 1/1] ethdev: mtr: support input color selection
From: Jerin Jacob Currently, meter object supports only DSCP based on input color table, The patch enhance that to support VLAN based input color table, color table based on inner field for the tunnel use case, and support for fallback color per meter if packet based on a different field. All of the above features are exposed through capability and added additional capability to specify the implementation supports more than one input color table per ethdev port Suggested-by: Cristian Dumitrescu Signed-off-by: Jerin Jacob --- v3..v2: - Fix input color flags as a bitmask - Add definitions for newly added API v2..v1: - Fix seperate typo v1..RFC: Address the review comments by Cristian at https://patches.dpdk.org/project/dpdk/patch/20210820082401.3778736-1-jer...@marvell.com/ - Moved to v22.07 release - Updated rte_mtr_input_color_method to support all VLAN, DSCP, Inner cases - Added input_color_method - Removed union between vlan_table and dscp_table - Kept VLAN instead of PCP as HW coloring based on DEI(1bit), PCP(3 bits) What is missing: - 22.07 release notes update .../traffic_metering_and_policing.rst | 28 +++ lib/ethdev/rte_mtr.c | 12 ++ lib/ethdev/rte_mtr.h | 164 +- lib/ethdev/rte_mtr_driver.h | 9 + lib/ethdev/version.map| 3 + 5 files changed, 214 insertions(+), 2 deletions(-) diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst b/doc/guides/prog_guide/traffic_metering_and_policing.rst index ceb5a96488..59ebd361ba 100644 --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst @@ -21,6 +21,7 @@ The main features are: * Policer actions (per meter output color): recolor, drop * Statistics (per policer output color) * Chaining multiple meter objects +* Packet content based input color selection Configuration steps --- @@ -105,3 +106,30 @@ traffic meter and policing library. * Adding one (or multiple) actions of the type ``RTE_FLOW_ACTION_TYPE_METER`` to the list of meter actions (``struct rte_mtr_meter_policy_params::actions``) specified per color as show in :numref:`figure_rte_mtr_chaining`. + +Packet content based input color selection +-- + +The API supports selecting the input color based on the packet content. +Following is the API usage model for the same. + +#. Probe the input color selection device capabilities using following + parameter using ``rte_mtr_capabilities_get()`` API + ``struct rte_mtr_capabilities::methods_mask`` and + ``struct rte_mtr_capabilitie::separate_input_color_table_per_port`` + +#. When creating the meter object using ``rte_mtr_create()``, configure + relevant input color selection parameters such as + + * Select the input color method ``struct rte_mtr_params::input_color_method`` + + * Fill the tables ``struct rte_mtr_params::dscp_table``, + ``struct rte_mtr_params::dscp_table`` based on input color selected + + * Update the ``struct rte_mtr_params::default_input_color`` to determine + the default input color in case the input packet does not match + the input color method + + * If needed, update the input color table at runtime using + ``rte_mtr_meter_vlan_table_update()`` and ``rte_mtr_meter_dscp_table_update()`` + APIs. diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c index e49fcf271c..a0cb91e0b1 100644 --- a/lib/ethdev/rte_mtr.c +++ b/lib/ethdev/rte_mtr.c @@ -207,6 +207,18 @@ rte_mtr_meter_dscp_table_update(uint16_t port_id, mtr_id, dscp_table, error); } +/** MTR object meter VLAN table update */ +int +rte_mtr_meter_vlan_table_update(uint16_t port_id, + uint32_t mtr_id, + enum rte_color *vlan_table, + struct rte_mtr_error *error) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + return RTE_MTR_FUNC(port_id, meter_vlan_table_update)(dev, + mtr_id, vlan_table, error); +} + /** MTR object enabled stats update */ int rte_mtr_stats_update(uint16_t port_id, diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h index 40df0888c8..7f9abebb41 100644 --- a/lib/ethdev/rte_mtr.h +++ b/lib/ethdev/rte_mtr.h @@ -213,6 +213,80 @@ struct rte_mtr_meter_policy_params { const struct rte_flow_action *actions[RTE_COLORS]; }; +/** + * Input color method + */ +enum rte_mtr_input_color_method { + /** +* The input color is always green. +* The default_input_color is ignored for this method. +* @see struct rte_mtr_params::default_input_color +*/ + RTE_MTR_INPUT_COLOR_METHOD_COLOR_BLIND = RTE_BIT64(0), + /** +* If the input packet has at least one VLAN label, its input color is +* detected by the outermost VLAN DEI(1bit), PCP(3 bits) +* indexing into the struct rte_mtr_params::vlan_table. +
[PATCH v1 1/3] common/cnxk: update precolor table setup for VLAN
From: Sunil Kumar Kori As per new spec in DPDK, VLAN priority is supported for precoloring of input packet. Signed-off-by: Sunil Kumar Kori --- drivers/common/cnxk/roc_nix.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 5e6eb58c0c..e92363f7f3 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -42,6 +42,12 @@ enum roc_nix_bpf_level_flag { ROC_NIX_BPF_LEVEL_F_TOP = BIT(2), }; +enum roc_nix_bpf_precolor_tbl_size { + ROC_NIX_BPF_PRECOLOR_TBL_SIZE_GEN = 16, + ROC_NIX_BPF_PRECOLOR_TBL_SIZE_VLAN = 16, + ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP = 64, +}; + enum roc_nix_bpf_pc_mode { ROC_NIX_BPF_PC_MODE_VLAN_INNER, ROC_NIX_BPF_PC_MODE_VLAN_OUTER, -- 2.25.1
[PATCH v1 2/3] net/cnxk: support ops to update precolor VLAN table
From: Sunil Kumar Kori Implement API to update VLAN table for pre-coloring for incoming packet per nixlf for CN10K platform. Signed-off-by: Sunil Kumar Kori --- drivers/net/cnxk/cnxk_ethdev.h | 2 +- drivers/net/cnxk/cnxk_ethdev_mtr.c | 214 + 2 files changed, 188 insertions(+), 28 deletions(-) diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index ccdf496860..7c7e013c42 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -409,7 +409,7 @@ struct cnxk_eth_dev { uint64_t clk_delta; /* Ingress policer */ - enum roc_nix_bpf_color precolor_tbl[ROC_NIX_BPF_PRE_COLOR_MAX]; + enum roc_nix_bpf_color precolor_tbl[ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP]; struct cnxk_mtr_profiles mtr_profiles; struct cnxk_mtr_policy mtr_policy; struct cnxk_mtr mtr; diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c index c8183aa12d..1d6a4807d5 100644 --- a/drivers/net/cnxk/cnxk_ethdev_mtr.c +++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c @@ -48,7 +48,13 @@ static struct rte_mtr_capabilities mtr_capa = { RTE_MTR_STATS_N_PKTS_RED | RTE_MTR_STATS_N_PKTS_DROPPED | RTE_MTR_STATS_N_BYTES_GREEN | RTE_MTR_STATS_N_BYTES_YELLOW | RTE_MTR_STATS_N_BYTES_RED | - RTE_MTR_STATS_N_BYTES_DROPPED}; + RTE_MTR_STATS_N_BYTES_DROPPED, + .methods_mask = RTE_MTR_INPUT_COLOR_METHOD_COLOR_BLIND | + RTE_MTR_INPUT_COLOR_METHOD_VLAN | + RTE_MTR_INPUT_COLOR_METHOD_DSCP | + RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN | + RTE_MTR_INPUT_COLOR_METHOD_INNER_DSCP, + .separate_input_color_table_per_port = true}; static struct cnxk_meter_node * nix_mtr_find(struct cnxk_eth_dev *dev, uint32_t meter_id) @@ -470,6 +476,7 @@ cnxk_nix_mtr_create(struct rte_eth_dev *eth_dev, uint32_t mtr_id, struct cnxk_mtr_profile_node *profile; struct cnxk_mtr_policy_node *policy; struct cnxk_mtr *fm = &dev->mtr; + enum rte_color *table = NULL; struct cnxk_meter_node *mtr; int i; @@ -521,18 +528,49 @@ cnxk_nix_mtr_create(struct rte_eth_dev *eth_dev, uint32_t mtr_id, mtr->is_next = false; mtr->level = ROC_NIX_BPF_LEVEL_IDX_INVALID; - if (params->dscp_table) { - mtr->params.dscp_table = - plt_zmalloc(ROC_NIX_BPF_PRE_COLOR_MAX, ROC_ALIGN); - if (mtr->params.dscp_table == NULL) { + switch (params->input_color_method) { + case RTE_MTR_INPUT_COLOR_METHOD_DSCP: + case RTE_MTR_INPUT_COLOR_METHOD_INNER_DSCP: + table = (enum rte_color *) + plt_zmalloc(sizeof(enum rte_color) * + ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP, ROC_ALIGN); + if (table == NULL) { plt_free(mtr); return -rte_mtr_error_set(error, ENOMEM, RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL, "Memory alloc failed."); } + if (params->dscp_table) { + for (i = 0; i < ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP; i++) + table[i] = params->dscp_table[i]; - for (i = 0; i < ROC_NIX_BPF_PRE_COLOR_MAX; i++) - mtr->params.dscp_table[i] = params->dscp_table[i]; + mtr->params.dscp_table = table; + } + break; + case RTE_MTR_INPUT_COLOR_METHOD_VLAN: + case RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN: + table = (enum rte_color *) + plt_zmalloc(sizeof(enum rte_color) * + ROC_NIX_BPF_PRECOLOR_TBL_SIZE_VLAN, ROC_ALIGN); + if (table == NULL) { + plt_free(mtr); + return -rte_mtr_error_set(error, ENOMEM, + RTE_MTR_ERROR_TYPE_UNSPECIFIED, + NULL, "Memory alloc failed."); + } + if (params->vlan_table) { + for (i = 0; i < ROC_NIX_BPF_PRECOLOR_TBL_SIZE_VLAN; i++) + table[i] = params->vlan_table[i]; + + mtr->params.vlan_table = table; + } + break; + default: + plt_free(table); + plt_free(mtr); + return -rte_mtr_error_set(error, ENOMEM, + RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL, + "Invalid input color method"); } profile->ref_cnt++; @@ -619,7 +657,13 @@ cnxk_nix_mtr_destroy(struct rte_eth_dev *eth_dev, uint32_t mtr_id, mtr->poli
[PATCH v1 3/3] app/testpmd: support different input color method
From: Sunil Kumar Kori Support for input coloring is added based on VLAN. Patch adds support for the same. Signed-off-by: Sunil Kumar Kori --- app/test-pmd/cmdline.c | 1 + app/test-pmd/cmdline_mtr.c | 348 - app/test-pmd/cmdline_mtr.h | 1 + 3 files changed, 342 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 7ab0575e64..163e9c3fc9 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17974,6 +17974,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_del_port_meter_policy, (cmdline_parse_inst_t *)&cmd_set_port_meter_profile, (cmdline_parse_inst_t *)&cmd_set_port_meter_dscp_table, + (cmdline_parse_inst_t *)&cmd_set_port_meter_vlan_table, (cmdline_parse_inst_t *)&cmd_set_port_meter_stats_mask, (cmdline_parse_inst_t *)&cmd_show_port_meter_stats, (cmdline_parse_inst_t *)&cmd_mcast_addr, diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index ad7ef6ad98..7532d454ae 100644 --- a/app/test-pmd/cmdline_mtr.c +++ b/app/test-pmd/cmdline_mtr.c @@ -14,6 +14,7 @@ #include "cmdline_mtr.h" #define PARSE_DELIMITER" \f\n\r\t\v" +#define MAX_VLAN_TABLE_ENTRIES 16 #define MAX_DSCP_TABLE_ENTRIES 64 /** Display Meter Error Message */ @@ -82,6 +83,125 @@ parse_uint(uint64_t *value, const char *str) return 0; } +static int +parse_input_color_table_entries(char *str, enum rte_color **dscp_table, + enum rte_color **vlan_table) +{ + enum rte_color *vlan, *dscp; + char *token; + int i = 0; + + token = strtok_r(str, PARSE_DELIMITER, &str); + if (token == NULL) + return 0; + + /* Allocate memory for dscp table */ + dscp = (enum rte_color *)malloc(MAX_DSCP_TABLE_ENTRIES * + sizeof(enum rte_color)); + if (dscp == NULL) + return -1; + + while (1) { + if (strcmp(token, "G") == 0 || strcmp(token, "g") == 0) + dscp[i++] = RTE_COLOR_GREEN; + else if (strcmp(token, "Y") == 0 || strcmp(token, "y") == 0) + dscp[i++] = RTE_COLOR_YELLOW; + else if (strcmp(token, "R") == 0 || strcmp(token, "r") == 0) + dscp[i++] = RTE_COLOR_RED; + else { + free(dscp); + return -1; + } + if (i == MAX_DSCP_TABLE_ENTRIES) + break; + + token = strtok_r(str, PARSE_DELIMITER, &str); + if (token == NULL) { + free(dscp); + return -1; + } + } + + *dscp_table = dscp; + + token = strtok_r(str, PARSE_DELIMITER, &str); + if (token == NULL) + return 0; + + /* Allocate memory for vlan tables */ + vlan = (enum rte_color *)malloc(MAX_VLAN_TABLE_ENTRIES * + sizeof(enum rte_color)); + if (vlan == NULL) + return -1; + + i = 0; + while (1) { + if (strcmp(token, "G") == 0 || strcmp(token, "g") == 0) + vlan[i++] = RTE_COLOR_GREEN; + else if (strcmp(token, "Y") == 0 || strcmp(token, "y") == 0) + vlan[i++] = RTE_COLOR_YELLOW; + else if (strcmp(token, "R") == 0 || strcmp(token, "r") == 0) + vlan[i++] = RTE_COLOR_RED; + else { + free(vlan); + return -1; + } + if (i == MAX_VLAN_TABLE_ENTRIES) + break; + + token = strtok_r(str, PARSE_DELIMITER, &str); + if (token == NULL) { + free(vlan); + return -1; + } + } + + *vlan_table = vlan; + return 0; +} + +static int +parse_vlan_table_entries(char *str, enum rte_color **vlan_table) +{ + char *token; + int i = 0; + + token = strtok_r(str, PARSE_DELIMITER, &str); + if (token == NULL) + return 0; + + /* Allocate memory for vlan table */ + *vlan_table = (enum rte_color *)malloc(MAX_VLAN_TABLE_ENTRIES * + sizeof(enum rte_color)); + if (*vlan_table == NULL) + return -1; + + while (1) { + if (strcmp(token, "G") == 0 || + strcmp(token, "g") == 0) + (*vlan_table)[i++] = RTE_COLOR_GREEN; + else if (strcmp(token, "Y") == 0 || + strcmp(token, "y") == 0) + (*vlan_table)[i++] = RTE_COLOR_YELLOW; + else if (strcmp(token, "R") == 0 || + strcmp(token, "r") == 0) + (*vlan_table)[i++] = RTE_COLOR_RED; + else { +
RE: [PATCH v1] net/vhost: clear data of packet mbuf after sending pkts
Hi Marchand, > -Original Message- > From: David Marchand > Sent: Tuesday, March 1, 2022 4:44 PM > To: Zhang, Yuying > Cc: dev ; Maxime Coquelin ; > Xia, Chenbo ; dpdk stable > Subject: Re: [PATCH v1] net/vhost: clear data of packet mbuf after sending > pkts > > On Tue, Mar 1, 2022 at 8:29 AM Yuying Zhang wrote: > > > > The PMD frees a packet mbuf back into its original mempool after > > sending a packet. However, old data is not cleaned up which causes > > error in payload of new packets. This patch clear data of packet mbuf > > before freeing mbuf. > > This patch looks wrong to me. > What is the actual issue you want to fix? eth_vhost_tx() frees the packet mbuf back into its original mempool every time after a packet sent without clearing the data field. Then packet transmit function will get bulk directly without reset. New generated packet contains old data of previous packet. This is wrong. > > > -- > David Marchand
[Bug 944] [dpdk 22.03-rc2] inline_ipsec/test_Ipsec_Encryption_Rss: run dpdk-ipsec-secgw with assigned parameter fail
https://bugs.dpdk.org/show_bug.cgi?id=944 Bug ID: 944 Summary: [dpdk 22.03-rc2] inline_ipsec/test_Ipsec_Encryption_Rss: run dpdk-ipsec-secgw with assigned parameter fail Product: DPDK Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: Normal Component: examples Assignee: dev@dpdk.org Reporter: peng1x.zh...@intel.com Target Milestone: --- Created attachment 191 --> https://bugs.dpdk.org/attachment.cgi?id=191&action=edit config file [Environment] DPDK version: Use make showversion or for a non-released version: git remote -v && git show-ref --heads v22.03-rc2 305769000c40a4fdf1ed0cf24c157b447b91ea7d Other software versions: N/A. OS: Linux Ubuntu 20.04.3 LTS/5.8.0-050800-generic Compiler: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Hardware platform: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz NIC hardware: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01). [Test Setup] Steps to reproduce List the steps to reproduce the issue. 1.usertools/dpdk-devbind.py --force --bind=vfio-pci :03:00.0 :03:00.1 2.sed -i -e 's/if (nb_rx > 0)/if (nb_rx > 0) {/g' -e '/\/\* dequeue and process completed crypto-ops \*\//i\\t\t\t}' -e '/process_pkts(qconf, pkts, nb_rx, portid);/i\\t\t\t\tprintf("[debug]receive %llu packet in rxqueueid=%llu\\n",(unsigned long long)nb_rx, (unsigned long long)queueid);' examples/ipsec-secgw/ipsec-secgw.c 3.meson configure -Dexamples=ipsec-secgw x86_64-native-linuxapp-gcc 4.ninja -C x86_64-native-linuxapp-gcc 5.x86_64-native-linuxapp-gcc/examples/dpdk-ipsec-secgw -l 20,21 -n 4 --file-prefix=dpdk_9407_20220302180511 --vdev 'crypto_null' --log-level 8 --socket-mem 1024,1024 -- -p 0xf -P -u 0x2 --config='(0,0,20),(0,1,20),(1,0,21),(1,1,21)' -f /root/dpdk/enc_rss.cfg [Actual Result] x86_64-native-linuxapp-gcc/examples/dpdk-ipsec-secgw -l 20,21 -n 4 --file-prefix=dpdk_9407_20220302180511 --vdev 'crypto_null' --log-level 8 --socket-mem 1024,1024 -- -p 0xf -P -u 0x2 --config='(0,0,20),(0,1,20),(1,0,21),(1,1,21)' -f /root/dpdk/enc_rss.cfg EAL: Detected CPU lcores: 72 EAL: Detected NUMA nodes: 2 EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/dpdk_9407_20220302180511/mp_socket EAL: Selected IOVA mode 'VA' EAL: VFIO support initialized EAL: Using IOMMU type 1 (Type 1) EAL: Ignore mapping IO port bar(1) EAL: Ignore mapping IO port bar(2) EAL: Ignore mapping IO port bar(5) EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: :03:00.0 (socket 0) EAL: Ignore mapping IO port bar(1) EAL: Ignore mapping IO port bar(2) EAL: Ignore mapping IO port bar(5) EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: :03:00.1 (socket 0) CRYPTODEV: Creating cryptodev crypto_nullCRYPTODEV: Initialisation parameters - name: crypto_null,socket id: 1, max queue pairs: 8 Promiscuous mode selected librte_ipsec usage: disabled replay window size: 0 ESN: disabled SA flags: 0 Frag TTL: 100 ns EAL: Error - exiting with code: 1 Cause: Cannot use unprotected portmask without configured SA inbound [Expected Result] No eal error happen. Regression Is this issue a regression: (Y) Version the regression was introduced: Specify git id if known. First bad commit: commit a15f7b7d8aac9cca41d8bd022c3cf939a6a8d2e8 Author: Volodymyr Fialko Date: Wed Feb 9 12:52:13 2022 +0100 examples/ipsec-secgw: add check for unprotected port mask Usage of unprotected port mask without any configured SA inbound, will cause use of uninitialized SA context, so disallow such configuration. Signed-off-by: Volodymyr Fialko Acked-by: Anoob Joseph -- You are receiving this mail because: You are the assignee for the bug.
RE: [DPDK] /lib/eal: fix failed to stop device monitor error
Let's start a talk about this patch. > -Original Message- > From: Thomas Monjalon > Sent: 2022年2月13日 19:30 > To: Wu, WenxuanX > Cc: Yang, Qiming ; Zhang, Qi Z > ; dev@dpdk.org; david.march...@redhat.com; > Harman Kalra > Subject: Re: [DPDK] /lib/eal: fix failed to stop device monitor error > > +Cc Harman, maintainer of interrupt subsystem. > > 11/02/2022 09:41, wenxuanx...@intel.com: > > From: Wenxuan Wu > > > > The ret value in rte_dev_event_monitor_stop stands for whether the > > monitor has been successfully closed ,and should not bind with > > rte_intr_callback_unregister,so once it goes to the right exit point > > of rte_dev_event_monitor, the ret value should be set to 0. > > > > Also ,the refmonitor count has been carefully evaluated ,the value > > change from 1 to 0 ,so there is no potential memory leak failure. > > > > Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event > > monitor") Cc:sta...@intel.com > > > > Signed-off-by: Wenxuan Wu > > --- > > lib/eal/linux/eal_dev.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index > > bde55a3d92..4646e8a550 100644 > > --- a/lib/eal/linux/eal_dev.c > > +++ b/lib/eal/linux/eal_dev.c > > @@ -384,6 +384,7 @@ rte_dev_event_monitor_stop(void) > > close(rte_intr_fd_get(intr_handle)); > > rte_intr_instance_free(intr_handle); > > intr_handle = NULL; > > + ret = 0; > > > > monitor_refcount--; > > > > > > > >
Re: [PATCH v1] net/vhost: clear data of packet mbuf after sending pkts
On Tue, Mar 1, 2022 at 10:02 AM Zhang, Yuying wrote: > > -Original Message- > > From: David Marchand > > Sent: Tuesday, March 1, 2022 4:44 PM > > To: Zhang, Yuying > > Cc: dev ; Maxime Coquelin ; > > Xia, Chenbo ; dpdk stable > > Subject: Re: [PATCH v1] net/vhost: clear data of packet mbuf after sending > > pkts > > > > On Tue, Mar 1, 2022 at 8:29 AM Yuying Zhang wrote: > > > > > > The PMD frees a packet mbuf back into its original mempool after > > > sending a packet. However, old data is not cleaned up which causes > > > error in payload of new packets. This patch clear data of packet mbuf > > > before freeing mbuf. > > > > This patch looks wrong to me. > > What is the actual issue you want to fix? > > eth_vhost_tx() frees the packet mbuf back into its original mempool every > time after a packet sent without clearing the data field. > Then packet transmit function will get bulk directly without reset. New > generated packet contains old data of previous packet. This is wrong. With the proposed patch, if the mbuf refcnt is != 0, you are shooting the data while some other part of the application might be needing it. Plus, there should be no expectation about a mbuf data content when retrieving one from a mempool. The only bytes that are guaranteed to be initialised by the mbuf API are its metadata. If there is an issue somewhere in dpdk where the mbuf data content is expected to be 0 on allocation, please point at it. Or share the full test that failed. -- David Marchand
[PATCH v2] ci: remove outdated default versions for ABI check
The variables REF_GIT_TAG and LIBABIGAIL_VERSION are set in the CI configuration like .travis.yml or .github/workflows/build.yml. The default values are outdated and probably unused. The default values are removed completely to avoid forgetting an update in future. The use of the variables is quoted to make sure a missing value will trigger an appropriate failure. Signed-off-by: Thomas Monjalon Acked-by: Aaron Conole --- .ci/linux-build.sh | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index 67d68535e0..05aa21ec69 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -104,8 +104,6 @@ if [ "$AARCH64" != "true" ] && [ "$PPC64LE" != "true" ]; then fi if [ "$ABI_CHECKS" = "true" ]; then -LIBABIGAIL_VERSION=${LIBABIGAIL_VERSION:-libabigail-1.6} - if [ "$(cat libabigail/VERSION 2>/dev/null)" != "$LIBABIGAIL_VERSION" ]; then rm -rf libabigail # if we change libabigail, invalidate existing abi cache @@ -113,14 +111,13 @@ if [ "$ABI_CHECKS" = "true" ]; then fi if [ ! -d libabigail ]; then -install_libabigail $LIBABIGAIL_VERSION $(pwd)/libabigail +install_libabigail "$LIBABIGAIL_VERSION" $(pwd)/libabigail echo $LIBABIGAIL_VERSION > libabigail/VERSION fi export PATH=$(pwd)/libabigail/bin:$PATH REF_GIT_REPO=${REF_GIT_REPO:-https://dpdk.org/git/dpdk} -REF_GIT_TAG=${REF_GIT_TAG:-v19.11} if [ "$(cat reference/VERSION 2>/dev/null)" != "$REF_GIT_TAG" ]; then rm -rf reference @@ -128,7 +125,7 @@ if [ "$ABI_CHECKS" = "true" ]; then if [ ! -d reference ]; then refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) -git clone --single-branch -b $REF_GIT_TAG $REF_GIT_REPO $refsrcdir +git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir meson $OPTS -Dexamples= $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference ninja -C $refsrcdir/build install -- 2.34.1
Re: [DPDK] /lib/eal: fix failed to stop device monitor error
Hello, The title should start with eal/linux: On Fri, Feb 11, 2022 at 10:01 AM wrote: > > From: Wenxuan Wu > > The ret value in rte_dev_event_monitor_stop stands for whether the > monitor has been successfully closed ,and should not bind with > rte_intr_callback_unregister,so once it goes to the right exit point of > rte_dev_event_monitor, the ret value should be set to 0. > > Also ,the refmonitor count has been carefully evaluated ,the value > change from 1 to 0 ,so there is no potential memory leak failure. Please, fix formatting around ',': a space should be after. Is it a real issue you noticed? Or a theoretical issue based on code review, reported by a static code analysis tool? > > Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event monitor") > Cc:sta...@intel.com sta...@dpdk.org > > Signed-off-by: Wenxuan Wu > --- > lib/eal/linux/eal_dev.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c > index bde55a3d92..4646e8a550 100644 > --- a/lib/eal/linux/eal_dev.c > +++ b/lib/eal/linux/eal_dev.c > @@ -384,6 +384,7 @@ rte_dev_event_monitor_stop(void) > close(rte_intr_fd_get(intr_handle)); > rte_intr_instance_free(intr_handle); > intr_handle = NULL; > + ret = 0; > > monitor_refcount--; > This change looks ok to me. Harman, Long, wdyt? -- David Marchand
[PATCH v2] ci: remove redundant drivers enabling
No need to explicitly enable drivers bus/vdev and mempool/ring. bus/vdev is always enabled since commit 2e33309ebe03 ("config: enable/disable drivers in Arm builds") mempool/ring is always enabled since commit 81c2337e044d ("build: make ring mempool driver mandatory") The driver net/null is kept to allow running test-null.sh. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson --- v2: precise net/null justification in commit log --- .ci/linux-build.sh| 2 +- devtools/test-meson-builds.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index 05aa21ec69..69940dec8b 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -89,7 +89,7 @@ OPTS="$OPTS --default-library=$DEF_LIB" OPTS="$OPTS --buildtype=debugoptimized" OPTS="$OPTS -Dcheck_includes=true" if [ "$MINI" = "true" ]; then -OPTS="$OPTS -Denable_drivers=bus/vdev,mempool/ring,net/null" +OPTS="$OPTS -Denable_drivers=net/null" OPTS="$OPTS -Ddisable_libs=*" fi meson build --werror $OPTS diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh index c07fd16fdc..a653b253cb 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -221,7 +221,7 @@ for c in gcc clang ; do done build build-mini cc skipABI $use_shared -Ddisable_libs=* \ - -Denable_drivers=bus/vdev,mempool/ring,net/null + -Denable_drivers=net/null # test compilation with minimal x86 instruction set # Set the install path for libraries to "lib" explicitly to prevent problems -- 2.34.1
Re: [PATCH v2] ci: remove outdated default versions for ABI check
On Tue, Mar 1, 2022 at 10:57 AM Thomas Monjalon wrote: > > The variables REF_GIT_TAG and LIBABIGAIL_VERSION are set > in the CI configuration like .travis.yml or .github/workflows/build.yml. > The default values are outdated and probably unused. > > The default values are removed completely > to avoid forgetting an update in future. > > The use of the variables is quoted to make sure > a missing value will trigger an appropriate failure. > > Signed-off-by: Thomas Monjalon > Acked-by: Aaron Conole Acked-by: David Marchand -- David Marchand
[PATCH] net/mlx5: fix MPLS/GRE Verbs spec ordering
When using Verbs flow engine to create flows, GRE Verbs spec was put at the end of specs list. This created problems for flows matching MPLSoGRE packets. In generated specs list MPLS spec was put before GRE spec, but Verbs API requires that MPLS spec must be put in its exact location in protocol stack. This patch fixes this behavior. Space for GRE Verbs spec is reserved at its exact location. MPLS Verbs is inserted at its exact location as well. GRE spec is filled after all flow items are parsed. Fixes: 985b479267aa ("net/mlx5: fix GRE protocol type translation for Verbs") Cc: getel...@nvidia.com Cc: sta...@dpdk.org Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_verbs.c | 48 +++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index f08aa7a770..ad960b193a 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -882,13 +882,48 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, } } +/** + * Reserve space for GRE spec in spec buffer. + * + * @param[in,out] dev_flow + * Pointer to dev_flow structure. + * + * @return + * Pointer to reserved space in spec buffer. + */ +static uint8_t * +flow_verbs_reserve_gre(struct mlx5_flow *dev_flow) +{ + uint8_t *buffer; + struct mlx5_flow_verbs_workspace *verbs = &dev_flow->verbs; +#ifndef HAVE_IBV_DEVICE_MPLS_SUPPORT + unsigned int size = sizeof(struct ibv_flow_spec_tunnel); + struct ibv_flow_spec_tunnel tunnel = { + .type = IBV_FLOW_SPEC_VXLAN_TUNNEL, + .size = size, + }; +#else + unsigned int size = sizeof(struct ibv_flow_spec_gre); + struct ibv_flow_spec_gre tunnel = { + .type = IBV_FLOW_SPEC_GRE, + .size = size, + }; +#endif + + buffer = verbs->specs + verbs->size; + flow_verbs_spec_add(verbs, &tunnel, size); + return buffer; +} + /** * Convert the @p item into a Verbs specification. This function assumes that - * the input is valid and that there is space to insert the requested item - * into the flow. + * the input is valid and that Verbs specification will be placed in + * the pre-reserved space. * * @param[in, out] dev_flow * Pointer to dev_flow structure. + * @param[in, out] gre_spec + * Pointer to space reserved for GRE spec. * @param[in] item * Item specification. * @param[in] item_flags @@ -896,6 +931,7 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, */ static void flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, + uint8_t *gre_spec, const struct rte_flow_item *item __rte_unused, uint64_t item_flags) { @@ -949,7 +985,8 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, flow_verbs_item_gre_ip_protocol_update(&verbs->attr, IBV_FLOW_SPEC_IPV6, IPPROTO_GRE); - flow_verbs_spec_add(verbs, &tunnel, size); + MLX5_ASSERT(gre_spec); + memcpy(gre_spec, &tunnel, size); } /** @@ -1679,6 +1716,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace(); struct mlx5_flow_rss_desc *rss_desc; + uint8_t *gre_spec = NULL; MLX5_ASSERT(wks); rss_desc = &wks->rss_desc; @@ -1816,6 +1854,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, item_flags |= MLX5_FLOW_LAYER_VXLAN_GPE; break; case RTE_FLOW_ITEM_TYPE_GRE: + gre_spec = flow_verbs_reserve_gre(dev_flow); subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc); item_flags |= MLX5_FLOW_LAYER_GRE; break; @@ -1832,7 +1871,8 @@ flow_verbs_translate(struct rte_eth_dev *dev, } } if (item_flags & MLX5_FLOW_LAYER_GRE) - flow_verbs_translate_item_gre(dev_flow, items, item_flags); + flow_verbs_translate_item_gre(dev_flow, gre_spec, + items, item_flags); dev_flow->handle->layers = item_flags; /* Other members of attr will be ignored. */ dev_flow->verbs.attr.priority = -- 2.25.1
Re: [PATCH 4/6] net/hns3: fix the time waiting for PF reset completion
On 3/1/2022 6:32 AM, Min Hu (Connor) wrote: Hi, Ferruh, 在 2022/3/1 1:09, Ferruh Yigit 写道: On 2/28/2022 3:21 AM, Min Hu (Connor) wrote: @@ -1895,12 +1896,14 @@ hns3vf_wait_hardware_ready(struct hns3_adapter *hns) return 0; wait_data->check_completion = NULL; - wait_data->interval = 1 * MSEC_PER_SEC * USEC_PER_MSEC; + wait_data->interval = + HNS3_WAIT_PF_RESET_READY_TIME * MSEC_PER_SEC * USEC_PER_MSEC; Can you please fix the syntax? I guess all can fit into single line... If not so, the code in single line will exceed 80 characters. Right, it doesn't fit into single line, still it can be formatted better. wait_data->interval = HNS3_WAIT_PF_RESET_READY_TIME * MSEC_PER_SEC * USEC_PER_MSEC;
RE: [EXT] [PATCH v3 1/1] ethdev: mtr: support input color selection
Corresponding driver implementation is available at http://patches.dpdk.org/project/dpdk/patch/20220301090056.1042866-1-sk...@marvell.com/. Also CLI is added to testpmd for below API and available at http://patches.dpdk.org/project/dpdk/patch/20220301090056.1042866-3-sk...@marvell.com/ > -Original Message- > From: sk...@marvell.com > Sent: Tuesday, March 1, 2022 2:28 PM > To: Cristian Dumitrescu ; Thomas Monjalon > ; Ferruh Yigit ; Andrew > Rybchenko ; Ray Kinsella > > Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran > Subject: [EXT] [PATCH v3 1/1] ethdev: mtr: support input color selection > > External Email > > -- > From: Jerin Jacob > > Currently, meter object supports only DSCP based on input color table, The > patch enhance that to support VLAN based input color table, color table > based on inner field for the tunnel use case, and support for fallback color > per meter if packet based on a different field. > > All of the above features are exposed through capability and added > additional capability to specify the implementation supports more than one > input color table per ethdev port > > Suggested-by: Cristian Dumitrescu > Signed-off-by: Jerin Jacob > --- > v3..v2: > - Fix input color flags as a bitmask > - Add definitions for newly added API > > v2..v1: > > - Fix seperate typo > > v1..RFC: > > Address the review comments by Cristian at > https://urldefense.proofpoint.com/v2/url?u=https- > 3A__patches.dpdk.org_project_dpdk_patch_20210820082401.3778736-2D1- > 2Djerinj- > 40marvell.com_&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=dXeXaAMkP5 > COgn1zxHMyaF1_d9IIuq6vHQO6NrIPjaE&m=bvYbz6aP4xuLPRt2TIk1o99kWXj > u-rRDvz3qXnCVbz_TER0zcRDqjQxJSm3SnLXM&s=mVeBbQWjsvJLRm-dcB4h- > KmAj3tGi4WT0E9IvsuNT2g&e= > > - Moved to v22.07 release > - Updated rte_mtr_input_color_method to support all VLAN, DSCP, Inner > cases > - Added input_color_method > - Removed union between vlan_table and dscp_table > - Kept VLAN instead of PCP as HW coloring based on DEI(1bit), PCP(3 bits) > > What is missing: > - 22.07 release notes update > > .../traffic_metering_and_policing.rst | 28 +++ > lib/ethdev/rte_mtr.c | 12 ++ > lib/ethdev/rte_mtr.h | 164 +- > lib/ethdev/rte_mtr_driver.h | 9 + > lib/ethdev/version.map| 3 + > 5 files changed, 214 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst > b/doc/guides/prog_guide/traffic_metering_and_policing.rst > index ceb5a96488..59ebd361ba 100644 > --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst > +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst > @@ -21,6 +21,7 @@ The main features are: > * Policer actions (per meter output color): recolor, drop > * Statistics (per policer output color) > * Chaining multiple meter objects > +* Packet content based input color selection > > Configuration steps > --- > @@ -105,3 +106,30 @@ traffic meter and policing library. > * Adding one (or multiple) actions of the type > ``RTE_FLOW_ACTION_TYPE_METER`` > to the list of meter actions (``struct > rte_mtr_meter_policy_params::actions``) > specified per color as show in :numref:`figure_rte_mtr_chaining`. > + > +Packet content based input color selection > +-- > + > +The API supports selecting the input color based on the packet content. > +Following is the API usage model for the same. > + > +#. Probe the input color selection device capabilities using following > + parameter using ``rte_mtr_capabilities_get()`` API > + ``struct rte_mtr_capabilities::methods_mask`` and > + ``struct rte_mtr_capabilitie::separate_input_color_table_per_port`` > + > +#. When creating the meter object using ``rte_mtr_create()``, configure > + relevant input color selection parameters such as > + > + * Select the input color method ``struct > + rte_mtr_params::input_color_method`` > + > + * Fill the tables ``struct rte_mtr_params::dscp_table``, > + ``struct rte_mtr_params::dscp_table`` based on input color > + selected > + > + * Update the ``struct rte_mtr_params::default_input_color`` to determine > + the default input color in case the input packet does not match > + the input color method > + > + * If needed, update the input color table at runtime using > + ``rte_mtr_meter_vlan_table_update()`` and > ``rte_mtr_meter_dscp_table_update()`` > + APIs. > diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c index > e49fcf271c..a0cb91e0b1 100644 > --- a/lib/ethdev/rte_mtr.c > +++ b/lib/ethdev/rte_mtr.c > @@ -207,6 +207,18 @@ rte_mtr_meter_dscp_table_update(uint16_t > port_id, > mtr_id, dscp_table, error); > } > > +/** MTR object meter VLAN table update */ int > +rte_mtr_meter_vlan_table_update(uint16_t port_id, > +
RE: [dpdk-dev] crypto/qat: fix process type handling
Hi > This is not supposed to happen after rte_eal_init() is called. > > I have a doubt on Windows init because I can't see where > rte_config.process_type is initialised. > Are you seeing this issue on Windows? > > In any case, the commitlog needs more explanation. > > > -- > David Marchand The process type should be either Primary or Secondary after the rte_eal_init(), This check mainly fix of Memory corruptions issue reported by Coverity. I will update the commitlog of more info Regards Kai
[PATCH] bus/pci: enhance driver pointer documentation
Setting driver pointer before mapping required for write combining support since commit 4a928ef9f611 ("bus/pci: enable write combining during mapping"). Move comments that got separated after different changes. Also change the condition relying on dev->driver itself. Signed-off-by: David Marchand --- drivers/bus/pci/pci_common.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index def372b67e..37ab879779 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -207,11 +207,6 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->driver.name); - /* -* reference driver structure -* This needs to be before rte_pci_map_device(), as it enables to use -* driver flags for adjusting configuration. -*/ if (!already_probed) { enum rte_iova_mode dev_iova_mode; enum rte_iova_mode iova_mode; @@ -247,9 +242,13 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, return -ENOMEM; } + /* +* Reference driver structure. +* This needs to be before rte_pci_map_device(), as it enables +* to use driver flags for adjusting configuration. +*/ dev->driver = dr; - - if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { + if (dev->driver->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { ret = rte_pci_map_device(dev); if (ret != 0) { dev->driver = NULL; -- 2.23.0
RE: release candidate 22.03-rc2
> -Original Message- > From: Thomas Monjalon > Sent: Monday, February 28, 2022 5:02 AM > To: annou...@dpdk.org > Subject: release candidate 22.03-rc2 > > A new DPDK release candidate is ready for testing: > https://git.dpdk.org/dpdk/tag/?id=v22.03-rc2 > > There are 306 new patches in this snapshot. > > Release notes: > https://doc.dpdk.org/guides/rel_notes/release_22_03.html > > Highlights of 22.03-rc2: > - ethdev flow API for templates and async operations > - Marvell GPIO driver for CNXK > > The driver features should be frozen now. > Please test and report issues on bugs.dpdk.org. > > DPDK 22.03-rc3 is expected in one week. > > Thank you everyone > Update some new bugzilla bugs for 22.03-rc2, please help to fix. Thanks all. https://bugs.dpdk.org/show_bug.cgi?id=939 [dpdk 22.03-rc2] drivers/net/cnxk/cnxk_ethdev_mtr meson build failed with cflag parm optimization=1 on Ubuntu20.04 with GCC10.3 First bad commit id: commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 (HEAD) Author: Rakesh Kudurumalla Date: Wed Feb 23 15:25:40 2022 +0530 net/cnxk: fix build with GCC 12 Resolve following compilation error with gcc 12 version. error: storing the address of local variable message in *error.message Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") Cc: sta...@dpdk.org Reported-by: Ferruh Yigit Signed-off-by: Rakesh Kudurumalla Acked-by: Jerin Jacob https://bugs.dpdk.org/show_bug.cgi?id=940 [dpdk 22.03-rc2] drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_nix_inl_dev.c.o: meson build failed with -Dmax_ethports=1024 parameter First bad commit id: commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 (HEAD) Author: Rakesh Kudurumalla Date: Wed Feb 23 15:25:40 2022 +0530 net/cnxk: fix build with GCC 12 Resolve following compilation error with gcc 12 version. error: storing the address of local variable message in *error.message Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") Cc: sta...@dpdk.org Reported-by: Ferruh Yigit Signed-off-by: Rakesh Kudurumalla Acked-by: Jerin Jacob https://bugs.dpdk.org/show_bug.cgi?id=941 [dpdk-22.03] core dump when create fdir rule with bad arguments First bad commit id: 04cc665fab38e2a382f6886e57c97b78e92cea46 is the first bad commit commit 04cc665fab38e2a382f6886e57c97b78e92cea46 Author: Alexander Kozyrev Date: Wed Feb 23 05:02:35 2022 +0200 app/testpmd: add flow template management Add testpmd support for the rte_flow_pattern_template and rte_flow_actions_template APIs. Provide the command line interface for the template creation/destruction. Usage example: testpmd> flow pattern_template 0 create pattern_template_id 2 template eth dst is 00:16:3e:31:15:c3 / end testpmd> flow actions_template 0 create actions_template_id 4 template drop / end mask drop / end testpmd> flow actions_template 0 destroy actions_template 4 testpmd> flow pattern_template 0 destroy pattern_template 2 Signed-off-by: Alexander Kozyrev Acked-by: Ori Kam https://bugs.dpdk.org/show_bug.cgi?id=944 [dpdk 22.03-rc2] inline_ipsec/test_Ipsec_Encryption_Rss: run dpdk-ipsec-secgw with assigned parameter fail First bad commit id: 04cc665fab38e2a382f6886e57c97b78e92cea46 is the first bad commit commit 04cc665fab38e2a382f6886e57c97b78e92cea46 Author: Alexander Kozyrev Date: Wed Feb 23 05:02:35 2022 +0200 app/testpmd: add flow template management Add testpmd support for the rte_flow_pattern_template and rte_flow_actions_template APIs. Provide the command line interface for the template creation/destruction. Usage example: testpmd> flow pattern_template 0 create pattern_template_id 2 template eth dst is 00:16:3e:31:15:c3 / end testpmd> flow actions_template 0 create actions_template_id 4 template drop / end mask drop / end testpmd> flow actions_template 0 destroy actions_template 4 testpmd> flow pattern_template 0 destroy pattern_template 2 Signed-off-by: Alexander Kozyrev Acked-by: Ori Kam
Re: [PATCH v2] ci: remove redundant drivers enabling
On Tue, Mar 1, 2022 at 11:05 AM Thomas Monjalon wrote: > > No need to explicitly enable drivers bus/vdev and mempool/ring. > > bus/vdev is always enabled since > commit 2e33309ebe03 ("config: enable/disable drivers in Arm builds") > > mempool/ring is always enabled since > commit 81c2337e044d ("build: make ring mempool driver mandatory") > > The driver net/null is kept to allow running test-null.sh. > > Signed-off-by: Thomas Monjalon > Acked-by: Bruce Richardson Acked-by: David Marchand -- David Marchand
[PATCH v1 2/2] gpudev: use page_size in comm_list creation
From: Elena Agostini Memory allocated for CPU mapping the status flag in the communication list should be aligned to the GPU page size. Signed-off-by: Elena Agostini --- lib/gpudev/gpudev.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c index fb1bee344c..56033f4a5f 100644 --- a/lib/gpudev/gpudev.c +++ b/lib/gpudev/gpudev.c @@ -820,6 +820,7 @@ rte_gpu_comm_create_list(uint16_t dev_id, uint32_t idx_l; int ret; struct rte_gpu *dev; + struct rte_gpu_info info; if (num_comm_items == 0) { rte_errno = EINVAL; @@ -833,6 +834,12 @@ rte_gpu_comm_create_list(uint16_t dev_id, return NULL; } + ret = rte_gpu_info_get(dev_id, &info); + if (ret < 0) { + rte_errno = ENODEV; + return NULL; + } + comm_list = rte_zmalloc(NULL, sizeof(struct rte_gpu_comm_list) * num_comm_items, 0); if (comm_list == NULL) { @@ -855,7 +862,7 @@ rte_gpu_comm_create_list(uint16_t dev_id, */ comm_list[0].status_d = rte_gpu_mem_alloc(dev_id, sizeof(enum rte_gpu_comm_list_status) * num_comm_items, - rte_mem_page_size()); + info.page_size); if (ret < 0) { rte_errno = ENOMEM; return NULL; -- 2.17.1
[PATCH v1 1/2] gpudev: add GPU page_size to info
From: Elena Agostini Page alignment on the GPU can be different from the CPU page alignment. Signed-off-by: Elena Agostini --- drivers/gpu/cuda/cuda.c | 4 lib/gpudev/rte_gpudev.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c index efb5d146f6..2f8c4684ce 100644 --- a/drivers/gpu/cuda/cuda.c +++ b/drivers/gpu/cuda/cuda.c @@ -523,6 +523,8 @@ cuda_dev_info_get(struct rte_gpu *dev, struct rte_gpu_info *info) } dev->mpshared->info.total_memory = parent_info.total_memory; + dev->mpshared->info.page_size = parent_info.page_size; + /* * GPU Device private info */ @@ -1173,6 +1175,8 @@ cuda_gpu_probe(__rte_unused struct rte_pci_driver *pci_drv, struct rte_pci_devic return -rte_errno; } + dev->mpshared->info.page_size = (size_t)GPU_PAGE_SIZE; + /* * GPU Device private info */ diff --git a/lib/gpudev/rte_gpudev.h b/lib/gpudev/rte_gpudev.h index 7e2401a4b7..971aeacfff 100644 --- a/lib/gpudev/rte_gpudev.h +++ b/lib/gpudev/rte_gpudev.h @@ -61,6 +61,8 @@ struct rte_gpu_info { size_t total_memory; /* Local NUMA memory ID. -1 if unknown. */ int16_t numa_node; + /* Get GPU memory page size. */ + size_t page_size; }; /** Flags passed in notification callback. */ -- 2.17.1
RE: [PATCH v4] net/ice: improve performance of RX timestamp offload
> -Original Message- > From: Wu, Wenjun1 > Sent: Monday, February 28, 2022 3:36 PM > To: dev@dpdk.org; Zhang, Qi Z ; Yang, Qiming > > Cc: Van Haaren, Harry ; Su, Simei > ; Wu, Wenjun1 > Subject: [PATCH v4] net/ice: improve performance of RX timestamp offload > > Previously, each time a burst of packets is received, SW reads HW register > and assembles it and the timestamp from descriptor together to get the > complete 64 bits timestamp. > > This patch optimizes the algorithm. The SW only needs to check the > monotonicity of the low 32bits timestamp to avoid crossing borders. > Each time before SW receives a burst of packets, it should check the time > difference between current time and last update time to avoid the low 32 > bits timestamp cycling twice. Overall, the patch looks good to me and we can cc-stable for LTS but I'd like to defer this to the next release as we are close to the release date and don't want to take the risk to merge complex changes at this moment. Regards Qi > > Signed-off-by: Wenjun Wu > > --- > v4: rework initialization behavior > v3: add missing conditional compilation > v2: add conditional compilation > --- > drivers/net/ice/ice_ethdev.h | 3 + > drivers/net/ice/ice_rxtx.c | 118 +-- > 2 files changed, 88 insertions(+), 33 deletions(-) > > diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index > 3ed580d438..6778941d7d 100644 > --- a/drivers/net/ice/ice_ethdev.h > +++ b/drivers/net/ice/ice_ethdev.h > @@ -554,6 +554,9 @@ struct ice_adapter { > struct rte_timecounter tx_tstamp_tc; > bool ptp_ena; > uint64_t time_hw; > + uint32_t hw_time_high; /* high 32 bits of timestamp */ > + uint32_t hw_time_low; /* low 32 bits of timestamp */ > + uint64_t hw_time_update; /* SW time of HW record updating */ > struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS]; > struct ice_rss_prof_info rss_prof_info[ICE_MAX_PTGS]; > /* True if DCF state of the associated PF is on */ diff --git > a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index > 4f218bcd0d..4b0bcd4863 100644 > --- a/drivers/net/ice/ice_rxtx.c > +++ b/drivers/net/ice/ice_rxtx.c > @@ -1574,9 +1574,10 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) > uint64_t pkt_flags = 0; > uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; #ifndef > RTE_LIBRTE_ICE_16BYTE_RX_DESC > + bool is_tsinit = false; > + uint64_t ts_ns; > struct ice_vsi *vsi = rxq->vsi; > struct ice_hw *hw = ICE_VSI_TO_HW(vsi); > - uint64_t ts_ns; > struct ice_adapter *ad = rxq->vsi->adapter; #endif > rxdp = &rxq->rx_ring[rxq->rx_tail]; > @@ -1588,8 +1589,14 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) > if (!(stat_err0 & (1 << ICE_RX_FLEX_DESC_STATUS0_DD_S))) > return 0; > > - if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) > - rxq->hw_register_set = 1; > +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC > + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) { > + uint64_t sw_cur_time = rte_get_timer_cycles() / > (rte_get_timer_hz() / > +1000); > + > + if (unlikely(sw_cur_time - ad->hw_time_update > 4)) > + is_tsinit = 1; > + } > +#endif > > /** >* Scan LOOK_AHEAD descriptors at a time to determine which @@ - > 1625,14 +1632,26 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) > rxd_to_pkt_fields_ops[rxq->rxdid](rxq, mb, &rxdp[j]); > #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC > if (ice_timestamp_dynflag > 0) { > - ts_ns = ice_tstamp_convert_32b_64b(hw, ad, > - rxq->hw_register_set, > - > rte_le_to_cpu_32(rxdp[j].wb.flex_ts.ts_high)); > - rxq->hw_register_set = 0; > + rxq->time_high = > + rte_le_to_cpu_32(rxdp[j].wb.flex_ts.ts_high); > + if (unlikely(is_tsinit)) { > + ts_ns = > ice_tstamp_convert_32b_64b(hw, ad, 1, > +rxq- > >time_high); > + ad->hw_time_low = (uint32_t)ts_ns; > + ad->hw_time_high = > (uint32_t)(ts_ns >> 32); > + is_tsinit = false; > + } else { > + if (rxq->time_high < ad- > >hw_time_low) > + ad->hw_time_high += 1; > + ts_ns = (uint64_t)ad->hw_time_high > << 32 | rxq->time_high; > + ad->hw_time_low = rxq->time_high; > + } > + ad->hw_time_update = rte_get_timer_cycles() > / > +
[PATCH v2] common/mlx5: fix missing default devargs initialization
Device arguments list is provided along with its identifier as part of EAL arguments. The arguments specified in the list are taken from it, and the rest is initialized to the default values. When no list is provided at all, all arguments should have been initialized to their default values. However, they are mistakenly initialized to zero which may be a valid value for some. This patch initializes the default values before checking whether arguments have been specified. Fixes: a729d2f093e9 ("common/mlx5: refactor devargs management") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- v2: updating Fixes reference hash. drivers/common/mlx5/mlx5_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 94c303ce81..ef1604d223 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -326,8 +326,6 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist, }; int ret = 0; - if (mkvlist == NULL) - return 0; /* Set defaults. */ config->mr_ext_memseg_en = 1; config->mr_mempool_reg_en = 1; @@ -335,6 +333,8 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist, config->dbnc = MLX5_ARG_UNSET; config->device_fd = MLX5_ARG_UNSET; config->pd_handle = MLX5_ARG_UNSET; + if (mkvlist == NULL) + return 0; /* Process common parameters. */ ret = mlx5_kvargs_process(mkvlist, params, mlx5_common_args_check_handler, config); -- 2.25.1
RE: [PATCH v4 1/3] net/ixgbe: Fix ixgbe_is_sfp() to return valid result for X550EM_a devs
> -Original Message- > From: Wang, Haiyue > Sent: Tuesday, March 1, 2022 1:57 PM > To: Daly, Jeff ; dev@dpdk.org > Cc: Stephen Douthit ; sta...@dpdk.org; Lu, > Wenzhuo > Subject: RE: [PATCH v4 1/3] net/ixgbe: Fix ixgbe_is_sfp() to return valid > result > for X550EM_a devs > > > -Original Message- > > From: Jeff Daly > > Sent: Monday, February 28, 2022 23:30 > > To: dev@dpdk.org > > Cc: Stephen Douthit ; sta...@dpdk.org; > Wang, > > Haiyue ; Lu, Wenzhuo > > Subject: [PATCH v4 1/3] net/ixgbe: Fix ixgbe_is_sfp() to return valid > > result for X550EM_a devs > > > > From: Stephen Douthit > > > > Currently all X500EM* MAC types fallthrough to the default case and > > get reported as non-SFP regardless of media type, which isn't correct. > > > > Fixes: 0790adeb567 ("ixgbe/base: support X550em_a device") > > Cc: sta...@dpdk.org > > > > Signed-off-by: Stephen Douthit > > Signed-off-by: Jeff Daly > > --- > > drivers/net/ixgbe/ixgbe_ethdev.c | 14 ++ > > 1 file changed, 14 insertions(+) > > > > Acked-by: Haiyue Wang Applied to dpdk-next-net-intel after renaming the title to "fix FSP check for X550EM devices" to fix check-git-log error. Thanks Qi > > > -- > > 2.25.1
RE: [PATCH v2] net/iavf: add NAT-T / UDP encapsulation support
> -Original Message- > From: Nicolau, Radu > Sent: Monday, February 28, 2022 11:00 PM > To: Wu, Jingjing ; Xing, Beilei > Cc: dev@dpdk.org; Zhang, Qi Z ; Yigit, Ferruh > ; Nicolau, Radu ; > sta...@dpdk.org > Subject: [PATCH v2] net/iavf: add NAT-T / UDP encapsulation support > > Add support for NAT-T / UDP encapsulated ESP. > This fixes the inline crypto feature for iAVF which will not function properly > without setting the UDP encapsulation options. > > Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") > Cc: sta...@dpdk.org > > Signed-off-by: Radu Nicolau Reviewed-by: Qi Zhang Applied to dpdk-next-net-intel. Thanks Qi
RE: [PATCH v1] net/iavf: fix function pointer in multi-process
> -Original Message- > From: Steve Yang > Sent: Monday, February 28, 2022 5:49 PM > To: dev@dpdk.org > Cc: Wu, Jingjing ; Xing, Beilei > ; Yang, Qiming ; Yang, > SteveX ; sta...@dpdk.org > Subject: [PATCH v1] net/iavf: fix function pointer in multi-process > > This patch uses the index value to call the function, instead of the function > pointer assignment to save the selection of Receive Flex Descriptor profile > ID. > > Otherwise the secondary process will run with wrong function address from > primary process. > > Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction") > Cc: sta...@dpdk.org > > Signed-off-by: Steve Yang Acked-by: Qi Zhang Applied to dpdk-next-net-intel. Thanks Qi
[PATCH] gpu/cuda: missing slash in libcuda.so path
From: Elena Agostini Signed-off-by: Elena Agostini --- drivers/gpu/cuda/cuda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c index 2f8c4684ce..8505d39d64 100644 --- a/drivers/gpu/cuda/cuda.c +++ b/drivers/gpu/cuda/cuda.c @@ -169,7 +169,7 @@ cuda_loader(void) if (getenv("CUDA_PATH_L") == NULL) snprintf(cuda_path, 1024, "%s", "libcuda.so"); else - snprintf(cuda_path, 1024, "%s%s", getenv("CUDA_PATH_L"), "libcuda.so"); + snprintf(cuda_path, 1024, "%s/%s", getenv("CUDA_PATH_L"), "libcuda.so"); cudalib = dlopen(cuda_path, RTLD_LAZY); if (cudalib == NULL) { -- 2.17.1
[PATCH] app/testpmd: register metadata dynfield on modify field
This patch adds implicit registration of metadata dynamic field and flag whenever a modify_field action with META as source and/or destination field is used. Signed-off-by: Dariusz Sosnowski Reviewed-by: Viacheslav Ovsiienko --- app/test-pmd/cmdline_flow.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 4f7a9f17f9..dd38a635b0 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -8347,6 +8347,7 @@ parse_vc_modify_field_id(struct context *ctx, const struct token *token, { struct rte_flow_action_modify_field *action_modify_field; unsigned int i; + int ret; (void)token; (void)buf; @@ -8362,9 +8363,15 @@ parse_vc_modify_field_id(struct context *ctx, const struct token *token, if (!ctx->object) return len; action_modify_field = ctx->object; - if (ctx->curr == ACTION_MODIFY_FIELD_DST_TYPE_VALUE) + if (ctx->curr == ACTION_MODIFY_FIELD_DST_TYPE_VALUE) { action_modify_field->dst.field = (enum rte_flow_field_id)i; - else + if (action_modify_field->dst.field == RTE_FLOW_FIELD_META) { + ret = rte_flow_dynf_metadata_register(); + if (ret < 0) + return -1; + } + + } else action_modify_field->src.field = (enum rte_flow_field_id)i; return len; } -- 2.25.1
RE: [PATCH] net/iavf: remove extra check in iavf vector Tx
> -Original Message- > From: Kathleen Capella > Sent: Wednesday, February 23, 2022 6:48 AM > To: Richardson, Bruce ; Ananyev, Konstantin > ; Wu, Jingjing ; > Xing, Beilei > Cc: dev@dpdk.org; n...@arm.com; honnappa.nagaraha...@arm.com; Kathleen > Capella > Subject: [PATCH] net/iavf: remove extra check in iavf vector Tx > remove "iavf" in the title. > In the vector Tx path, the function iavf_xmit_pkts_vec_xxx compares nb_pkts > and the txq->rs_thresh and passes the minimum of these as an argument to > iavf_xmit_fixed_burst_vec_xxx. Inside iavf_xmit_fixed_burst_vec_xxx, the > same check is performed again. This patch removes the redundant check > from the iavf_xmit_fixed_burst_vec_xxx function. > > Signed-off-by: Kathleen Capella > Reviewed-by: Honnappa Nagarahalli Acked-by: Qi Zhang Applied to dpdk-next-net-intel. Thanks Qi
[PATCH v2 0/3] net/mlx5: fix link state detection
This patchset fixes two related issues: * In rare occasions with any HW link state change to UP was missed. * If a port was DOWN before startup, its netdev would come UP, but appear DOWN in DPDK (especially probable with ConnectX-4). v2: fix not detecting the link up when it was up before the app start. Dmitry Kozlyuk (3): common/mlx5: add Netlink event helpers net/mlx5: fix link status change detection net/mlx5: fix initial link status detection drivers/common/mlx5/linux/mlx5_common_os.c | 2 +- drivers/common/mlx5/linux/mlx5_nl.c| 102 - drivers/common/mlx5/linux/mlx5_nl.h| 8 +- drivers/common/mlx5/version.map| 2 + drivers/net/mlx5/linux/mlx5_ethdev_os.c| 63 ++--- drivers/net/mlx5/linux/mlx5_os.c | 74 +-- drivers/net/mlx5/linux/mlx5_vlan_os.c | 2 +- drivers/net/mlx5/mlx5.c| 1 + drivers/net/mlx5/mlx5.h| 3 + drivers/net/mlx5/mlx5_trigger.c| 12 ++- 10 files changed, 241 insertions(+), 28 deletions(-) -- 2.25.1
[PATCH v2 1/3] common/mlx5: add Netlink event helpers
Introduce mlx5_nl_read_events() to read Netlink events (technically, messages) from a socket that was configured to listen for them via a new mlx5_nl_init() parameter. Add mlx5_nl_parse_link_status_update() helper to extract information from link-related events. This patch is a shared base for later fixes. Cc: sta...@dpdk.org Signed-off-by: Dmitry Kozlyuk Reviewed-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/mlx5_common_os.c | 2 +- drivers/common/mlx5/linux/mlx5_nl.c| 102 - drivers/common/mlx5/linux/mlx5_nl.h| 8 +- drivers/common/mlx5/version.map| 2 + drivers/net/mlx5/linux/mlx5_os.c | 8 +- drivers/net/mlx5/linux/mlx5_vlan_os.c | 2 +- 6 files changed, 116 insertions(+), 8 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index a3c25638da..030ceb561f 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -590,7 +590,7 @@ mlx5_os_get_ibv_device(const struct rte_pci_addr *addr) static int mlx5_nl_roce_disable(const char *addr) { - int nlsk_fd = mlx5_nl_init(NETLINK_GENERIC); + int nlsk_fd = mlx5_nl_init(NETLINK_GENERIC, 0); int devlink_id; int enable; int ret; diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index fd4c2d2625..5d04857b38 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -185,19 +185,22 @@ uint32_t atomic_sn; * * @param protocol * Netlink protocol (e.g. NETLINK_ROUTE, NETLINK_RDMA). + * @param groups + * Groups to listen (e.g. RTMGRP_LINK), can be 0. * * @return * A file descriptor on success, a negative errno value otherwise and * rte_errno is set. */ int -mlx5_nl_init(int protocol) +mlx5_nl_init(int protocol, int groups) { int fd; int buf_size; socklen_t opt_size; struct sockaddr_nl local = { .nl_family = AF_NETLINK, + .nl_groups = groups, }; int ret; @@ -1862,3 +1865,100 @@ mlx5_nl_enable_roce_set(int nlsk_fd, int family_id, const char *pci_addr, /* Now, need to reload the driver. */ return mlx5_nl_driver_reload(nlsk_fd, family_id, pci_addr); } + +/** + * Try to parse a Netlink message as a link status update. + * + * @param hdr + * Netlink message header. + * @param[out] ifindex + * Index of the updated interface. + * + * @return + * 0 on success, negative on failure. + */ +int +mlx5_nl_parse_link_status_update(struct nlmsghdr *hdr, uint32_t *ifindex) +{ + struct ifinfomsg *info; + + switch (hdr->nlmsg_type) { + case RTM_NEWLINK: + case RTM_DELLINK: + case RTM_GETLINK: + case RTM_SETLINK: + info = NLMSG_DATA(hdr); + *ifindex = info->ifi_index; + return 0; + } + return -1; +} + +/** + * Read pending events from a Netlink socket. + * + * @param nlsk_fd + * Netlink socket. + * @param cb + * Callback invoked for each of the events. + * @param cb_arg + * User data for the callback. + * + * @return + * 0 on success, including the case when there are no events. + * Negative on failure and rte_errno is set. + */ +int +mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg) +{ + char buf[8192]; + struct sockaddr_nl addr; + struct iovec iov = { + .iov_base = buf, + .iov_len = sizeof(buf), + }; + struct msghdr msg = { + .msg_name = &addr, + .msg_namelen = sizeof(addr), + .msg_iov = &iov, + .msg_iovlen = 1, + }; + struct nlmsghdr *hdr; + ssize_t size; + + while (1) { + size = recvmsg(nlsk_fd, &msg, MSG_DONTWAIT); + if (size < 0) { + if (errno == EAGAIN) + return 0; + if (errno == EINTR) + continue; + DRV_LOG(DEBUG, "Failed to receive netlink message: %s", + strerror(errno)); + rte_errno = errno; + return -rte_errno; + } + hdr = (struct nlmsghdr *)buf; + while (size >= (ssize_t)sizeof(*hdr)) { + ssize_t msg_len = hdr->nlmsg_len; + ssize_t data_len = msg_len - sizeof(*hdr); + ssize_t aligned_len; + + if (data_len < 0) { + DRV_LOG(DEBUG, "Netlink message too short"); + rte_errno = EINVAL; + return -rte_errno; + } + aligned_len = NLMSG_ALIGN(msg_len); + if (aligned_len > size) { +
[PATCH v2 2/3] net/mlx5: fix link status change detection
Sometimes net/mlx5 devices did not detect link status change to "up". Each shared device was monitoring IBV_EVENT_PORT_{ACTIVE,ERR} and queried the link status upon receiving the event. IBV_EVENT_PORT_ACTIVE is delivered when the logical link status (UP flag) is set, but the physical link status (RUNNING flag) may be down at that time, in which case the new link status would be erroneously considered down. IBV interface is insufficient for the task. Monitor interface events using Netlink. Fixes: 198a3c339a8f ("mlx5: handle link status interrupts") Cc: sta...@dpdk.org Signed-off-by: Dmitry Kozlyuk Reviewed-by: Viacheslav Ovsiienko --- Coverity complains about unchecked rte_intr_fd/type_set() return values. That would be useless, because rte_intr_handle is in a known state. drivers/net/mlx5/linux/mlx5_ethdev_os.c | 63 - drivers/net/mlx5/linux/mlx5_os.c| 55 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 3 ++ drivers/net/mlx5/mlx5_trigger.c | 12 - 5 files changed, 120 insertions(+), 14 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index c19825ee52..8fe73f1adb 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "mlx5.h" #include "mlx5_rxtx.h" @@ -760,6 +761,56 @@ mlx5_dev_interrupt_device_fatal(struct mlx5_dev_ctx_shared *sh) } } +static void +mlx5_dev_interrupt_nl_cb(struct nlmsghdr *hdr, void *cb_arg) +{ + struct mlx5_dev_ctx_shared *sh = cb_arg; + uint32_t i; + uint32_t if_index; + + if (mlx5_nl_parse_link_status_update(hdr, &if_index) < 0) + return; + for (i = 0; i < sh->max_port; i++) { + struct mlx5_dev_shared_port *port = &sh->port[i]; + struct rte_eth_dev *dev; + struct mlx5_priv *priv; + + if (port->nl_ih_port_id >= RTE_MAX_ETHPORTS) + continue; + dev = &rte_eth_devices[port->nl_ih_port_id]; + /* Probing may initiate an LSC before configuration is done. */ + if (dev->data->dev_configured && + !dev->data->dev_conf.intr_conf.lsc) + break; + priv = dev->data->dev_private; + if (priv->if_index == if_index) { + /* Block logical LSC events. */ + uint16_t prev_status = dev->data->dev_link.link_status; + + if (mlx5_link_update(dev, 0) < 0) + DRV_LOG(ERR, "Failed to update link status: %s", + rte_strerror(rte_errno)); + else if (prev_status != dev->data->dev_link.link_status) + rte_eth_dev_callback_process + (dev, RTE_ETH_EVENT_INTR_LSC, NULL); + break; + } + } +} + +void +mlx5_dev_interrupt_handler_nl(void *arg) +{ + struct mlx5_dev_ctx_shared *sh = arg; + int nlsk_fd = rte_intr_fd_get(sh->intr_handle_nl); + + if (nlsk_fd < 0) + return; + if (mlx5_nl_read_events(nlsk_fd, mlx5_dev_interrupt_nl_cb, sh) < 0) + DRV_LOG(ERR, "Failed to process Netlink events: %s", + rte_strerror(rte_errno)); +} + /** * Handle shared asynchronous events the NIC (removal event * and link status change). Supports multiport IB device. @@ -823,18 +874,6 @@ mlx5_dev_interrupt_handler(void *cb_arg) tmp = sh->port[tmp - 1].ih_port_id; dev = &rte_eth_devices[tmp]; MLX5_ASSERT(dev); - if ((event.event_type == IBV_EVENT_PORT_ACTIVE || -event.event_type == IBV_EVENT_PORT_ERR) && - dev->data->dev_conf.intr_conf.lsc) { - mlx5_glue->ack_async_event(&event); - if (mlx5_link_update(dev, 0) == -EAGAIN) { - usleep(0); - continue; - } - rte_eth_dev_callback_process - (dev, RTE_ETH_EVENT_INTR_LSC, NULL); - continue; - } DRV_LOG(DEBUG, "port %u cannot handle an unknown event (type %d)", dev->data->port_id, event.event_type); diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 17e7144cc9..29a4890d14 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -2495,6 +2495,40 @@ mlx5_os_net_cleanup(void) mlx5_pmd_socket_uninit(); } +static int +mlx5_os_dev_shared_handler_install_lsc(struct mlx5_dev_ctx_shared *sh) +{ + int
[PATCH v2 3/3] net/mlx5: fix initial link status detection
Link status change takes time that depends on the HW and the kernel. It was checked immediately after the change was issued at probing. If the port had beed down before probing, a "down" state may be read, while the port would be "up" imminently. After that, DPDK reported the port as "down" mistakenly and "ifconfig $DEV up" did not trigger an LSC event, because from the system's perspective the port was "up" already. Install Netlink event handler at port probe before requesting the port to come up in order to receive LSC event even if it comes up between probe and start. Fixes: b6499434b83e ("net/mlx5: fix link status initialization") Cc: sta...@dpdk.org Signed-off-by: Dmitry Kozlyuk Reviewed-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_os.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 29a4890d14..ff65efb2a2 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1483,13 +1483,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, /* Bring Ethernet device up. */ DRV_LOG(DEBUG, "port %u forcing Ethernet interface up", eth_dev->data->port_id); - mlx5_set_link_up(eth_dev); - /* -* Even though the interrupt handler is not installed yet, -* interrupts will still trigger on the async_fd from -* Verbs context returned by ibv_open_device(). -*/ + /* Read link status in case it is up and there will be no event. */ mlx5_link_update(eth_dev, 0); + /* Watch LSC interrupts between port probe and port start. */ + priv->sh->port[priv->dev_port - 1].nl_ih_port_id = + eth_dev->data->port_id; + mlx5_set_link_up(eth_dev); for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) { icfg[i].release_mem_en = !!sh->config.reclaim_mode; if (sh->config.reclaim_mode) -- 2.25.1
[PATCH] doc: fix typos and punctuation in flow API guide
This fixes typos and punctuation in the rte flow API guide. Fixes: 2f82d143fb31 ("ethdev: add group jump action") Fixes: 4d73b6fb9907 ("doc: add generic flow API guide") Cc: sta...@dpdk.org Signed-off-by: Ali Alnubani --- doc/guides/prog_guide/rte_flow.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index b4aa9c47c2..714769d0e4 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -60,12 +60,12 @@ Flow rules can also be grouped, the flow rule priority is specific to the group they belong to. All flow rules in a given group are thus processed within the context of that group. Groups are not linked by default, so the logical hierarchy of groups must be explicitly defined by flow rules themselves in each -group using the JUMP action to define the next group to redirect too. Only flow -rules defined in the default group 0 are guarantee to be matched against, this +group using the JUMP action to define the next group to redirect to. Only flow +rules defined in the default group 0 are guaranteed to be matched against. This makes group 0 the origin of any group hierarchy defined by an application. Support for multiple actions per rule may be implemented internally on top -of non-default hardware priorities, as a result both features may not be +of non-default hardware priorities. As a result, both features may not be simultaneously available to applications. Considering that allowed pattern/actions combinations cannot be known in -- 2.25.1
[PATCH] net/mlx5: fix flex item header length translation
Flex item API provides support for network header with a fixed and variable lengths. When PMD compiles a new flex item object configuration it converts RTE parameters into matching PMD PARSE_GRAPH parameters and checks the parameter values against port capabilities. Current implementation mismatched PARSE_GRAPH configuration fields for the fixed size header. Cc: sta...@dpdk.org Fixes: b293e8e49d78 ("net/mlx5: translate flex item configuration") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_flex.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c index 26f0dfa36f..fb08910ddb 100644 --- a/drivers/net/mlx5/mlx5_flow_flex.c +++ b/drivers/net/mlx5/mlx5_flow_flex.c @@ -382,15 +382,11 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr *attr, return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, "unsupported header length field mode (FIXED)"); - if (attr->header_length_mask_width < field->field_size) - return rte_flow_error_set - (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, -"header length field width exceeds limit"); - if (field->offset_shift < 0 || - field->offset_shift > attr->header_length_mask_width) + if (field->field_size || + field->offset_mask || field->offset_shift) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, -"invalid header length field shift (FIXED"); +"invalid fields for fixed mode"); if (field->field_base < 0) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, -- 2.34.1
Re: release candidate 22.03-rc2
Adding authors and reviewers of failing patches. Rakesh, Jerin, Alexander, Ori, please check below bugs. 01/03/2022 11:56, Jiang, YuX: > Update some new bugzilla bugs for 22.03-rc2, please help to fix. Thanks all. > https://bugs.dpdk.org/show_bug.cgi?id=939 [dpdk 22.03-rc2] > drivers/net/cnxk/cnxk_ethdev_mtr meson build failed with cflag parm > optimization=1 on Ubuntu20.04 with GCC10.3 > First bad commit id: > commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 (HEAD) > Author: Rakesh Kudurumalla > Date: Wed Feb 23 15:25:40 2022 +0530 > > net/cnxk: fix build with GCC 12 > > Resolve following compilation error with gcc 12 version. > error: storing the address of local variable message in *error.message > > Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") > Cc: sta...@dpdk.org > > Reported-by: Ferruh Yigit > Signed-off-by: Rakesh Kudurumalla > Acked-by: Jerin Jacob > > https://bugs.dpdk.org/show_bug.cgi?id=940 [dpdk 22.03-rc2] > drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_nix_inl_dev.c.o: meson > build failed with -Dmax_ethports=1024 parameter > First bad commit id: > commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 (HEAD) > Author: Rakesh Kudurumalla > Date: Wed Feb 23 15:25:40 2022 +0530 > > net/cnxk: fix build with GCC 12 > > Resolve following compilation error with gcc 12 version. > error: storing the address of local variable message in *error.message > > Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") > Cc: sta...@dpdk.org > > Reported-by: Ferruh Yigit > Signed-off-by: Rakesh Kudurumalla > Acked-by: Jerin Jacob > > https://bugs.dpdk.org/show_bug.cgi?id=941 [dpdk-22.03] core dump when create > fdir rule with bad arguments > First bad commit id: > 04cc665fab38e2a382f6886e57c97b78e92cea46 is the first bad commit > commit 04cc665fab38e2a382f6886e57c97b78e92cea46 > Author: Alexander Kozyrev > Date: Wed Feb 23 05:02:35 2022 +0200 > > app/testpmd: add flow template management > > Add testpmd support for the rte_flow_pattern_template and > rte_flow_actions_template APIs. Provide the command line interface > for the template creation/destruction. Usage example: > testpmd> flow pattern_template 0 create pattern_template_id 2 >template eth dst is 00:16:3e:31:15:c3 / end > testpmd> flow actions_template 0 create actions_template_id 4 >template drop / end mask drop / end > testpmd> flow actions_template 0 destroy actions_template 4 > testpmd> flow pattern_template 0 destroy pattern_template 2 > > Signed-off-by: Alexander Kozyrev > Acked-by: Ori Kam > > https://bugs.dpdk.org/show_bug.cgi?id=944 [dpdk 22.03-rc2] > inline_ipsec/test_Ipsec_Encryption_Rss: run dpdk-ipsec-secgw with assigned > parameter fail > First bad commit id: > 04cc665fab38e2a382f6886e57c97b78e92cea46 is the first bad commit > commit 04cc665fab38e2a382f6886e57c97b78e92cea46 > Author: Alexander Kozyrev > Date: Wed Feb 23 05:02:35 2022 +0200 > > app/testpmd: add flow template management > > Add testpmd support for the rte_flow_pattern_template and > rte_flow_actions_template APIs. Provide the command line interface > for the template creation/destruction. Usage example: > testpmd> flow pattern_template 0 create pattern_template_id 2 >template eth dst is 00:16:3e:31:15:c3 / end > testpmd> flow actions_template 0 create actions_template_id 4 >template drop / end mask drop / end > testpmd> flow actions_template 0 destroy actions_template 4 > testpmd> flow pattern_template 0 destroy pattern_template 2 > > Signed-off-by: Alexander Kozyrev > Acked-by: Ori Kam >
Re: [dpdk-dev] [PATCH 2/3] net/bnxt: fix ver get HWRM command
Hello, On Thu, Mar 4, 2021 at 9:45 AM Kalesh A P wrote: > > From: Kalesh AP > > Fix HWRM_VER_GET command to handle DEV_NOT_RDY state. > > Driver should fail probe if the device is not ready. > Conversely, the HWRM_VER_GET poll after reset can safely > retry until the existing timeout is exceeded. > > Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code") > Cc: sta...@dpdk.org > > Signed-off-by: Kalesh AP > Reviewed-by: Somnath Kotur > Reviewed-by: Randy Schacher > Reviewed-by: Ajit Kumar Khaparde This patch makes probing fail on a RHEL9 kernel with firmwares: firmware-version: 20.6.143.0/pkg 20.06.04.06 and firmware-version: 20.6.112.0 Simply reverting the patch fixes probing in my env. This was reported by our QE team which is doing sanity checks on ovs 2.17 which uses dpdk v21.11. https://bugzilla.redhat.com/show_bug.cgi?id=2055531 -- David Marchand
[PATCH] net/iavf: fix AES-GMAC IV size
Fix AES-GMAC size, set it to the required value, unlike lookaside where it also includes salt length. Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") Cc: sta...@dpdk.org Signed-off-by: Radu Nicolau --- drivers/net/iavf/iavf_ipsec_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c index d6875eb6aa..b1949cee91 100644 --- a/drivers/net/iavf/iavf_ipsec_crypto.c +++ b/drivers/net/iavf/iavf_ipsec_crypto.c @@ -614,7 +614,7 @@ set_session_parameter(struct iavf_security_ctx *iavf_sctx, if (conf->crypto_xform->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC) { sess->block_sz = get_auth_blocksize(iavf_sctx, conf->crypto_xform->auth.algo); - sess->iv_sz = conf->crypto_xform->auth.iv.length; + sess->iv_sz = sizeof(uint64_t); /* iv len inc. salt */ sess->icv_sz = conf->crypto_xform->auth.digest_length; } else { sess->block_sz = get_cipher_blocksize(iavf_sctx, -- 2.25.1
[PATCH] compressdev: fix size of socket ID in device data struct
Socket ID is used and interpreted as integer, one of the possible values for socket id is -1 (SOCKET_ID_ANY). here socket_id is defined as unsigned 8 bit integer, so when putting -1, it is interpreted as 255, which causes allocation errors when trying to allocate from socket_id (255). change socket_id from unsigned 8 bit integer to integer. Fixes: ed7dd94f7f66 ("compressdev: add basic device management") Cc: fiona.tr...@intel.com Cc: sta...@dpdk.org Signed-off-by: Raja Zidane Acked-by: Matan Azrad --- lib/compressdev/rte_compressdev_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h index 888c8f5c5c..25d8afbfb9 100644 --- a/lib/compressdev/rte_compressdev_internal.h +++ b/lib/compressdev/rte_compressdev_internal.h @@ -98,7 +98,7 @@ struct rte_compressdev { struct rte_compressdev_data { uint8_t dev_id; /**< Compress device identifier */ - uint8_t socket_id; + int socket_id; /**< Socket identifier where memory is allocated */ char name[RTE_COMPRESSDEV_NAME_MAX_LEN]; /**< Unique identifier name */ -- 2.21.0
[PATCH] crypto/qat: fix smaller modulus cases for mod exp
This patches fixes not working cases when modulus is smaller than other arguments. Fixes: 109755f0a427 ("crypto/qat: refactor asymmetric crypto functions") Signed-off-by: Arek Kusztal --- drivers/common/qat/qat_adf/qat_pke.h | 24 +++- drivers/crypto/qat/qat_asym.c| 12 ++-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/common/qat/qat_adf/qat_pke.h b/drivers/common/qat/qat_adf/qat_pke.h index 092fc373de..b5fb2a020c 100644 --- a/drivers/common/qat/qat_adf/qat_pke.h +++ b/drivers/common/qat/qat_adf/qat_pke.h @@ -17,32 +17,32 @@ struct qat_asym_function { }; static struct qat_asym_function -get_modexp_function(struct rte_crypto_asym_xform *xform) +get_modexp_function2(uint32_t bytesize) { struct qat_asym_function qat_function = { }; - if (xform->modex.modulus.length <= 64) { + if (bytesize <= 64) { qat_function.func_id = MATHS_MODEXP_L512; qat_function.bytesize = 64; - } else if (xform->modex.modulus.length <= 128) { + } else if (bytesize <= 128) { qat_function.func_id = MATHS_MODEXP_L1024; qat_function.bytesize = 128; - } else if (xform->modex.modulus.length <= 192) { + } else if (bytesize <= 192) { qat_function.func_id = MATHS_MODEXP_L1536; qat_function.bytesize = 192; - } else if (xform->modex.modulus.length <= 256) { + } else if (bytesize <= 256) { qat_function.func_id = MATHS_MODEXP_L2048; qat_function.bytesize = 256; - } else if (xform->modex.modulus.length <= 320) { + } else if (bytesize <= 320) { qat_function.func_id = MATHS_MODEXP_L2560; qat_function.bytesize = 320; - } else if (xform->modex.modulus.length <= 384) { + } else if (bytesize <= 384) { qat_function.func_id = MATHS_MODEXP_L3072; qat_function.bytesize = 384; - } else if (xform->modex.modulus.length <= 448) { + } else if (bytesize <= 448) { qat_function.func_id = MATHS_MODEXP_L3584; qat_function.bytesize = 448; - } else if (xform->modex.modulus.length <= 512) { + } else if (bytesize <= 512) { qat_function.func_id = MATHS_MODEXP_L4096; qat_function.bytesize = 512; } @@ -50,6 +50,12 @@ get_modexp_function(struct rte_crypto_asym_xform *xform) } static struct qat_asym_function +get_modexp_function(struct rte_crypto_asym_xform *xform) +{ + return get_modexp_function2(xform->modex.modulus.length); +} + +static struct qat_asym_function get_modinv_function(struct rte_crypto_asym_xform *xform) { struct qat_asym_function qat_function = { }; diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c index badf018f13..25694e52b5 100644 --- a/drivers/crypto/qat/qat_asym.c +++ b/drivers/crypto/qat/qat_asym.c @@ -205,7 +205,7 @@ modexp_set_input(struct rte_crypto_asym_op *asym_op, struct rte_crypto_asym_xform *xform) { struct qat_asym_function qat_function; - uint32_t alg_bytesize, func_id; + uint32_t alg_bytesize, func_id, in_bytesize; int status = 0; CHECK_IF_NOT_EMPTY(xform->modex.modulus, "mod exp", @@ -215,7 +215,15 @@ modexp_set_input(struct rte_crypto_asym_op *asym_op, if (status) return status; - qat_function = get_asym_function(xform); + if (asym_op->modex.base.length > xform->modex.exponent.length && + asym_op->modex.base.length > xform->modex.modulus.length) { + in_bytesize = asym_op->modex.base.length; + } else if (xform->modex.exponent.length > xform->modex.modulus.length) + in_bytesize = xform->modex.exponent.length; + else + in_bytesize = xform->modex.modulus.length; + + qat_function = get_modexp_function2(in_bytesize); func_id = qat_function.func_id; if (qat_function.func_id == 0) { QAT_LOG(ERR, "Cannot obtain functionality id"); -- 2.13.6
RE: release candidate 22.03-rc2
I'm working on fixing Bug 941 - will issue patch for this shortly. But Bug 944 is wrongly attributed to my commit in this email. Adding Volodymyr as his commit is actually listed in the bug. > -Original Message- > From: Thomas Monjalon > Sent: Tuesday, March 1, 2022 7:36 > To: Rakesh Kudurumalla ; Jerin Jacob > ; Alexander Kozyrev ; Ori Kam > > Cc: dev (dev@dpdk.org) ; Devlin, Michelle > ; Mcnamara, John > ; Yigit, Ferruh ; Sun, > QingX ; Jiang, YuX > Subject: Re: release candidate 22.03-rc2 > > Adding authors and reviewers of failing patches. > Rakesh, Jerin, Alexander, Ori, > please check below bugs. > > > 01/03/2022 11:56, Jiang, YuX: > > Update some new bugzilla bugs for 22.03-rc2, please help to fix. Thanks all. > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs > .dpdk.org%2Fshow_bug.cgi%3Fid%3D939&data=04%7C01%7Cakozyrev > %40nvidia.com%7Ca2aac7bd26244afbcd8908d9fb800b2d%7C43083d15727340 > c1b7db39efd9ccc17a%7C0%7C0%7C637817350871706214%7CUnknown%7CT > WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC > JXVCI6Mn0%3D%7C3000&sdata=0u4TYxRHLwBlGvlJYnlC99FNxCrwZXu7g > KIIHLAzlRo%3D&reserved=0 [dpdk 22.03-rc2] > drivers/net/cnxk/cnxk_ethdev_mtr meson build failed with cflag parm > optimization=1 on Ubuntu20.04 with GCC10.3 > > First bad commit id: > > commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 (HEAD) > > Author: Rakesh Kudurumalla > > Date: Wed Feb 23 15:25:40 2022 +0530 > > > > net/cnxk: fix build with GCC 12 > > > > Resolve following compilation error with gcc 12 version. > > error: storing the address of local variable message in *error.message > > > > Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") > > Cc: sta...@dpdk.org > > > > Reported-by: Ferruh Yigit > > Signed-off-by: Rakesh Kudurumalla > > Acked-by: Jerin Jacob > > > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs > .dpdk.org%2Fshow_bug.cgi%3Fid%3D940&data=04%7C01%7Cakozyrev > %40nvidia.com%7Ca2aac7bd26244afbcd8908d9fb800b2d%7C43083d15727340 > c1b7db39efd9ccc17a%7C0%7C0%7C637817350871706214%7CUnknown%7CT > WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC > JXVCI6Mn0%3D%7C3000&sdata=p5BlP21K2X5ws3uIXeutP9vJfkIqHvv0% > 2F2Jt2zhpbwg%3D&reserved=0 [dpdk 22.03-rc2] > drivers/libtmp_rte_common_cnxk.a.p/common_cnxk_roc_nix_inl_dev.c.o: > meson build failed with -Dmax_ethports=1024 parameter > > First bad commit id: > > commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 (HEAD) > > Author: Rakesh Kudurumalla > > Date: Wed Feb 23 15:25:40 2022 +0530 > > > > net/cnxk: fix build with GCC 12 > > > > Resolve following compilation error with gcc 12 version. > > error: storing the address of local variable message in *error.message > > > > Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") > > Cc: sta...@dpdk.org > > > > Reported-by: Ferruh Yigit > > Signed-off-by: Rakesh Kudurumalla > > Acked-by: Jerin Jacob > > > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs > .dpdk.org%2Fshow_bug.cgi%3Fid%3D941&data=04%7C01%7Cakozyrev > %40nvidia.com%7Ca2aac7bd26244afbcd8908d9fb800b2d%7C43083d15727340 > c1b7db39efd9ccc17a%7C0%7C0%7C637817350871706214%7CUnknown%7CT > WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC > JXVCI6Mn0%3D%7C3000&sdata=rmm2xSlVgplEat2pJUJoQm69vlHzhQu > M%2F0a8KZOeWQM%3D&reserved=0 [dpdk-22.03] core dump when > create fdir rule with bad arguments > > First bad commit id: > > 04cc665fab38e2a382f6886e57c97b78e92cea46 is the first bad commit > > commit 04cc665fab38e2a382f6886e57c97b78e92cea46 > > Author: Alexander Kozyrev > > Date: Wed Feb 23 05:02:35 2022 +0200 > > > > app/testpmd: add flow template management > > > > Add testpmd support for the rte_flow_pattern_template and > > rte_flow_actions_template APIs. Provide the command line interface > > for the template creation/destruction. Usage example: > > testpmd> flow pattern_template 0 create pattern_template_id 2 > >template eth dst is 00:16:3e:31:15:c3 / end > > testpmd> flow actions_template 0 create actions_template_id 4 > >template drop / end mask drop / end > > testpmd> flow actions_template 0 destroy actions_template 4 > > testpmd> flow pattern_template 0 destroy pattern_template 2 > > > > Signed-off-by: Alexander Kozyrev > > Acked-by: Ori Kam > > > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs > .dpdk.org%2Fshow_bug.cgi%3Fid%3D944&data=04%7C01%7Cakozyrev > %40nvidia.com%7Ca2aac7bd26244afbcd8908d9fb800b2d%7C43083d15727340 > c1b7db39efd9ccc17a%7C0%7C0%7C637817350871706214%7CUnknown%7CT > WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC > JXVCI6Mn0%3D%7C3000&sdata=DMD2K7MuE5sX4r%2B99G5OGo%2FTi > CEChUN1TtfxxgWngQ0%3D&reserved=0 [dpdk 22.03-rc2] > inline_ipsec/test_Ipsec_Encryption_Rss: run dpdk-ipsec-secgw with a
[PATCH v6 0/2] Add config file support for l3fwd
This patchset introduces config file support for l3fwd and its lookup methods LPM, FIB, and EM, similar to that of l3fwd-acl. This allows for route rules to be defined in configuration files and edited there instead of in each of the lookup methods hardcoded route tables. V6: * Move config file parsing functions to separate files as to not bloat l3fwd code. V5: * Reintroduce hardcoded tables as to not break dts and allow for hardcoded tables to be used if no config files presented. V4: * Fix nondeterministic bug of segfault on termination of sample app. Sean Morrissey (2): examples/l3fwd: add config file support for LPM/FIB examples/l3fwd: add config file support for EM doc/guides/sample_app_ug/l3_forward.rst | 89 +-- examples/l3fwd/em_default_v4.cfg| 17 ++ examples/l3fwd/em_default_v6.cfg| 17 ++ examples/l3fwd/em_route_parse.c | 280 ++ examples/l3fwd/l3fwd.h | 7 + examples/l3fwd/l3fwd_em.c | 220 ++--- examples/l3fwd/l3fwd_fib.c | 50 ++-- examples/l3fwd/l3fwd_lpm.c | 46 ++-- examples/l3fwd/l3fwd_route.h| 89 ++- examples/l3fwd/lpm_default_v4.cfg | 17 ++ examples/l3fwd/lpm_default_v6.cfg | 17 ++ examples/l3fwd/lpm_route_parse.c| 302 examples/l3fwd/main.c | 50 +++- 13 files changed, 992 insertions(+), 209 deletions(-) create mode 100644 examples/l3fwd/em_default_v4.cfg create mode 100644 examples/l3fwd/em_default_v6.cfg create mode 100644 examples/l3fwd/em_route_parse.c create mode 100644 examples/l3fwd/lpm_default_v4.cfg create mode 100644 examples/l3fwd/lpm_default_v6.cfg create mode 100644 examples/l3fwd/lpm_route_parse.c -- 2.25.1
[PATCH v6 1/2] examples/l3fwd: add config file support for LPM/FIB
Add support to define ipv4 and ipv6 forwarding tables from reading from a config file for LPM and FIB, with format similar to l3fwd-acl one. Users can now use the default hardcoded route tables or optionally config files. Default config files have been provided for use with LPM and FIB. Signed-off-by: Sean Morrissey Acked-by: Konstantin Ananyev Tested-by: Yingya Han --- examples/l3fwd/em_route_parse.c | 18 ++ examples/l3fwd/l3fwd.h| 7 + examples/l3fwd/l3fwd_em.c | 1 + examples/l3fwd/l3fwd_fib.c| 50 ++--- examples/l3fwd/l3fwd_lpm.c| 46 ++--- examples/l3fwd/l3fwd_route.h | 51 + examples/l3fwd/lpm_default_v4.cfg | 17 ++ examples/l3fwd/lpm_default_v6.cfg | 17 ++ examples/l3fwd/lpm_route_parse.c | 302 ++ examples/l3fwd/main.c | 50 - 10 files changed, 515 insertions(+), 44 deletions(-) create mode 100644 examples/l3fwd/em_route_parse.c create mode 100644 examples/l3fwd/lpm_default_v4.cfg create mode 100644 examples/l3fwd/lpm_default_v6.cfg create mode 100644 examples/l3fwd/lpm_route_parse.c diff --git a/examples/l3fwd/em_route_parse.c b/examples/l3fwd/em_route_parse.c new file mode 100644 index 00..11d83d9b42 --- /dev/null +++ b/examples/l3fwd/em_route_parse.c @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ + +#include "l3fwd_route.h" + +void +em_free_routes(void) +{ + /* Empty till config file support added to EM */ +} + +/* Load rules from the input file */ +void +read_config_files_em(void) +{ + /* Empty till config file support added to EM */ +} diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 38ca19133c..002510b851 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -58,6 +58,11 @@ #endif #define HASH_ENTRY_NUMBER_DEFAULT 16 +struct parm_cfg { + const char *rule_ipv4_name; + const char *rule_ipv6_name; +}; + struct mbuf_table { uint16_t len; struct rte_mbuf *m_table[MAX_PKT_BURST]; @@ -96,6 +101,8 @@ extern xmm_t val_eth[RTE_MAX_ETHPORTS]; extern struct lcore_conf lcore_conf[RTE_MAX_LCORE]; +extern struct parm_cfg parm_config; + /* Send burst of packets on an output interface */ static inline int send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port) diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index 5cc4a4d979..de5be9e0a4 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -27,6 +27,7 @@ #include "l3fwd.h" #include "l3fwd_event.h" +#include "em_route_parse.c" #if defined(RTE_ARCH_X86) || defined(__ARM_FEATURE_CRC32) #define EM_HASH_CRC 1 diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c index 2110459cc3..6e0054b4cb 100644 --- a/examples/l3fwd/l3fwd_fib.c +++ b/examples/l3fwd/l3fwd_fib.c @@ -583,7 +583,7 @@ setup_fib(const int socketid) struct rte_eth_dev_info dev_info; struct rte_fib6_conf config; struct rte_fib_conf config_ipv4; - unsigned int i; + int i; int ret; char s[64]; char abuf[INET6_ADDRSTRLEN]; @@ -603,37 +603,39 @@ setup_fib(const int socketid) "Unable to create the l3fwd FIB table on socket %d\n", socketid); + /* Populate the fib ipv4 table. */ - for (i = 0; i < RTE_DIM(ipv4_l3fwd_route_array); i++) { + for (i = 0; i < route_num_v4; i++) { struct in_addr in; /* Skip unused ports. */ - if ((1 << ipv4_l3fwd_route_array[i].if_out & + if ((1 << route_base_v4[i].if_out & enabled_port_mask) == 0) continue; - rte_eth_dev_info_get(ipv4_l3fwd_route_array[i].if_out, + rte_eth_dev_info_get(route_base_v4[i].if_out, &dev_info); ret = rte_fib_add(ipv4_l3fwd_fib_lookup_struct[socketid], - ipv4_l3fwd_route_array[i].ip, - ipv4_l3fwd_route_array[i].depth, - ipv4_l3fwd_route_array[i].if_out); + route_base_v4[i].ip, + route_base_v4[i].depth, + route_base_v4[i].if_out); if (ret < 0) { + free(route_base_v4); rte_exit(EXIT_FAILURE, "Unable to add entry %u to the l3fwd FIB table on socket %d\n", i, socketid); } - in.s_addr = htonl(ipv4_l3fwd_route_array[i].ip); + in.s_addr = htonl(route_base_v4[i].ip); if (inet_ntop(AF_INET, &in, abuf, sizeof(abuf)) != NULL) { printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf, - ipv4_l3fwd_route_array[i].depth, -
[PATCH v6 2/2] examples/l3fwd: add config file support for EM
Add support to define ipv4 and ipv6 forwarding tables from reading from a config file for EM with a format similar to l3fwd-acl one. Users can now use the default hardcoded route tables or optionally config files for 'l3fwd_em'. Default config files have been provided for use with EM. Related l3fwd docs have been updated to relfect these changes. Signed-off-by: Sean Morrissey Acked-by: Konstantin Ananyev --- doc/guides/sample_app_ug/l3_forward.rst | 89 ++-- examples/l3fwd/em_default_v4.cfg| 17 ++ examples/l3fwd/em_default_v6.cfg| 17 ++ examples/l3fwd/em_route_parse.c | 266 +++- examples/l3fwd/l3fwd_em.c | 219 +++ examples/l3fwd/l3fwd_route.h| 38 +++- 6 files changed, 479 insertions(+), 167 deletions(-) create mode 100644 examples/l3fwd/em_default_v4.cfg create mode 100644 examples/l3fwd/em_default_v6.cfg diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index 6d7d7c5cc1..01d86db95d 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -47,6 +47,7 @@ and loaded into the LPM or FIB object at initialization time. In the sample application, hash-based and FIB-based forwarding supports both IPv4 and IPv6. LPM-based forwarding supports IPv4 only. +During the initialization phase route rules for IPv4 and IPv6 are read from rule files. Compiling the Application - @@ -61,6 +62,8 @@ Running the Application The application has a number of command line options:: ./dpdk-l3fwd [EAL options] -- -p PORTMASK + --rule_ipv4=FILE + --rule_ipv6=FILE [-P] [--lookup LOOKUP_METHOD] --config(port,queue,lcore)[,(port,queue,lcore)] @@ -82,6 +85,11 @@ Where, * ``-p PORTMASK:`` Hexadecimal bitmask of ports to configure +* ``--rule_ipv4=FILE:`` specify the ipv4 rules entries file. + Each rule occupies one line. + +* ``--rule_ipv6=FILE:`` specify the ipv6 rules entries file. + * ``-P:`` Optional, sets all ports to promiscuous mode so that packets are accepted regardless of the packet's Ethernet MAC destination address. Without this option, only packets with the Ethernet MAC destination address set to the Ethernet address of the port are accepted. @@ -135,7 +143,7 @@ To enable L3 forwarding between two ports, assuming that both ports are in the s .. code-block:: console -.//examples/dpdk-l3fwd -l 1,2 -n 4 -- -p 0x3 --config="(0,0,1),(1,0,2)" +.//examples/dpdk-l3fwd -l 1,2 -n 4 -- -p 0x3 --config="(0,0,1),(1,0,2)" --rule_ipv4="rule_ipv4.cfg" --rule_ipv6="rule_ipv6.cfg" In this command: @@ -157,19 +165,23 @@ In this command: | | | | | +--+---+---+-+ +* The -rule_ipv4 option specifies the reading of IPv4 rules sets from the rule_ipv4.cfg file + +* The -rule_ipv6 option specifies the reading of IPv6 rules sets from the rule_ipv6.cfg file. + To use eventdev mode with sync method **ordered** on above mentioned environment, Following is the sample command: .. code-block:: console -.//examples/dpdk-l3fwd -l 0-3 -n 4 -a -- -p 0x3 --eventq-sched=ordered +.//examples/dpdk-l3fwd -l 0-3 -n 4 -a -- -p 0x3 --eventq-sched=ordered --rule_ipv4="rule_ipv4.cfg" --rule_ipv6="rule_ipv6.cfg" or .. code-block:: console .//examples/dpdk-l3fwd -l 0-3 -n 4 -a \ - -- -p 0x03 --mode=eventdev --eventq-sched=ordered + -- -p 0x03 --mode=eventdev --eventq-sched=ordered --rule_ipv4="rule_ipv4.cfg" --rule_ipv6="rule_ipv6.cfg" In this command: @@ -192,7 +204,7 @@ scheduler. Following is the sample command: .. code-block:: console -.//examples/dpdk-l3fwd -l 0-7 -s 0xf -n 4 --vdev event_sw0 -- -p 0x3 --mode=eventdev --eventq-sched=ordered +.//examples/dpdk-l3fwd -l 0-7 -s 0xf -n 4 --vdev event_sw0 -- -p 0x3 --mode=eventdev --eventq-sched=ordered --rule_ipv4="rule_ipv4.cfg" --rule_ipv6="rule_ipv6.cfg" In case of eventdev mode, *--config* option is not used for ethernet port configuration. Instead each ethernet port will be configured with mentioned @@ -216,6 +228,49 @@ The following sections provide some explanation of the sample application code. the initialization and run-time paths are very similar to those of the :doc:`l2_forward_real_virtual` and :doc:`l2_forward_event`. The following sections describe aspects that are specific to the L3 Forwarding sample application. +Parse Rules from File +~ + +The application parses the rules from the file and adds them to the appropriate route table by calling the appropriate function. +It ignores empty and comment lines, and parses and validates the rules it re
[PATCH] examples/vm_power: replace list foreach with while loop
Linux header files don't support LIST_FOREACH_SAFE so replacing LIST_FOREACH with while loop. Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host") Cc: alan.ca...@intel.com Cc: sta...@dpdk.org Signed-off-by: Shibin Koikkara Reeny --- examples/vm_power_manager/channel_manager.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 838465ab4b..b4dea4b275 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -1005,10 +1005,10 @@ channel_manager_exit(void) { unsigned i; char mask[RTE_MAX_LCORE]; - struct virtual_machine_info *vm_info; - - LIST_FOREACH(vm_info, &vm_list_head, vms_info) { + struct virtual_machine_info *vm_info = LIST_FIRST(&vm_list_head); + /* No LIST_FOREACH_SAFE, using while instead. */ + while (vm_info) { rte_spinlock_lock(&(vm_info->config_spinlock)); memcpy(mask, (char *)vm_info->channel_mask, RTE_MAX_LCORE); @@ -1024,6 +1024,8 @@ channel_manager_exit(void) LIST_REMOVE(vm_info, vms_info); rte_free(vm_info); + + vm_info = LIST_NEXT((vm_info), vms_info); } if (global_hypervisor_available) { -- 2.25.1
[dpdk-dev v2] crypto/qat: fix process type handling
This patch fix the memory corruptions issue reported by coverity. The process type handling in QAT PMDs where only primary and secondary process are supported in qat build request. Coverity issue: 376551, 376570, 376534 Fixes: b62d00d0d247 ("crypto/qat: rework burst data path") Signed-off-by: Kai Ji --- drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 3 +++ drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c | 3 +++ drivers/crypto/qat/dev/qat_sym_pmd_gen1.c| 3 +++ drivers/crypto/qat/qat_sym.c | 8 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c index 5084a5fcd1..2d5f10aeac 100644 --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c @@ -358,6 +358,9 @@ qat_sym_crypto_set_session_gen3(void *cdev __rte_unused, void *session) enum rte_proc_type_t proc_type = rte_eal_process_type(); int ret; + if (proc_type == RTE_PROC_AUTO || proc_type == RTE_PROC_INVALID) + return -EINVAL; + ret = qat_sym_crypto_set_session_gen1(cdev, session); /* special single pass build request for GEN3 */ if (ctx->is_single_pass) diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c index bd7f3785df..3d8b2e377c 100644 --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c @@ -189,6 +189,9 @@ qat_sym_crypto_set_session_gen4(void *cdev, void *session) enum rte_proc_type_t proc_type = rte_eal_process_type(); int ret; + if (proc_type == RTE_PROC_AUTO || proc_type == RTE_PROC_INVALID) + return -EINVAL; + ret = qat_sym_crypto_set_session_gen1(cdev, session); /* special single pass build request for GEN4 */ if (ctx->is_single_pass && ctx->is_ucs) diff --git a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c index 3bcb53cf9f..99f5a22a06 100644 --- a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c +++ b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c @@ -1149,6 +1149,9 @@ qat_sym_crypto_set_session_gen1(void *cryptodev __rte_unused, void *session) enum rte_proc_type_t proc_type = rte_eal_process_type(); int handle_mixed = 0; + if (proc_type == RTE_PROC_AUTO || proc_type == RTE_PROC_INVALID) + return -EINVAL; + if ((ctx->qat_cmd == ICP_QAT_FW_LA_CMD_HASH_CIPHER || ctx->qat_cmd == ICP_QAT_FW_LA_CMD_CIPHER_HASH) && !ctx->is_gmac) { diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c index 1ccffad5ab..ca8c9a8124 100644 --- a/drivers/crypto/qat/qat_sym.c +++ b/drivers/crypto/qat/qat_sym.c @@ -60,6 +60,10 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, uintptr_t build_request_p = (uintptr_t)opaque[1]; qat_sym_build_request_t build_request = (void *)build_request_p; struct qat_sym_session *ctx = NULL; + enum rte_proc_type_t proc_type = rte_eal_process_type(); + + if (proc_type == RTE_PROC_AUTO || proc_type == RTE_PROC_INVALID) + return -EINVAL; if (likely(op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)) { ctx = get_sym_session_private_data(op->sym->session, @@ -71,11 +75,9 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, if (sess != (uintptr_t)ctx) { struct rte_cryptodev *cdev; struct qat_cryptodev_private *internals; - enum rte_proc_type_t proc_type; cdev = rte_cryptodev_pmd_get_dev(ctx->dev_id); internals = cdev->data->dev_private; - proc_type = rte_eal_process_type(); if (internals->qat_dev->qat_dev_gen != dev_gen) { op->status = @@ -105,7 +107,6 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, if ((void *)sess != (void *)op->sym->sec_session) { struct rte_cryptodev *cdev; struct qat_cryptodev_private *internals; - enum rte_proc_type_t proc_type; ctx = get_sec_session_private_data( op->sym->sec_session); @@ -130,7 +131,6 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, } cdev = rte_cryptodev_pmd_get_dev(ctx->dev_id); internals = cdev->data->dev_private; - proc_type = rte_eal_process_type(); if (internals->qat_dev->qat_dev_gen != dev_gen) { op->status = -- 2.17.1
RE: [EXT] [PATCH] test/crypto: remove mod exp smaller modulus cases
> -Original Message- > From: Kusztal, ArkadiuszX > Sent: Tuesday, March 1, 2022 9:38 AM > To: Anoob Joseph > Cc: Akhil Goyal ; Zhang, Roy Fan > ; Umesh Kartha ; > Ramkumar Balu ; dev@dpdk.org > Subject: RE: [EXT] [PATCH] test/crypto: remove mod exp smaller modulus cases > > Hi Anoob, > > > -Original Message- > > From: Anoob Joseph > > Sent: Wednesday, February 23, 2022 11:09 AM > > To: Kusztal, ArkadiuszX > > Cc: Akhil Goyal ; Zhang, Roy Fan > > ; Umesh Kartha ; > > Ramkumar Balu ; dev@dpdk.org > > Subject: RE: [EXT] [PATCH] test/crypto: remove mod exp smaller modulus > > cases > > > > Hi Arek, > > > > I agree that these cases may not be particularly useful from > > cryptographic standpoint, but how do we say from what values a PMD > > "must" support? Are you having some trouble supporting some of these > > values? Should we consider extending capabilities to help with this > > rather than just removing the test vectors? > > As for QAT PMD yes, we stopped to support such vectors, for me these vectors > are only waste of space. > When extending test cases I would go for PWCT (pairwise conditional tests) > between hardware and OpenSSL, it is similar what I am doing when testing it > internally. > As for capability we could consider such addition. I will send proposal for > capability change soon, right now we cannot even check what padding is > supported, which curve etc. On the second though I agree, no need to remove it right now. But we need to prepare better KAT tests for the next release. I will defer this patch in patchwork. > > > > > Thanks, > > Anoob > > > > > -Original Message- > > > From: Arek Kusztal > > > Sent: Tuesday, February 8, 2022 4:25 PM > > > To: dev@dpdk.org > > > Cc: Akhil Goyal ; roy.fan.zh...@intel.com; Arek > > > Kusztal > > > Subject: [EXT] [PATCH] test/crypto: remove mod exp smaller modulus > > > cases > > > > > > External Email > > > > > > > > > -- Even if mod exp tests cases where modulus is not the biggest > > > number are mathematically correct and can be computed, > > > cryptographically it is useless and PMD does not need to support it. > > > > > > Signed-off-by: Arek Kusztal > > > --- > > > app/test/test_cryptodev_mod_test_vectors.h | 501 > > > > > > - > > > 1 file changed, 501 deletions(-) > > > > > > diff --git a/app/test/test_cryptodev_mod_test_vectors.h > > > b/app/test/test_cryptodev_mod_test_vectors.h > > > index c66f4b18bc..d108059624 100644 > > > --- a/app/test/test_cryptodev_mod_test_vectors.h > > > +++ b/app/test/test_cryptodev_mod_test_vectors.h > > > @@ -167,141 +167,6 @@ modex_test_data modex_test_case[] = { }, { > > > .description = "Modular Exponentiation " > > > -"(mod=8, base=65, exp=17, res=8)", > > > - .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX, > > > - .base = { > > > - .data = { > > > - 0x25, 0x74, 0x41, 0xCE, 0xFA, 0x5C, 0x07, 0x2A, > > > - 0xD1, 0x74, 0xF3, 0x3D, 0xE1, 0xCC, 0xC3, 0x18, > > > - 0x7E, 0x4A, 0x21, 0x9F, 0x97, 0xA3, 0x26, 0x85, > > > - 0x85, 0xD9, 0x9B, 0xE3, 0xBA, 0xB3, 0x70, 0xC9, > > > - 0x26, 0x68, 0xE4, 0xB7, 0x4C, 0x88, 0x48, 0xC1, > > > - 0x6B, 0xC6, 0x3C, 0x00, 0x8C, 0x6B, 0xC6, 0x11, > > > - 0xD0, 0xD6, 0x61, 0x5D, 0xEC, 0xAA, 0xBA, 0x3B, > > > - 0x7D, 0xB3, 0x0D, 0x3F, 0xA5, 0x4D, 0xEE, 0xE4, > > > - 0xAC > > > - }, > > > - .len = 65 > > > - }, > > > - .exponent = { > > > - .data = { > > > - 0x1C, 0x54, 0x2F, 0xCA, 0xDE, 0x4F, 0x17, 0x38, > > > - 0x69, 0x87, 0xB4, 0xFF, 0x3A, 0x6C, 0x82, 0x70, > > > - 0x53 > > > - }, > > > - .len = 17 > > > - }, > > > - .reminder = { > > > - .data = { > > > - 0x52, 0x06, 0x1A, 0x35, 0x70, 0x33, 0x78, 0x45 > > > - }, > > > - .len = 8 > > > - }, > > > - .modulus = { > > > - .data = { > > > - 0x6B, 0x6D, 0xFA, 0xCB, 0x09, 0x5D, 0x9C, 0xFD > > > - }, > > > - .len = 8 > > > - }, > > > - .result_len = 8 > > > -}, > > > -{ > > > - .description = "Modular Exponentiation " > > > -"(mod=100, base=150, exp=192, res=100)", > > > - .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX, > > > - .base = { > > > - .data = { > > > - 0xC1, 0xA1, 0x04, 0xE4, 0x4D, 0x4A, 0xD3, 0x5C, > > > - 0xB3, 0xD0, 0x16, 0x51, 0xA7, 0xF4, 0x82, 0x6C, > > > - 0x22, 0xDD, 0x4D, 0xAA, 0x70, 0x30, 0x25, 0xA7, > > > - 0xFA, 0xA9, 0xF2, 0x20, 0x55, 0x9B, 0xEA, 0x26, > > > - 0xF6, 0xB5, 0xF8, 0x9C, 0x46, 0x21, 0x85, 0x0E, > > > - 0x38, 0x73, 0x01, 0xC6, 0x72, 0x67, 0x9B, 0x49, > > > - 0xCE, 0x48, 0xB7, 0x4A, 0xEE, 0x08,
[PATCH 1/2] net/mlx5: fix next protocol RSS expansion
RSS expansion scheme has 2 operational modes: default and specific. The default mode expands into all valid options for a given network layer. For example, Ethernet expands by default into VLAN, IPv4 and IPv6, L3 expands into TCP and UDP, etc. The specific mode expands according to flow item next protocol configuration provided by the item spec and mask parameters. There are 3 outcomes for the specific expansion: 1. Back to default – that is the case when result of (spec & mask) allows all possibilities. For example: eth type mask 0 type spec 0 2. No results – in that case item configuration has no valid expansion. For example: eth type mask 0x type spec 101 3. Direct - In that case flow item mask and spec configuration return valid expansion option. Example: eth type mask 0x0fff type spec 0x0800. Current PMD expands flow items with explicit spec and mask configuration into the Direct(3) or No results (2). Default expansions were handled as No results. Cc: sta...@dpdk.org Fixes: f3f1f576f438 ("net/mlx5: fix RSS expansion with explicit next protocol") Signed-off-by: Gregory Etelson Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a690e2d337..0d774cfd19 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -175,6 +175,9 @@ mlx5_nsh_proto_to_item_type(uint8_t proto_spec, uint8_t proto_mask) enum rte_flow_item_type type; switch (proto_mask & proto_spec) { + case 0: + type = RTE_FLOW_ITEM_TYPE_VOID; + break; case RTE_VXLAN_GPE_TYPE_IPV4: type = RTE_FLOW_ITEM_TYPE_IPV4; break; @@ -196,6 +199,9 @@ mlx5_inet_proto_to_item_type(uint8_t proto_spec, uint8_t proto_mask) enum rte_flow_item_type type; switch (proto_mask & proto_spec) { + case 0: + type = RTE_FLOW_ITEM_TYPE_VOID; + break; case IPPROTO_UDP: type = RTE_FLOW_ITEM_TYPE_UDP; break; @@ -221,6 +227,9 @@ mlx5_ethertype_to_item_type(rte_be16_t type_spec, enum rte_flow_item_type type; switch (rte_be_to_cpu_16(type_spec & type_mask)) { + case 0: + type = RTE_FLOW_ITEM_TYPE_VOID; + break; case RTE_ETHER_TYPE_TEB: type = is_tunnel ? RTE_FLOW_ITEM_TYPE_ETH : RTE_FLOW_ITEM_TYPE_END; -- 2.34.1
[PATCH 2/2] net/mlx5: fix INET IPIP protocol type
Fix typo in INET IPIP protocol macro. Cc: sta...@dpdk.org Fixes: f3f1f576f438 ("net/mlx5: fix RSS expansion with explicit next protocol") Signed-off-by: Gregory Etelson Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 0d774cfd19..efb988a9bb 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -208,7 +208,7 @@ mlx5_inet_proto_to_item_type(uint8_t proto_spec, uint8_t proto_mask) case IPPROTO_TCP: type = RTE_FLOW_ITEM_TYPE_TCP; break; - case IPPROTO_IP: + case IPPROTO_IPIP: type = RTE_FLOW_ITEM_TYPE_IPV4; break; case IPPROTO_IPV6: -- 2.34.1
[PATCH 1/2] devtools: remove event/dlb exception in ABI check
The event/dlb driver exception can be removed, as this rule made sense for changes in DPDK_21 ABI and is obsolete for DPDK_22. Fixes: fdab8f2e1749 ("version: 21.11-rc0") Cc: sta...@dpdk.org Signed-off-by: David Marchand --- devtools/check-abi.sh | 4 1 file changed, 4 deletions(-) diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh index 675f10142e..033f6252d0 100755 --- a/devtools/check-abi.sh +++ b/devtools/check-abi.sh @@ -44,10 +44,6 @@ for dump in $(find $refdir -name "*.dump"); do echo "Skipped glue library $name." continue fi - if grep -qE "\
[PATCH 2/2] devtools: use libabigail rule for mlx glue drivers
Convert the existing exception in the ABI script into a libabigail suppression rule. Note: file_name_regexp could be used to achive the same with versions of libabigail < 1.7 but soname_regexp has been preferred here since it is already used with a recent change on common/mlx5. While at it, fix indent from a recent change. Signed-off-by: David Marchand --- devtools/check-abi.sh| 7 --- devtools/libabigail.abignore | 8 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/devtools/check-abi.sh b/devtools/check-abi.sh index 033f6252d0..64e148070d 100755 --- a/devtools/check-abi.sh +++ b/devtools/check-abi.sh @@ -37,13 +37,6 @@ fi error= for dump in $(find $refdir -name "*.dump"); do name=$(basename $dump) - # skip glue drivers, example librte_pmd_mlx5_glue.dump - # We can't rely on a suppression rule for now: - # https://sourceware.org/bugzilla/show_bug.cgi?id=25480 - if grep -qE "\
Re: [Bug 943] BUG: scheduling while atomic
On Tue, 01 Mar 2022 08:44:48 + bugzi...@dpdk.org wrote: > https://bugs.dpdk.org/show_bug.cgi?id=943 > > Bug ID: 943 >Summary: BUG: scheduling while atomic >Product: DPDK >Version: 21.11 > Hardware: All > OS: Linux > Status: UNCONFIRMED > Severity: critical > Priority: Normal > Component: examples > Assignee: dev@dpdk.org > Reporter: yun.z...@windriver.com > Target Milestone: --- > > Hi all, > > There is a "scheduling while atomic" bug when enslave a macvlan of kni > interface to a bond master. This issue can be reproduced on dpdk from > 528057df4c4fb5(kni: support promiscuous mode set). > > > The kernel message is like this. > > [ 697.574325] igb :03:00.0: removed PHC on ens8f0 > [ 697.738976] igb_uio :03:00.0: mapping 1K dma=0x40a98a000 > host=0d71c45b > [ 697.738981] igb_uio :03:00.0: unmapping 1K dma=0x40a98a000 > host=0d71c45b > [ 1200.157918] igb_uio :03:00.0: uio device registered with irq 127 > [ 1235.846792] igb_uio :03:00.0: uio device registered with irq 127 > [ 1236.441082] rte_kni: Creating kni... > [ 1236.463488] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready > [ 1238.272115] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready > [ 1271.311470] rte_kni: Successfully release kni named vEth0_0 > [ 1273.749487] igb_uio :03:00.0: uio device registered with irq 127 > [ 1274.345550] rte_kni: Creating kni... > [ 1274.367822] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready > [ 1276.275826] IPv6: ADDRCONF(NETDEV_UP): vEth0_0: link is not ready > [ 1396.811992] Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) > [ 1426.711326] bonding: remux0 is being created... > [ 1459.463366] device vEth0_0 entered promiscuous mode > [ 1459.463368] BUG: scheduling while atomic: bash/3560/0x0200 > [ 1459.463369] Modules linked in: bonding macvlan rte_kni(OE) iptable_filter > igb_uio(OE) uio vmnet(OE) vmw_vsock_vmci_transport vsock vmw_vmci vmmon(OE) > dell_rbu dcdbas nls_iso8859_1 intel_rapl x86_pkg_temp_thermal intel_powerclamp > coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul > ghash_clmulni_intel snd_hda_codec_hdmi pcbc hp_wmi sparse_keymap aesni_intel > aes_x86_64 snd_hda_codec_realtek wmi_bmof snd_hda_codec_generic crypto_simd > snd_hda_intel snd_hda_codec glue_helper cryptd serio_raw intel_cstate > intel_rapl_perf joydev input_leds snd_hda_core snd_hwdep snd_pcm snd_seq_midi > snd_seq_midi_event snd_rawmidi mei_me mei snd_seq snd_seq_device snd_timer wmi > acpi_pad i915 snd drm_kms_helper drm fb_sys_fops syscopyarea sysfillrect > sysimgblt intel_pch_thermal video soundcore shpchp mac_hid sch_fq_codel > [ 1459.463389] nfsd auth_rpcgss parport_pc ppdev nfs_acl lockd lp parport > grace sunrpc ip_tables x_tables autofs4 psmouse e1000e igb i2c_algo_bit dca > ptp > ahci pps_core libahci hid_generic usbhid hid > [ 1459.463396] CPU: 2 PID: 3560 Comm: bash Tainted: G OE > 4.15.0-167-generic #175-Ubuntu > [ 1459.463397] Hardware name: HP HP EliteDesk 800 G2 SFF/8054, BIOS N01 Ver. > 02.15 06/02/2016 > [ 1459.463397] Call Trace: > [ 1459.463403] dump_stack+0x6d/0x8b > [ 1459.463405] __schedule_bug+0x55/0x70 > [ 1459.463407] __schedule+0x658/0x890 > [ 1459.463408] ? log_store+0x226/0x270 > [ 1459.463409] schedule+0x2c/0x80 > [ 1459.463410] schedule_timeout+0x15d/0x370 > in > wait_event_interruptible_timeout > [ 1459.463412] ? __next_timer_interrupt+0xe0/0xe0 > [ 1459.463415] kni_net_process_request+0x277/0x300 [rte_kni] > [ 1459.463416] ? wait_woken+0x80/0x80 > [ 1459.463418] kni_net_change_rx_flags+0x6b/0x90 [rte_kni] > [ 1459.463420] __dev_set_promiscuity+0x121/0x1d0 > [ 1459.463421] __dev_set_rx_mode+0x83/0x90 > [ 1459.463423] dev_uc_add+0x56/0x70 > enter atomic context by calling > netif_addr_lock_bh() > [ 1459.463424] macvlan_open+0x15e/0x1d0 [macvlan] > [ 1459.463426] __dev_open+0xd3/0x160 > [ 1459.463427] dev_open+0x4e/0x90 > [ 1459.463431] bond_enslave+0x62a/0x1530 [bonding] > [ 1459.463433] ? vsscanf+0x805/0x8d0 > [ 1459.463434] ? sscanf+0x49/0x70 > [ 1459.463438] bond_option_slaves_set+0xd0/0x1a0 [bonding] > [ 1459.463441] __bond_opt_set+0x101/0x3a0 [bonding] > [ 1459.463444] __bond_opt_set_notify+0x2c/0x80 [bonding] > [ 1459.463447] bond_opt_tryset_rtnl+0x56/0xa0 [bonding] > [ 1459.463450] bonding_sysfs_store_option+0x35/0x60 [bonding] > [ 1459.463452] dev_attr_store+0x1b/0x30 > [ 1459.463453] sysfs_kf_write+0x3c/0x50 > [ 1459.463454] kernfs_fop_write+0x125/0x1a0 > [ 1459.463456] __vfs_write+0x1b/0x40 > [ 1459.463456] vfs_write+0xb1/0x1a0 > [ 1459.463457] SyS_write+0x5c/0xe0 > [ 1459.463459] do_syscall_64+0x73/0x130 > write > /sys/class/net/remux0/bonding/slaves to enslave eth5 > [ 1459.463460] entry_SYSCALL_64_after_hwframe+0x41/0xa6 > [ 1459.463461] RIP: 0033:0x7fdda9a41224 > [ 1459.463462] RSP: 002b:7ffe02de1b68 EFLAGS:
Re: [PATCH v1] net/vhost: clear data of packet mbuf after sending pkts
On Tue, 1 Mar 2022 10:47:32 +0100 David Marchand wrote: > On Tue, Mar 1, 2022 at 10:02 AM Zhang, Yuying wrote: > > > -Original Message- > > > From: David Marchand > > > Sent: Tuesday, March 1, 2022 4:44 PM > > > To: Zhang, Yuying > > > Cc: dev ; Maxime Coquelin ; > > > Xia, Chenbo ; dpdk stable > > > Subject: Re: [PATCH v1] net/vhost: clear data of packet mbuf after > > > sending pkts > > > > > > On Tue, Mar 1, 2022 at 8:29 AM Yuying Zhang > > > wrote: > > > > > > > > The PMD frees a packet mbuf back into its original mempool after > > > > sending a packet. However, old data is not cleaned up which causes > > > > error in payload of new packets. This patch clear data of packet mbuf > > > > before freeing mbuf. > > > > > > This patch looks wrong to me. > > > What is the actual issue you want to fix? > > > > eth_vhost_tx() frees the packet mbuf back into its original mempool every > > time after a packet sent without clearing the data field. > > Then packet transmit function will get bulk directly without reset. New > > generated packet contains old data of previous packet. This is wrong. > > With the proposed patch, if the mbuf refcnt is != 0, you are shooting > the data while some other part of the application might be needing it. > > Plus, there should be no expectation about a mbuf data content when > retrieving one from a mempool. > The only bytes that are guaranteed to be initialised by the mbuf API > are its metadata. > > > If there is an issue somewhere in dpdk where the mbuf data content is > expected to be 0 on allocation, please point at it. > Or share the full test that failed. > > Agree. There is no guarantee that mbuf you get was not just used by some other driver or library. Only the fields in rte_pktmbuf_reset are guaranteed to be set.
Re: [PATCH v3] sched: remove useless malloc in pie data init
On Tue, 1 Mar 2022 14:07:56 +0800 Weiguo Li wrote: > 'rte_pie_rt_data_init(NULL)' is not expected, and it's ought to > fail when this happen. The malloc inside the function didn't work. > So remove the malloc otherwise will lead to a memory leak. > > Fixes: 44c730b0e37971 ("sched: add PIE based congestion management") > > Signed-off-by: Weiguo Li Acked-by: Stephen Hemminger
RE: [PATCH v3 1/1] ethdev: mtr: support input color selection
HI Jerin, Thanks for your patch! I think we are making great progress, here are a few more comments: > +/** > + * Input color method > + */ > +enum rte_mtr_input_color_method { We should clean up the names of these methods a bit: we should not mix header names (VLAN, IP) with header field names (DSCP, PCP), in the sense that to me METHOD_VLAN_DSCP should be replaced with either: * METHOD_OUTER_VLAN_IP :shorter name, as only the headers are mentioned (my preference, but I am OK with both) * METHOD_OUTER_VLAN_PCP_IP_DSCP: longer name, as both the headers and the header fields are mentioned Please put a blank line in between these methods to better readability. I see some issues in the list of methods below, I am trying to do my best to catch them all: > + /** > + * The input color is always green. > + * The default_input_color is ignored for this method. > + * @see struct rte_mtr_params::default_input_color > + */ > + RTE_MTR_INPUT_COLOR_METHOD_COLOR_BLIND = RTE_BIT64(0), OK. > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the outermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_VLAN = RTE_BIT64(1), OK. Does your HW use PCP+DEI , or just PCP? > + /** > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the outermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_DSCP = RTE_BIT64(2), OK. Please change name to METHOD_IP. Description: Change the "outermost DSCP" to "the DSCP field of the outermost IP header". I would move this up on the second position (to follow immediately after the color blind method). > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the outermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the outermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_VLAN_DSCP = RTE_BIT64(3), OK. Please change name to METHOD_VLAN_IP. This should follow immediately after the METHOD_VLAN. Description: please use "Otherwise" before "if the input packet is IP"; please replace "outermost DSCP" as above. Is your HW using DEI + PCP or just PCP? > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the innermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN = RTE_BIT64(4), OK. Is your HW using DEI + PCP or just PCP? > + /** > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the innermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_INNER_DSCP = RTE_BIT64(5), This is very confusing to me, I don't get what this one is about: The "inner" word in the name suggests that inner VLAN is attempted first, then IP DSCP (if no VLAN is present), but the description only talks about IP. > + /** > + * If the input packet has at least one VLAN label, its input color is > + * detected by the innermost VLAN DEI(1bit), PCP(3 bits) > + * indexing into the struct rte_mtr_params::vlan_table. > + * If the input packet is IPv4 or IPv6, its input color is detected by > + * the innermost DSCP field indexing into the > + * struct rte_mtr_params::dscp_table. > + * Otherwise, the default_input_color is applied. > + * @see struct rte_mtr_params::default_input_color > + * @see struct rte_mtr_params::vlan_table > + * @see struct rte_mtr_params::dscp_table > + */ > + RTE_MTR_INPUT_COLOR_METHOD_INNER_VLAN_DSCP = > RTE_BIT64(6), OK. Des
MTU and frame size filtering inaccuracy
Hi all, There is a problem in MTU setting in DPDK. In 'rte_eth_dev_configure()'and 'rte_eth_dev_set_mtu()', MTU is converted to frame size. Since L2 protocol header size changes based on what HW supports, L2 overhead information get from PMD, but this still doesn't solve the issue. PMD reports max overhead based on what it supports, but there is no way to know what will received packets have. Sample: i40e has 26 bytes overhead: HRD_LEN + CRC_LEN + VLAN_LEN *2 when MTU set to 1500, configured frame size become 1526 When a packet received with no VLAN tag and 1504 bytes payload, packet frame size is 1522 bytes and it is accepted. So although MTU is set 1500 bytes, packet with 1504 bytes is accepted. There is an inaccuracy in frame size filtering up to 8 bytes. Damjan reported the same, and he has good point on the application need (I hope it is OK to quote from his email): 1) information about the biggest l2 frame interface it can receive and send (1518,1522, 2000 or jumbo) 2) ability to ask hardware to help him with filtering oversized frames We need to fix (2), I am not quite sure how, any comment is welcome. -- Thanks, ferruh
RE: [PATCH v3] sched: remove useless malloc in pie data init
> -Original Message- > From: Stephen Hemminger > Sent: Tuesday, March 1, 2022 5:08 PM > To: Weiguo Li > Cc: Dumitrescu, Cristian ; Singh, Jasvinder > ; wojciechx.liguzin...@intel.com; dev@dpdk.org > Subject: Re: [PATCH v3] sched: remove useless malloc in pie data init > > On Tue, 1 Mar 2022 14:07:56 +0800 > Weiguo Li wrote: > > > 'rte_pie_rt_data_init(NULL)' is not expected, and it's ought to > > fail when this happen. The malloc inside the function didn't work. > > So remove the malloc otherwise will lead to a memory leak. > > > > Fixes: 44c730b0e37971 ("sched: add PIE based congestion management") > > > > Signed-off-by: Weiguo Li > > Acked-by: Stephen Hemminger Hi Li, I suggest you also replace all the assignments to zero in this function with a memset(0) of the entire structure. I see we set all fields to zero by direct assignment, with the exception of qlen_bytes, which looks like another small issue to me that we could fix here. The memset(0) should work even if later on we might need to set some fields to a non-zero value, as this can be done immediately after the memset(0). Ok with you? Acked-by: Cristian Dumitrescu
[PATCH v4] sched: remove useless malloc in pie data init
'rte_pie_rt_data_init(NULL)' is not expected, and it's ought to fail when this happen. The malloc inside the function didn't work. So remove the malloc otherwise will lead to a memory leak. Fixes: 44c730b0e37971 ("sched: add PIE based congestion management") Signed-off-by: Weiguo Li Acked-by: Stephen Hemminger Acked-by: Cristian Dumitrescu --- v4: * replace all assignments to zero by a memset. v3: * fix typo v2: * revise according to Stephen's suggestion. --- lib/sched/rte_pie.c | 21 +++-- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c index cdb7bab697..05a456d7ac 100644 --- a/lib/sched/rte_pie.c +++ b/lib/sched/rte_pie.c @@ -15,26 +15,11 @@ int rte_pie_rt_data_init(struct rte_pie *pie) { if (pie == NULL) { - /* Allocate memory to use the PIE data structure */ - pie = rte_malloc(NULL, sizeof(struct rte_pie), 0); - - if (pie == NULL) - RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__); - - return -1; + RTE_LOG(ERR, SCHED, "%s: Invalid addr for pie\n", __func__); + return -EINVAL; } - pie->active = 0; - pie->in_measurement = 0; - pie->departed_bytes_count = 0; - pie->start_measurement = 0; - pie->last_measurement = 0; - pie->qlen = 0; - pie->avg_dq_time = 0; - pie->burst_allowance = 0; - pie->qdelay_old = 0; - pie->drop_prob = 0; - pie->accu_prob = 0; + memset(pie, 0, sizeof(*pie)); return 0; } -- 2.25.1
[PATCH 0/2] app/testpmd: external RxQ tests
Recently [1] mlx5 PMD added support for external queues, in the following patches add internal tests for in in Testpmd application. [1] https://patchwork.dpdk.org/project/dpdk/cover/20220224232511.3238707-1-michae...@nvidia.com/ Michael Baum (2): app/testpmd: add test for remote PD and CTX app/testpmd: add test for external RxQ app/test-pmd/cmdline.c | 172 +++- app/test-pmd/meson.build| 3 + app/test-pmd/testpmd.c | 153 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 60 +++ 4 files changed, 386 insertions(+), 2 deletions(-) -- 2.25.1
[PATCH 1/2] app/testpmd: add test for remote PD and CTX
Add mlx5 internal option in testpmd run-time function "port attach" to add another parameter named "mlx5_socket" for attaching port and add 2 devargs before. The arguments are "cmd_fd" and "pd_handle" using to import device created out of PMD. Testpmd application import it using IPC, and updates the devargs list before attaching. The syntax is: testpmd > port attach (identifier) mlx5_socket=(path) Where "path" is the IPC socket path agreed on the remote process. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- app/test-pmd/cmdline.c | 14 +- app/test-pmd/meson.build| 3 + app/test-pmd/testpmd.c | 153 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 40 + 4 files changed, 208 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 7ab0575e64..479e0290c4 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -773,6 +773,12 @@ static void cmd_help_long_parsed(void *parsed_result, "port attach (ident)\n" "Attach physical or virtual dev by pci address or virtual device name\n\n" +#ifdef RTE_NET_MLX5 + "port attach (ident) mlx5_socket=(path)\n" + "Attach physical or virtual dev by pci address or virtual device name " + "and add \"cmd_fd\" and \"pd_handle\" devargs before attaching\n\n" +#endif + "port detach (port_id)\n" "Detach physical or virtual dev by port_id\n\n" @@ -1379,8 +1385,12 @@ cmdline_parse_token_string_t cmd_operate_attach_port_identifier = cmdline_parse_inst_t cmd_operate_attach_port = { .f = cmd_operate_attach_port_parsed, .data = NULL, - .help_str = "port attach : " - "(identifier: pci address or virtual dev name)", + .help_str = "port attach mlx5_socket=: " + "(identifier: pci address or virtual dev name" +#ifdef RTE_NET_MLX5 + ", path (optional): socket path to get cmd FD and PD handle" +#endif + ")", .tokens = { (void *)&cmd_operate_attach_port_port, (void *)&cmd_operate_attach_port_keyword, diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index 43130c8856..c4fd379e67 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -73,3 +73,6 @@ endif if dpdk_conf.has('RTE_NET_DPAA') deps += ['bus_dpaa', 'mempool_dpaa', 'net_dpaa'] endif +if dpdk_conf.has('RTE_NET_MLX5') +deps += 'net_mlx5' +endif diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index fe2ce19f99..7ec95e5ae4 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -11,6 +11,10 @@ #include #ifndef RTE_EXEC_ENV_WINDOWS #include +#ifdef RTE_NET_MLX5 +#include +#include +#endif #endif #include #include @@ -3200,11 +3204,150 @@ reset_port(portid_t pid) printf("Done\n"); } +#if defined(RTE_NET_MLX5) && !defined(RTE_EXEC_ENV_WINDOWS) +static const char* +get_socket_path(char *extend) +{ + if (strstr(extend, "mlx5_socket=") == extend) { + const char *socket_path = strchr(extend, '=') + 1; + + TESTPMD_LOG(DEBUG, "MLX5 socket path is %s\n", socket_path); + return socket_path; + } + + TESTPMD_LOG(ERR, "Failed to extract a valid socket path from %s\n", + extend); + return NULL; +} + +static int +attach_port_extend_devargs(char *identifier, char *extend) +{ + struct sockaddr_un un = { + .sun_family = AF_UNIX, + }; + struct sockaddr_un dst = { + .sun_family = AF_UNIX, + }; + int cmd_fd; + int pd_handle; + struct iovec iov = { + .iov_base = &pd_handle, + .iov_len = sizeof(int), + }; + union { + char buf[CMSG_SPACE(sizeof(int))]; + struct cmsghdr align; + } control; + struct msghdr msgh = { + .msg_name = &dst, + .msg_namelen = sizeof(dst), + .msg_iov = NULL, + .msg_iovlen = 0, + }; + struct cmsghdr *cmsg; + const char *path = get_socket_path(extend + 1); + size_t length = 1; + int socket_fd; + int ret; + + if (path == NULL) { + TESTPMD_LOG(ERR, "Invalid devargs extension is specified\n"); + return -1; + } + + /* Initialize IPC channel. */ + socket_fd = socket(AF_UNIX, SOCK_DGRAM, 0); + if (socket_fd < 0) { + TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n", + strerror(errno)); + return -1; + } + snprintf(un.sun_path, sizeof(un.sun_path), "%s_%d", path, getpid()); + unlink(un.sun_path); /* May still exist since last run */ + if (bind(socket_fd, (s
[PATCH 2/2] app/testpmd: add test for external RxQ
Add mlx5 internal test for map and unmap external RxQs. This patch adds to Testpmd app a runtime function to test the mapping API. For insert mapping use this command: testpmd> port (port_id) ext_rxq map (rte_queue_id) (hw_queue_id) For insert mapping use this command: testpmd> port (port_id) ext_rxq unmap (rte_queue_id) Signed-off-by: Michael Baum Acked-by: Matan Azrad --- app/test-pmd/cmdline.c | 158 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 +++ 2 files changed, 178 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 479e0290c4..929680f5cb 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -63,6 +63,9 @@ #ifdef RTE_NET_BNXT #include #endif +#ifdef RTE_NET_MLX5 +#include +#endif #include "testpmd.h" #include "cmdline_mtr.h" #include "cmdline_tm.h" @@ -917,6 +920,15 @@ static void cmd_help_long_parsed(void *parsed_result, "port cleanup (port_id) txq (queue_id) (free_cnt)\n" "Cleanup txq mbufs for a specific Tx queue\n\n" + +#ifdef RTE_NET_MLX5 + "port (port_id) ext_rxq map (rte_queue_id) (hw_queue_id)\n" + "Map HW queue index (32 bit) to rte_flow queue" + " index (16 bit) for external RxQ\n\n" + + "port (port_id) ext_rxq unmap (rte_queue_id)\n" + "Unmap external Rx queue rte_flow index mapping\n\n" +#endif ); } @@ -17817,6 +17829,148 @@ cmdline_parse_inst_t cmd_show_port_flow_transfer_proxy = { } }; +#ifdef RTE_NET_MLX5 + +/* Map HW queue index to rte queue index. */ +struct cmd_map_ext_rxq { + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t ext_rxq; + cmdline_fixed_string_t map; + uint16_t rte_queue_id; + uint32_t hw_queue_id; +}; + +cmdline_parse_token_string_t cmd_map_ext_rxq_port = + TOKEN_STRING_INITIALIZER(struct cmd_map_ext_rxq, port, "port"); +cmdline_parse_token_num_t cmd_map_ext_rxq_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_map_ext_rxq, port_id, RTE_UINT16); +cmdline_parse_token_string_t cmd_map_ext_rxq_ext_rxq = + TOKEN_STRING_INITIALIZER(struct cmd_map_ext_rxq, ext_rxq, "ext_rxq"); +cmdline_parse_token_string_t cmd_map_ext_rxq_map = + TOKEN_STRING_INITIALIZER(struct cmd_map_ext_rxq, map, "map"); +cmdline_parse_token_num_t cmd_map_ext_rxq_rte_queue_id = + TOKEN_NUM_INITIALIZER(struct cmd_map_ext_rxq, rte_queue_id, RTE_UINT16); +cmdline_parse_token_num_t cmd_map_ext_rxq_hw_queue_id = + TOKEN_NUM_INITIALIZER(struct cmd_map_ext_rxq, hw_queue_id, RTE_UINT32); + +static void +cmd_map_ext_rxq_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_map_ext_rxq *res = parsed_result; + int ret; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_mlx5_external_rx_queue_id_map(res->port_id, + res->rte_queue_id, + res->hw_queue_id); + switch (ret) { + case 0: + break; + case -EINVAL: + fprintf(stderr, "invalid rte_flow index (%u), out of range\n", + res->rte_queue_id); + break; + case -ENODEV: + fprintf(stderr, "invalid port_id %u\n", res->port_id); + break; + case -ENOTSUP: + fprintf(stderr, "function not implemented or supported\n"); + break; + case -EEXIST: + fprintf(stderr, "mapping with index %u already exists\n", + res->rte_queue_id); + break; + default: + fprintf(stderr, "programming error: (%s)\n", strerror(-ret)); + } +} + +cmdline_parse_inst_t cmd_map_ext_rxq = { + .f = cmd_map_ext_rxq_parsed, + .data = NULL, + .help_str = "port ext_rxq map ", + .tokens = { + (void *)&cmd_map_ext_rxq_port, + (void *)&cmd_map_ext_rxq_port_id, + (void *)&cmd_map_ext_rxq_ext_rxq, + (void *)&cmd_map_ext_rxq_map, + (void *)&cmd_map_ext_rxq_rte_queue_id, + (void *)&cmd_map_ext_rxq_hw_queue_id, + NULL, + } +}; + +/* Unmap HW queue index to rte queue index. */ +struct cmd_unmap_ext_rxq { + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t ext_rxq; + cmdline_fixed_string_t unmap; + uint16_t queue_id; +}; + +cmdline_parse_token_string_t cmd_unmap_ext_rxq_port = + TOKEN_STRING_INITIALIZER(struct cmd_unmap_ext_rxq, port, "port"); +cmdline_parse_token_num_t cmd_unmap_ext_rxq_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_unmap_ext_
[PATCH v5] sched: remove useless malloc in pie data init
'rte_pie_rt_data_init(NULL)' is not expected, and it's ought to fail when this happen. The malloc inside the function didn't work. So remove the malloc otherwise will lead to a memory leak. Fixes: 44c730b0e37971 ("sched: add PIE based congestion management") Signed-off-by: Weiguo Li Acked-by: Stephen Hemminger Acked-by: Cristian Dumitrescu --- v5: * fix compile error v4: * replace all assignments to zero by a memset. v3: * fix typo v2: * revise according to Stephen's suggestion. --- lib/sched/rte_pie.c | 22 -- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c index cdb7bab697..d37b79e6dd 100644 --- a/lib/sched/rte_pie.c +++ b/lib/sched/rte_pie.c @@ -3,6 +3,7 @@ */ #include +#include #include "rte_pie.h" #include @@ -15,26 +16,11 @@ int rte_pie_rt_data_init(struct rte_pie *pie) { if (pie == NULL) { - /* Allocate memory to use the PIE data structure */ - pie = rte_malloc(NULL, sizeof(struct rte_pie), 0); - - if (pie == NULL) - RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__); - - return -1; + RTE_LOG(ERR, SCHED, "%s: Invalid addr for pie\n", __func__); + return -EINVAL; } - pie->active = 0; - pie->in_measurement = 0; - pie->departed_bytes_count = 0; - pie->start_measurement = 0; - pie->last_measurement = 0; - pie->qlen = 0; - pie->avg_dq_time = 0; - pie->burst_allowance = 0; - pie->qdelay_old = 0; - pie->drop_prob = 0; - pie->accu_prob = 0; + memset(pie, 0, sizeof(*pie)); return 0; } -- 2.25.1
RE: [PATCH v2 0/3] net/mlx5: fix link state detection
Hi, > -Original Message- > From: Dmitry Kozlyuk > Sent: Tuesday, March 1, 2022 2:15 PM > To: dev@dpdk.org > Subject: [PATCH v2 0/3] net/mlx5: fix link state detection > > This patchset fixes two related issues: > * In rare occasions with any HW link state change to UP was missed. > * If a port was DOWN before startup, its netdev would come UP, > but appear DOWN in DPDK (especially probable with ConnectX-4). > > v2: fix not detecting the link up when it was up before the app start. > > Dmitry Kozlyuk (3): > common/mlx5: add Netlink event helpers > net/mlx5: fix link status change detection > net/mlx5: fix initial link status detection > > drivers/common/mlx5/linux/mlx5_common_os.c | 2 +- > drivers/common/mlx5/linux/mlx5_nl.c| 102 - > drivers/common/mlx5/linux/mlx5_nl.h| 8 +- > drivers/common/mlx5/version.map| 2 + > drivers/net/mlx5/linux/mlx5_ethdev_os.c| 63 ++--- > drivers/net/mlx5/linux/mlx5_os.c | 74 +-- > drivers/net/mlx5/linux/mlx5_vlan_os.c | 2 +- > drivers/net/mlx5/mlx5.c| 1 + > drivers/net/mlx5/mlx5.h| 3 + > drivers/net/mlx5/mlx5_trigger.c| 12 ++- > 10 files changed, 241 insertions(+), 28 deletions(-) > > -- > 2.25.1 Series applied to next-net-mlx, Kindest regards, Raslan Darawsheh
[PATCH] app/testpmd: fix flow creation parsing
A pattern template creation shares the parsing mechanism with a simple flow creation. The pattern template creation only consists of pattern items while the flow creation continues with actions. The parsing mechanism now accommodates both cases and allows to stop at the item end token, which should not happen for the flow creation. Fix parsing mechanism to differentiate between these two cases. Bugzilla ID: 941 Fixes: 04cc665fab ("app/testpmd: add flow template management") Signed-off-by: Alexander Kozyrev --- app/test-pmd/cmdline_flow.c | 8 1 file changed, 8 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 4f7a9f17f9..fc4a6d9cca 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -6864,6 +6864,14 @@ parse_vc(struct context *ctx, const struct token *token, ctx->object = out->args.vc.pattern; ctx->objmask = NULL; return len; + case ITEM_END: + if ((out->command == VALIDATE || out->command == CREATE) && + ctx->last) + return -1; + if (out->command == PATTERN_TEMPLATE_CREATE && + !ctx->last) + return -1; + break; case ACTIONS: out->args.vc.actions = (void *)RTE_ALIGN_CEIL((uintptr_t) -- 2.18.2
[PATCH 1/2] event/cnxk: fix incorrect mask length
From: Pavan Nikhilesh Fix incorrect mask used when clearing subevent type masking out useful data. Fixes: e239e0d3faf7 ("event/cnxk: add SSO HW device operations") Signed-off-by: Pavan Nikhilesh --- drivers/event/cnxk/cnxk_eventdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h index b157fef096..5564746e6d 100644 --- a/drivers/event/cnxk/cnxk_eventdev.h +++ b/drivers/event/cnxk/cnxk_eventdev.h @@ -43,7 +43,7 @@ #define CNXK_TT_FROM_EVENT(x) (((x) >> 38) & SSO_TT_EMPTY) #define CNXK_EVENT_TYPE_FROM_TAG(x) (((x) >> 28) & 0xf) #define CNXK_SUB_EVENT_FROM_TAG(x) (((x) >> 20) & 0xff) -#define CNXK_CLR_SUB_EVENT(x) (~(0xffu << 20) & x) +#define CNXK_CLR_SUB_EVENT(x) (~(0xffull << 20) & x) #define CNXK_GRP_FROM_TAG(x) (((x) >> 36) & 0x3ff) #define CNXK_SWTAG_PEND(x) (BIT_ULL(62) & x) #define CNXK_TAG_IS_HEAD(x)(BIT_ULL(35) & x) -- 2.17.1
[PATCH 2/2] event/cnxk: fix incorrect Rx adapter config checks
From: Pavan Nikhilesh The rx_queue_flags should be checked against RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID flag. Fixes: cb4bfd6e7bdf ("event/cnxk: support Rx adapter") Signed-off-by: Pavan Nikhilesh --- drivers/event/cnxk/cnxk_eventdev_adptr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/event/cnxk/cnxk_eventdev_adptr.c b/drivers/event/cnxk/cnxk_eventdev_adptr.c index 7b580ca98f..bfc89a1368 100644 --- a/drivers/event/cnxk/cnxk_eventdev_adptr.c +++ b/drivers/event/cnxk/cnxk_eventdev_adptr.c @@ -230,7 +230,7 @@ cnxk_sso_rx_adapter_queue_add( cnxk_eth_dev, (uint16_t)rx_queue_id, port, &queue_conf->ev, !!(queue_conf->rx_queue_flags & - RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)); + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID)); if (queue_conf->rx_queue_flags & RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR) { cnxk_sso_updt_xae_cnt(dev, queue_conf->vector_mp, -- 2.17.1
[Bug 945] [DPDK. 22.03-rc2] net/mlx5 - Failed to import device for fd=0; Operation Not Supported
https://bugs.dpdk.org/show_bug.cgi?id=945 Bug ID: 945 Summary: [DPDK. 22.03-rc2] net/mlx5 - Failed to import device for fd=0; Operation Not Supported Product: DPDK Version: unspecified Hardware: POWER OS: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: other Assignee: dev@dpdk.org Reporter: d...@linux.vnet.ibm.com Target Milestone: --- Building DPDK 22.03-rc2 on a PowerNV P9 system with Ubuntu 20.04.3 and upstream RDMA libraries. Running l2fwd application generates the following error: sudo ./build/examples/dpdk-l2fwd -l 8-15 -n 4 -- -q 1 -p 0x3 EAL: Detected CPU lcores: 128 EAL: Detected NUMA nodes: 2 EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: VFIO support initialized EAL: Probe PCI driver: mlx5_pci (15b3:1019) device: :01:00.0 (socket 0) mlx5_common: Failed to import device for fd=0: Operation not supported mlx5_common: Failed to initialize device context. EAL: Requested device :01:00.0 cannot be used EAL: Probe PCI driver: mlx5_pci (15b3:1019) device: :01:00.1 (socket 0) mlx5_common: Failed to import device for fd=0: Operation not supported mlx5_common: Failed to initialize device context. EAL: Requested device :01:00.1 cannot be used EAL: Probe PCI driver: mlx5_pci (15b3:1019) device: 0030:01:00.0 (socket 8) mlx5_common: Failed to import device for fd=0: Operation not supported mlx5_common: Failed to initialize device context. EAL: Requested device 0030:01:00.0 cannot be used EAL: Probe PCI driver: mlx5_pci (15b3:1019) device: 0030:01:00.1 (socket 8) mlx5_common: Failed to import device for fd=0: Operation not supported mlx5_common: Failed to initialize device context. EAL: Requested device 0030:01:00.1 cannot be used TELEMETRY: No legacy callbacks, legacy socket not created MAC updating enabled EAL: Error - exiting with code: 1 Cause: No Ethernet ports - bye Running "git bisect" identifies the following commit as causing the problem: 9d936f4f1a - common/mlx5: glue device and PD import -- You are receiving this mail because: You are the assignee for the bug.
[PATCH] net/mlx5: fix modify port action validation
Certain flows containing a modify header action for an L4 port could be erroneously rejected as invalid, because this action was counted as consuming two HW actions, while it only requires one. Fixes: 72a944dba163 ("net/mlx5: fix header modify action validation") Cc: sta...@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index e510921a3f..e3af8fcdf9 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -427,7 +427,7 @@ enum mlx5_feature_name { #define MLX5_ACT_NUM_MDF_IPV6 4 #define MLX5_ACT_NUM_MDF_MAC 2 #define MLX5_ACT_NUM_MDF_VID 1 -#define MLX5_ACT_NUM_MDF_PORT 2 +#define MLX5_ACT_NUM_MDF_PORT 1 #define MLX5_ACT_NUM_MDF_TTL 1 #define MLX5_ACT_NUM_DEC_TTL MLX5_ACT_NUM_MDF_TTL #define MLX5_ACT_NUM_MDF_TCPSEQ1 -- 2.25.1
[PATCH v6 0/4] ice repr functions by DCF
This feature add some functions associated with representor: 1. DCF is able to configure the VLAN filter for VFs. 2. DCF is able to configure promiscuous mode for VFs 3. Add / Remove VF mac address 4. display VF stats; 5. reset VF stats Ke Zhang (3): net/ice: add support for display/reset stats by DCF net/ice: add support for add/remove mac addr by DCF net/ice: add support to configure the VLAN filter by DCF Yiding Zhou (1): net/ice: add support for setting promisc by DCF drivers/net/ice/ice_dcf_ethdev.h | 1 + drivers/net/ice/ice_dcf_vf_representor.c | 317 +-- 2 files changed, 300 insertions(+), 18 deletions(-) -- 2.25.1
[PATCH v6 1/4] net/ice: add support for setting promisc by DCF
From: Yiding Zhou allow to enable/disable VFs promisc mode over VF0. this feature need to update ice kernel driver (newer than v1.8.0) Signed-off-by: Yiding Zhou Signed-off-by: Ke Zhang --- drivers/net/ice/ice_dcf_vf_representor.c | 56 +--- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c index b9fcfc80ad..781282f68c 100644 --- a/drivers/net/ice/ice_dcf_vf_representor.c +++ b/drivers/net/ice/ice_dcf_vf_representor.c @@ -10,6 +10,20 @@ #include "ice_dcf_ethdev.h" #include "ice_rxtx.h" +static __rte_always_inline struct ice_dcf_hw * +ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr) +{ + struct ice_dcf_adapter *dcf_adapter = + repr->dcf_eth_dev->data->dev_private; + + if (!dcf_adapter) { + PMD_DRV_LOG(ERR, "DCF for VF representor has been released\n"); + return NULL; + } + + return &dcf_adapter->real_hw; +} + static uint16_t ice_dcf_vf_repr_rx_burst(__rte_unused void *rxq, __rte_unused struct rte_mbuf **rx_pkts, @@ -78,15 +92,36 @@ ice_dcf_vf_repr_tx_queue_setup(__rte_unused struct rte_eth_dev *dev, } static int -ice_dcf_vf_repr_promiscuous_enable(__rte_unused struct rte_eth_dev *ethdev) +ice_dcf_vf_repr_promiscuous_enable(struct rte_eth_dev *ethdev) { - return 0; + struct ice_dcf_vf_repr *repr = ethdev->data->dev_private; + struct dcf_virtchnl_cmd args; + struct virtchnl_promisc_info promisc; + struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr); + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; + promisc.flags = 0; + promisc.vsi_id = hw->vf_vsi_map[repr->vf_id] & ~VIRTCHNL_DCF_VF_VSI_VALID; + promisc.flags |= FLAG_VF_UNICAST_PROMISC; + args.req_msg = (uint8_t *)&promisc; + args.req_msglen = sizeof(promisc); + return ice_dcf_execute_virtchnl_cmd(hw, &args); } static int -ice_dcf_vf_repr_promiscuous_disable(__rte_unused struct rte_eth_dev *ethdev) +ice_dcf_vf_repr_promiscuous_disable(struct rte_eth_dev *ethdev) { - return 0; + struct ice_dcf_vf_repr *repr = ethdev->data->dev_private; + struct dcf_virtchnl_cmd args; + struct virtchnl_promisc_info promisc; + struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr); + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; + promisc.flags = 0; + promisc.vsi_id = hw->vf_vsi_map[repr->vf_id] & ~VIRTCHNL_DCF_VF_VSI_VALID; + args.req_msg = (uint8_t *)&promisc; + args.req_msglen = sizeof(promisc); + return ice_dcf_execute_virtchnl_cmd(hw, &args); } static int @@ -108,19 +143,6 @@ ice_dcf_vf_repr_link_update(__rte_unused struct rte_eth_dev *ethdev, return 0; } -static __rte_always_inline struct ice_dcf_hw * -ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr) -{ - struct ice_dcf_adapter *dcf_adapter = - repr->dcf_eth_dev->data->dev_private; - - if (!dcf_adapter) { - PMD_DRV_LOG(ERR, "DCF for VF representor has been released\n"); - return NULL; - } - - return &dcf_adapter->real_hw; -} static int ice_dcf_vf_repr_dev_info_get(struct rte_eth_dev *dev, -- 2.25.1
[PATCH v6 2/4] net/ice: add support for display/reset stats by DCF
allow to display/reset VFs stats over VF0. this feature need to update ice kernel driver (newer than v1.8.0) Signed-off-by: Ke Zhang --- drivers/net/ice/ice_dcf_vf_representor.c | 129 +++ 1 file changed, 129 insertions(+) diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c index 781282f68c..765f5d4c95 100644 --- a/drivers/net/ice/ice_dcf_vf_representor.c +++ b/drivers/net/ice/ice_dcf_vf_representor.c @@ -10,6 +10,10 @@ #include "ice_dcf_ethdev.h" #include "ice_rxtx.h" +#define ICE_DCF_REPR_32_BIT_WIDTH (CHAR_BIT * 4) +#define ICE_DCF_REPR_48_BIT_WIDTH (CHAR_BIT * 6) +#define ICE_DCF_REPR_48_BIT_MASK RTE_LEN2MASK(ICE_DCF_REPR_48_BIT_WIDTH, uint64_t) + static __rte_always_inline struct ice_dcf_hw * ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr) { @@ -409,6 +413,129 @@ ice_dcf_vf_repr_vlan_tpid_set(struct rte_eth_dev *dev, return 0; } +static int +ice_dcf_repr_query_stats(struct ice_dcf_hw *hw, +uint16_t vf_id, struct virtchnl_eth_stats *pstats) +{ + struct virtchnl_queue_select q_stats; + struct dcf_virtchnl_cmd args; + int err; + + memset(&q_stats, 0, sizeof(q_stats)); + q_stats.vsi_id = hw->vf_vsi_map[vf_id] & ~VIRTCHNL_DCF_VF_VSI_VALID; + + args.v_op = VIRTCHNL_OP_GET_STATS; + args.req_msg = (uint8_t *)&q_stats; + args.req_msglen = sizeof(q_stats); + args.rsp_msglen = sizeof(struct virtchnl_eth_stats); + args.rsp_msgbuf = (uint8_t *)pstats; + args.rsp_buflen = sizeof(struct virtchnl_eth_stats); + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) { + PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS"); + return err; + } + + return 0; +} + +static int +ice_dcf_vf_repr_stats_reset(struct rte_eth_dev *dev) +{ + struct ice_dcf_vf_repr *repr = dev->data->dev_private; + struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr); + struct virtchnl_eth_stats pstats; + int ret; + + if (hw->resetting) + return 0; + + /* read stat values to clear hardware registers */ + ret = ice_dcf_repr_query_stats(hw, repr->vf_id, &pstats); + if (ret != 0) + return ret; + + /* set stats offset base on current values */ + hw->eth_stats_offset = pstats; + + return 0; +} + +static void +ice_dcf_stat_update_48(uint64_t *offset, uint64_t *stat) +{ + if (*stat >= *offset) + *stat = *stat - *offset; + else + *stat = (uint64_t)((*stat + + ((uint64_t)1 << ICE_DCF_REPR_48_BIT_WIDTH)) - *offset); + + *stat &= ICE_DCF_REPR_48_BIT_MASK; +} + +static void +ice_dcf_stat_update_32(uint64_t *offset, uint64_t *stat) +{ + if (*stat >= *offset) + *stat = (uint64_t)(*stat - *offset); + else + *stat = (uint64_t)((*stat + + ((uint64_t)1 << ICE_DCF_REPR_32_BIT_WIDTH)) - *offset); +} + +static void +ice_dcf_update_stats(struct ice_dcf_hw *hw, struct virtchnl_eth_stats *nes) +{ + struct virtchnl_eth_stats *oes = &hw->eth_stats_offset; + + ice_dcf_stat_update_48(&oes->rx_bytes, &nes->rx_bytes); + ice_dcf_stat_update_48(&oes->rx_unicast, &nes->rx_unicast); + ice_dcf_stat_update_48(&oes->rx_multicast, &nes->rx_multicast); + ice_dcf_stat_update_48(&oes->rx_broadcast, &nes->rx_broadcast); + ice_dcf_stat_update_32(&oes->rx_discards, &nes->rx_discards); + ice_dcf_stat_update_48(&oes->tx_bytes, &nes->tx_bytes); + ice_dcf_stat_update_48(&oes->tx_unicast, &nes->tx_unicast); + ice_dcf_stat_update_48(&oes->tx_multicast, &nes->tx_multicast); + ice_dcf_stat_update_48(&oes->tx_broadcast, &nes->tx_broadcast); + ice_dcf_stat_update_32(&oes->tx_errors, &nes->tx_errors); + ice_dcf_stat_update_32(&oes->tx_discards, &nes->tx_discards); +} + +static int +ice_dcf_vf_repr_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + struct ice_dcf_vf_repr *repr = dev->data->dev_private; + struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr); + struct virtchnl_eth_stats pstats; + int ret; + + if (hw->resetting) { + PMD_DRV_LOG(ERR, + "The DCF has been reset by PF, please reinit first"); + return -EIO; + } + + ret = ice_dcf_repr_query_stats(hw, repr->vf_id, &pstats); + if (ret == 0) { + uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads & +RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 : +RTE_ETHER_CRC_LEN; + ice_dcf_update_stats(hw, &pstats); + stats->ipackets = pstats.rx_unicast + pstats.rx_multicast + + pstats.rx_broadcast - pstats.rx_discards; + stats->opackets = pstats.tx_broadcast + psta
[PATCH v6 3/4] net/ice: add support for add/remove mac addr by DCF
allow to add/remove VF's mac addr over VF0. this feature need to update ice kernel driver (newer than v1.8.0) Signed-off-by: Ke Zhang --- drivers/net/ice/ice_dcf_ethdev.h | 1 + drivers/net/ice/ice_dcf_vf_representor.c | 81 +++- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_ethdev.h index 11a1305038..ea5c020d61 100644 --- a/drivers/net/ice/ice_dcf_ethdev.h +++ b/drivers/net/ice/ice_dcf_ethdev.h @@ -50,6 +50,7 @@ struct ice_dcf_vf_repr { struct rte_ether_addr mac_addr; uint16_t switch_domain_id; uint16_t vf_id; + uint16_t mac_num; /* Number of MAC addresses */ struct ice_dcf_vlan outer_vlan_info; /* DCF always handle outer VLAN */ }; diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c index 765f5d4c95..8a387461c4 100644 --- a/drivers/net/ice/ice_dcf_vf_representor.c +++ b/drivers/net/ice/ice_dcf_vf_representor.c @@ -159,7 +159,7 @@ ice_dcf_vf_repr_dev_info_get(struct rte_eth_dev *dev, return -EIO; dev_info->device = dev->device; - dev_info->max_mac_addrs = 1; + dev_info->max_mac_addrs = ICE_NUM_MACADDR_MAX; dev_info->max_rx_queues = dcf_hw->vsi_res->num_queue_pairs; dev_info->max_tx_queues = dcf_hw->vsi_res->num_queue_pairs; dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN; @@ -536,6 +536,82 @@ ice_dcf_vf_repr_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) } return ret; } +static int +ice_dcf_repr_add_del_eth_addr(struct ice_dcf_hw *hw, + uint16_t vf_id, + struct rte_ether_addr *addr, + bool add, uint8_t type) +{ + struct virtchnl_ether_addr_list *list; + struct dcf_virtchnl_cmd args; + uint8_t cmd_buffer[sizeof(struct virtchnl_ether_addr_list) + + sizeof(struct virtchnl_ether_addr)]; + int err; + + list = (struct virtchnl_ether_addr_list *)cmd_buffer; + list->vsi_id = hw->vf_vsi_map[vf_id] & ~VIRTCHNL_DCF_VF_VSI_VALID; + list->num_elements = 1; + list->list[0].type = type; + rte_memcpy(list->list[0].addr, addr->addr_bytes, + sizeof(addr->addr_bytes)); + + args.v_op = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR; + args.req_msg = cmd_buffer; + args.req_msglen = sizeof(cmd_buffer); + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) { + PMD_DRV_LOG(ERR, "Fail to execute command %s", + add ? "OP_ADD_ETH_ADDR" : "OP_DEL_ETH_ADDR"); + return err; + } + + return 0; +} + +static int +ice_dcf_vf_repr_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, +__rte_unused uint32_t index, +__rte_unused uint32_t pool) +{ + struct ice_dcf_vf_repr *repr = dev->data->dev_private; + struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr); + int err; + + if (rte_is_zero_ether_addr(addr)) { + PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); + return -EINVAL; + } + + err = ice_dcf_repr_add_del_eth_addr(hw, repr->vf_id, addr, true, VIRTCHNL_ETHER_ADDR_EXTRA); + if (err) { + PMD_DRV_LOG(ERR, "fail to add MAC address"); + return -EIO; + } + + repr->mac_num++; + + return 0; +} + +static void +ice_dcf_vf_repr_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) +{ + struct ice_dcf_vf_repr *repr = dev->data->dev_private; + struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr); + struct rte_ether_addr *addr; + int err; + + addr = &dev->data->mac_addrs[index]; + + err = ice_dcf_repr_add_del_eth_addr(hw, repr->vf_id, addr, + false, VIRTCHNL_ETHER_ADDR_EXTRA); + if (err) + PMD_DRV_LOG(ERR, "fail to del MAC address"); + + repr->mac_num--; +} + static const struct eth_dev_ops ice_dcf_vf_repr_dev_ops = { .dev_configure= ice_dcf_vf_repr_dev_configure, .dev_start= ice_dcf_vf_repr_dev_start, @@ -554,6 +630,8 @@ static const struct eth_dev_ops ice_dcf_vf_repr_dev_ops = { .vlan_tpid_set= ice_dcf_vf_repr_vlan_tpid_set, .stats_reset = ice_dcf_vf_repr_stats_reset, .stats_get= ice_dcf_vf_repr_stats_get, + .mac_addr_add = ice_dcf_vf_repr_add_mac_addr, + .mac_addr_remove = ice_dcf_vf_repr_del_mac_addr, }; int @@ -568,6 +646,7 @@ ice_dcf_vf_repr_init(struct rte_eth_dev *vf_rep_eth_dev, void *init_param) repr->outer_vlan_info.port_vlan_ena = false; repr->outer_vlan_info.stripping_ena = false; repr->outer_vlan_info.tpid = RTE_ETHER_TYPE_VLAN; + repr->mac_num = 1; vf_rep_eth_dev->dev_op
[PATCH v6 4/4] net/ice: add support to configure the VLAN filter by DCF
allow to configure the VLAN filter over VF0. this feature need to update ice kernel driver (newer than v1.8.0) Signed-off-by: Ke Zhang --- drivers/net/ice/ice_dcf_vf_representor.c | 51 1 file changed, 51 insertions(+) diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c index 8a387461c4..eca2710735 100644 --- a/drivers/net/ice/ice_dcf_vf_representor.c +++ b/drivers/net/ice/ice_dcf_vf_representor.c @@ -612,6 +612,56 @@ ice_dcf_vf_repr_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) repr->mac_num--; } +static int +ice_dcf_add_del_vlan_v2(struct rte_eth_dev *dev, uint16_t vlanid, bool add) +{ + struct ice_dcf_vf_repr *repr = dev->data->dev_private; + struct ice_dcf_hw *hw = ice_dcf_vf_repr_hw(repr); + struct virtchnl_vlan_filter_list_v2 vlan_filter; + struct dcf_virtchnl_cmd args; + struct virtchnl_vlan *vlan_setting; + int err; + + vlan_setting = &vlan_filter.filters[0].outer; + memset(&vlan_filter, 0, sizeof(vlan_filter)); + vlan_filter.vport_id = hw->vf_vsi_map[repr->vf_id] & ~VIRTCHNL_DCF_VF_VSI_VALID; + vlan_filter.num_elements = 1; + vlan_setting->tpid = RTE_ETHER_TYPE_VLAN; + vlan_setting->tci = vlanid; + + memset(&args, 0, sizeof(args)); + args.v_op = add ? VIRTCHNL_OP_ADD_VLAN_V2 : VIRTCHNL_OP_DEL_VLAN_V2; + args.req_msg = (uint8_t *)&vlan_filter; + args.req_msglen = sizeof(vlan_filter); + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) { + PMD_DRV_LOG(ERR, "Fail to execute command %s", + add ? "OP_ADD_ETH_ADDR" : "OP_DEL_ETH_ADDR"); + return err; + } + return 0; +} + +static int +ice_dcf_vf_repr_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) +{ + struct ice_dcf_vf_repr *repr = dev->data->dev_private; + int err; + + if (!ice_dcf_vlan_offload_ena(repr)) { + PMD_DRV_LOG(ERR, "It is not VLAN_V2"); + return -ENOTSUP; + } + + err = ice_dcf_add_del_vlan_v2(dev, vlan_id, on); + if (err) { + PMD_DRV_LOG(ERR, "Failed to set vlan filter, err:%d", err); + return -ENOTSUP; + } + return 0; +} + static const struct eth_dev_ops ice_dcf_vf_repr_dev_ops = { .dev_configure= ice_dcf_vf_repr_dev_configure, .dev_start= ice_dcf_vf_repr_dev_start, @@ -632,6 +682,7 @@ static const struct eth_dev_ops ice_dcf_vf_repr_dev_ops = { .stats_get= ice_dcf_vf_repr_stats_get, .mac_addr_add = ice_dcf_vf_repr_add_mac_addr, .mac_addr_remove = ice_dcf_vf_repr_del_mac_addr, + .vlan_filter_set = ice_dcf_vf_repr_vlan_filter_set, }; int -- 2.25.1
[PATCH 0/2] net/mlx5: external RxQ fixes
Some fixes about external RxQ support. They fix missing refcnt updating in some places. Michael Baum (2): net/mlx5: fix external RQ dereferencing net/mlx5: fix external RQ refrencing drivers/net/mlx5/mlx5_rxq.c | 158 ++-- 1 file changed, 97 insertions(+), 61 deletions(-) -- 2.25.1
[PATCH 1/2] net/mlx5: fix external RQ dereferencing
When an indirection table is destroyed, each RX queue related to it, should be dereferenced. The regular queues are indeed dereferenced. However, the external RxQs are not. This patch adds dereferencing for external RxQs too. Fixes: 311b17e669ab ("net/mlx5: support queue/RSS actions for external Rx queue") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 41 ++--- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index ff293d9d56..19c75b7b32 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2143,6 +2143,30 @@ mlx5_ext_rxq_get(struct rte_eth_dev *dev, uint16_t idx) return &priv->ext_rxqs[idx - MLX5_EXTERNAL_RX_QUEUE_ID_MIN]; } +/** + * Dereference a list of Rx queues. + * + * @param dev + * Pointer to Ethernet device. + * @param queues + * List of Rx queues to deref. + * @param queues_n + * Number of queues in the array. + */ +static void +mlx5_rxqs_deref(struct rte_eth_dev *dev, uint16_t *queues, + const uint32_t queues_n) +{ + uint32_t i; + + for (i = 0; i < queues_n; i++) { + if (mlx5_is_external_rxq(dev, queues[i])) + claim_nonzero(mlx5_ext_rxq_deref(dev, queues[i])); + else + claim_nonzero(mlx5_rxq_deref(dev, queues[i])); + } +} + /** * Release a Rx queue. * @@ -2377,7 +2401,7 @@ mlx5_ind_table_obj_release(struct rte_eth_dev *dev, bool deref_rxqs) { struct mlx5_priv *priv = dev->data->dev_private; - unsigned int i, ret; + unsigned int ret; rte_rwlock_write_lock(&priv->ind_tbls_lock); ret = __atomic_sub_fetch(&ind_tbl->refcnt, 1, __ATOMIC_RELAXED); @@ -2387,10 +2411,8 @@ mlx5_ind_table_obj_release(struct rte_eth_dev *dev, if (ret) return 1; priv->obj_ops.ind_table_destroy(ind_tbl); - if (deref_rxqs) { - for (i = 0; i != ind_tbl->queues_n; ++i) - claim_nonzero(mlx5_rxq_deref(dev, ind_tbl->queues[i])); - } + if (deref_rxqs) + mlx5_rxqs_deref(dev, ind_tbl->queues, ind_tbl->queues_n); mlx5_free(ind_tbl); return 0; } @@ -2443,7 +2465,7 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, struct mlx5_priv *priv = dev->data->dev_private; uint32_t queues_n = ind_tbl->queues_n; uint16_t *queues = ind_tbl->queues; - unsigned int i = 0, j; + unsigned int i = 0; int ret = 0, err; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : @@ -2471,12 +2493,7 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, error: if (ref_qs) { err = rte_errno; - for (j = 0; j < i; j++) { - if (mlx5_is_external_rxq(dev, queues[j])) - mlx5_ext_rxq_deref(dev, queues[j]); - else - mlx5_rxq_deref(dev, queues[j]); - } + mlx5_rxqs_deref(dev, queues, i); rte_errno = err; } DRV_LOG(DEBUG, "Port %u cannot setup indirection table.", -- 2.25.1
[PATCH 2/2] net/mlx5: fix external RQ refrencing
When an indirection table object is modified, it updates the reference counter for each RX queue related to it. The reference counter for regular queues are indeed updated. However, the reference counter for external RxQs are not. This patch adds updating for external RxQs too. Fixes: 311b17e669ab ("net/mlx5: support queue/RSS actions for external Rx queue") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 121 +--- 1 file changed, 70 insertions(+), 51 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 19c75b7b32..f16795bac3 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2167,6 +2167,41 @@ mlx5_rxqs_deref(struct rte_eth_dev *dev, uint16_t *queues, } } +/** + * Increase reference count for list of Rx queues. + * + * @param dev + * Pointer to Ethernet device. + * @param queues + * List of Rx queues to ref. + * @param queues_n + * Number of queues in the array. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +static int +mlx5_rxqs_ref(struct rte_eth_dev *dev, uint16_t *queues, + const uint32_t queues_n) +{ + uint32_t i; + + for (i = 0; i != queues_n; ++i) { + if (mlx5_is_external_rxq(dev, queues[i])) { + if (mlx5_ext_rxq_ref(dev, queues[i]) == NULL) + goto error; + } else { + if (mlx5_rxq_ref(dev, queues[i]) == NULL) + goto error; + } + } + return 0; +error: + mlx5_rxqs_deref(dev, queues, i); + rte_errno = EINVAL; + return -rte_errno; +} + /** * Release a Rx queue. * @@ -2464,41 +2499,30 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, { struct mlx5_priv *priv = dev->data->dev_private; uint32_t queues_n = ind_tbl->queues_n; - uint16_t *queues = ind_tbl->queues; - unsigned int i = 0; - int ret = 0, err; + int ret; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : log2above(priv->sh->dev_cap.ind_table_max_size); - if (ref_qs) - for (i = 0; i != queues_n; ++i) { - if (mlx5_is_external_rxq(dev, queues[i])) { - if (mlx5_ext_rxq_ref(dev, queues[i]) == NULL) { - ret = -rte_errno; - goto error; - } - } else { - if (mlx5_rxq_ref(dev, queues[i]) == NULL) { - ret = -rte_errno; - goto error; - } - } - } + if (ref_qs && mlx5_rxqs_ref(dev, ind_tbl->queues, queues_n) < 0) { + DRV_LOG(DEBUG, "Port %u invalid indirection table queues.", + dev->data->port_id); + return -rte_errno; + } ret = priv->obj_ops.ind_table_new(dev, n, ind_tbl); - if (ret) - goto error; + if (ret) { + DRV_LOG(DEBUG, "Port %u cannot create a new indirection table.", + dev->data->port_id); + if (ref_qs) { + int err = rte_errno; + + mlx5_rxqs_deref(dev, ind_tbl->queues, queues_n); + rte_errno = err; + } + return ret; + } __atomic_fetch_add(&ind_tbl->refcnt, 1, __ATOMIC_RELAXED); return 0; -error: - if (ref_qs) { - err = rte_errno; - mlx5_rxqs_deref(dev, queues, i); - rte_errno = err; - } - DRV_LOG(DEBUG, "Port %u cannot setup indirection table.", - dev->data->port_id); - return ret; } /** @@ -2603,8 +2627,7 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, bool standalone, bool ref_new_qs, bool deref_old_qs) { struct mlx5_priv *priv = dev->data->dev_private; - unsigned int i = 0, j; - int ret = 0, err; + int ret; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : log2above(priv->sh->dev_cap.ind_table_max_size); @@ -2613,33 +2636,29 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, RTE_SET_USED(standalone); if (mlx5_ind_table_obj_check_standalone(dev, ind_tbl) < 0) return -rte_errno; - if (ref_new_qs) - for (i = 0; i != queues_n; ++i) { - if (!mlx5_rxq_ref(dev, queues[i])) { - ret = -rte_errno; - goto error; -
[PATCH] net/mlx5: fix the needless reference count for table
In the previous implementation, a count was used to record the number of the references to a table resource, including the creation of the table, the jumping to the table and the matchers created on the table. Before releasing the table resource via the driver, it needed to ensure that there is no reference to this table. After the optimization of the resources management, the reference count now is in the hash list entry as a unified solution for all the resources management. There is no need to keep the "refcnt" in the table resource structure. It is removed in case that there is some unnecessary memory overhead. Fixes: afd7a62514ad ("net/mlx5: make flow table cache thread safe") Cc: xuemi...@nvidia.com Cc: sta...@dpdk.org Signed-off-by: Bing Zhao Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 0f0045a2b5..dd5cd9209f 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -993,7 +993,6 @@ union mlx5_flow_tbl_key { /* Table structure. */ struct mlx5_flow_tbl_resource { void *obj; /**< Pointer to DR table object. */ - uint32_t refcnt; /**< Reference counter. */ }; #define MLX5_MAX_TABLES UINT16_MAX -- 2.25.1
[PATCH v2 0/2] net/mlx5: external RxQ fixes
Some fixes about external RxQ support. They fix missing refcnt updating in some places. v2: fix typo refrencing -> referencing. Michael Baum (2): net/mlx5: fix external RQ dereferencing net/mlx5: fix external RQ referencing drivers/net/mlx5/mlx5_rxq.c | 158 ++-- 1 file changed, 97 insertions(+), 61 deletions(-) -- 2.25.1
[PATCH v2 1/2] net/mlx5: fix external RQ dereferencing
When an indirection table is destroyed, each RX queue related to it, should be dereferenced. The regular queues are indeed dereferenced. However, the external RxQs are not. This patch adds dereferencing for external RxQs too. Fixes: 311b17e669ab ("net/mlx5: support queue/RSS actions for external Rx queue") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 41 ++--- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index ff293d9d56..19c75b7b32 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2143,6 +2143,30 @@ mlx5_ext_rxq_get(struct rte_eth_dev *dev, uint16_t idx) return &priv->ext_rxqs[idx - MLX5_EXTERNAL_RX_QUEUE_ID_MIN]; } +/** + * Dereference a list of Rx queues. + * + * @param dev + * Pointer to Ethernet device. + * @param queues + * List of Rx queues to deref. + * @param queues_n + * Number of queues in the array. + */ +static void +mlx5_rxqs_deref(struct rte_eth_dev *dev, uint16_t *queues, + const uint32_t queues_n) +{ + uint32_t i; + + for (i = 0; i < queues_n; i++) { + if (mlx5_is_external_rxq(dev, queues[i])) + claim_nonzero(mlx5_ext_rxq_deref(dev, queues[i])); + else + claim_nonzero(mlx5_rxq_deref(dev, queues[i])); + } +} + /** * Release a Rx queue. * @@ -2377,7 +2401,7 @@ mlx5_ind_table_obj_release(struct rte_eth_dev *dev, bool deref_rxqs) { struct mlx5_priv *priv = dev->data->dev_private; - unsigned int i, ret; + unsigned int ret; rte_rwlock_write_lock(&priv->ind_tbls_lock); ret = __atomic_sub_fetch(&ind_tbl->refcnt, 1, __ATOMIC_RELAXED); @@ -2387,10 +2411,8 @@ mlx5_ind_table_obj_release(struct rte_eth_dev *dev, if (ret) return 1; priv->obj_ops.ind_table_destroy(ind_tbl); - if (deref_rxqs) { - for (i = 0; i != ind_tbl->queues_n; ++i) - claim_nonzero(mlx5_rxq_deref(dev, ind_tbl->queues[i])); - } + if (deref_rxqs) + mlx5_rxqs_deref(dev, ind_tbl->queues, ind_tbl->queues_n); mlx5_free(ind_tbl); return 0; } @@ -2443,7 +2465,7 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, struct mlx5_priv *priv = dev->data->dev_private; uint32_t queues_n = ind_tbl->queues_n; uint16_t *queues = ind_tbl->queues; - unsigned int i = 0, j; + unsigned int i = 0; int ret = 0, err; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : @@ -2471,12 +2493,7 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, error: if (ref_qs) { err = rte_errno; - for (j = 0; j < i; j++) { - if (mlx5_is_external_rxq(dev, queues[j])) - mlx5_ext_rxq_deref(dev, queues[j]); - else - mlx5_rxq_deref(dev, queues[j]); - } + mlx5_rxqs_deref(dev, queues, i); rte_errno = err; } DRV_LOG(DEBUG, "Port %u cannot setup indirection table.", -- 2.25.1
[PATCH v2 2/2] net/mlx5: fix external RQ referencing
When an indirection table object is modified, it updates the reference counter for each RX queue related to it. The reference counter for regular queues are indeed updated. However, the reference counter for external RxQs are not. This patch adds updating for external RxQs too. Fixes: 311b17e669ab ("net/mlx5: support queue/RSS actions for external Rx queue") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 121 +--- 1 file changed, 70 insertions(+), 51 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 19c75b7b32..f16795bac3 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2167,6 +2167,41 @@ mlx5_rxqs_deref(struct rte_eth_dev *dev, uint16_t *queues, } } +/** + * Increase reference count for list of Rx queues. + * + * @param dev + * Pointer to Ethernet device. + * @param queues + * List of Rx queues to ref. + * @param queues_n + * Number of queues in the array. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +static int +mlx5_rxqs_ref(struct rte_eth_dev *dev, uint16_t *queues, + const uint32_t queues_n) +{ + uint32_t i; + + for (i = 0; i != queues_n; ++i) { + if (mlx5_is_external_rxq(dev, queues[i])) { + if (mlx5_ext_rxq_ref(dev, queues[i]) == NULL) + goto error; + } else { + if (mlx5_rxq_ref(dev, queues[i]) == NULL) + goto error; + } + } + return 0; +error: + mlx5_rxqs_deref(dev, queues, i); + rte_errno = EINVAL; + return -rte_errno; +} + /** * Release a Rx queue. * @@ -2464,41 +2499,30 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, { struct mlx5_priv *priv = dev->data->dev_private; uint32_t queues_n = ind_tbl->queues_n; - uint16_t *queues = ind_tbl->queues; - unsigned int i = 0; - int ret = 0, err; + int ret; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : log2above(priv->sh->dev_cap.ind_table_max_size); - if (ref_qs) - for (i = 0; i != queues_n; ++i) { - if (mlx5_is_external_rxq(dev, queues[i])) { - if (mlx5_ext_rxq_ref(dev, queues[i]) == NULL) { - ret = -rte_errno; - goto error; - } - } else { - if (mlx5_rxq_ref(dev, queues[i]) == NULL) { - ret = -rte_errno; - goto error; - } - } - } + if (ref_qs && mlx5_rxqs_ref(dev, ind_tbl->queues, queues_n) < 0) { + DRV_LOG(DEBUG, "Port %u invalid indirection table queues.", + dev->data->port_id); + return -rte_errno; + } ret = priv->obj_ops.ind_table_new(dev, n, ind_tbl); - if (ret) - goto error; + if (ret) { + DRV_LOG(DEBUG, "Port %u cannot create a new indirection table.", + dev->data->port_id); + if (ref_qs) { + int err = rte_errno; + + mlx5_rxqs_deref(dev, ind_tbl->queues, queues_n); + rte_errno = err; + } + return ret; + } __atomic_fetch_add(&ind_tbl->refcnt, 1, __ATOMIC_RELAXED); return 0; -error: - if (ref_qs) { - err = rte_errno; - mlx5_rxqs_deref(dev, queues, i); - rte_errno = err; - } - DRV_LOG(DEBUG, "Port %u cannot setup indirection table.", - dev->data->port_id); - return ret; } /** @@ -2603,8 +2627,7 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, bool standalone, bool ref_new_qs, bool deref_old_qs) { struct mlx5_priv *priv = dev->data->dev_private; - unsigned int i = 0, j; - int ret = 0, err; + int ret; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : log2above(priv->sh->dev_cap.ind_table_max_size); @@ -2613,33 +2636,29 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, RTE_SET_USED(standalone); if (mlx5_ind_table_obj_check_standalone(dev, ind_tbl) < 0) return -rte_errno; - if (ref_new_qs) - for (i = 0; i != queues_n; ++i) { - if (!mlx5_rxq_ref(dev, queues[i])) { - ret = -rte_errno; - goto error; -