Re: [dpdk-dev] [dpdk-stable] [PATCH] mbuf: fix external mbufs pool boundaries
08/06/2020 09:50, Olivier Matz: > On Mon, Jun 01, 2020 at 03:24:16PM +, Alexander Kozyrev wrote: > > Memzones are created in testpmd in order to test external data > > buffers functionality. Each memzone is 2Mb in size and divided among > > the pool of external memory buffers. > > > > Memzone may not always be fully utilized because mbufs size can vary > > and some space can be left unused at the tail of a memzone. This is > > not handled properly and mbuf can get the address of this leftover > > space since this address is still valid (part of memzone), but there > > is not enough space to fit the whole packet data. As a result packet > > data may overflow and cause the memory corruption. > > > > Take mbuf size into account when distributing memory addresses from > > a memzone to external mbufs. Skip the remaining tail in case there > > is not enough room for a packet and move to a next memzone instead. > > > > Fixes: 6c8e50c2e5 ("mbuf: create pool with external memory buffers") > > Cc: sta...@dpdk.org > > Signed-off-by: Alexander Kozyrev > > Acked-by: Viacheslav Ovsiienko > > Acked-by: Olivier Matz Applied, thanks Note: there is a blank line between Fixes/Cc block and Signed/Acked block.
Re: [dpdk-dev] [PATCH v2] mbuf: document guideline for new fields and flags
11/06/2020 08:37, Jerin Jacob: > On Thu, Jun 11, 2020 at 12:02 PM Thomas Monjalon wrote: > > > > Since dynamic fields and flags were added in 19.11, > > the idea was to use them for new features, not only PMD-specific. > > > > The guideline is made more explicit in doxygen, in the mbuf guide, > > and in the contribution design guidelines. > > > > For more information about the original design, see the presentation > > https://www.dpdk.org/wp-content/uploads/sites/35/2019/10/DynamicMbuf.pdf > > > > This decision was discussed in the Technical Board: > > http://mails.dpdk.org/archives/dev/2020-June/169667.html > > > > Signed-off-by: Thomas Monjalon > > Acked-by: Olivier Matz > > Acked-by: Jerin Jacob Applied
[dpdk-dev] [PATCH] common/octeontx2: retry intr callback unregister
Interrupt callback unregister can fail with -EAGAIN when interrupt handler is active in interrupt thread. Hence retry before reporting a failure or proceeding further. Signed-off-by: Nithin Dabilpuram --- drivers/common/octeontx2/otx2_irq.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/common/octeontx2/otx2_irq.c b/drivers/common/octeontx2/otx2_irq.c index fa3206a..c0137ff 100644 --- a/drivers/common/octeontx2/otx2_irq.c +++ b/drivers/common/octeontx2/otx2_irq.c @@ -193,6 +193,8 @@ otx2_unregister_irq(struct rte_intr_handle *intr_handle, rte_intr_callback_fn cb, void *data, unsigned int vec) { struct rte_intr_handle tmp_handle; + uint8_t retries = 5; /* 5 ms */ + int rc; if (vec > intr_handle->max_intr) { otx2_err("Error unregistering MSI-X interrupts vec:%d > %d", @@ -205,8 +207,21 @@ otx2_unregister_irq(struct rte_intr_handle *intr_handle, if (tmp_handle.fd == -1) return; - /* Un-register callback func from eal lib */ - rte_intr_callback_unregister(&tmp_handle, cb, data); + do { + /* Un-register callback func from eal lib */ + rc = rte_intr_callback_unregister(&tmp_handle, cb, data); + /* Retry only if -EAGAIN */ + if (rc != -EAGAIN) + break; + rte_delay_ms(1); + retries--; + } while (retries); + + if (rc < 0) { + otx2_err("Error unregistering MSI-X intr vec %d cb, rc=%d", +vec, rc); + return; + } otx2_base_dbg("Disable vector:0x%x for vfio (efds: %d, max:%d)", vec, intr_handle->nb_efd, intr_handle->max_intr); -- 2.8.4
Re: [dpdk-dev] [PATCH v2] mbuf: remove unused next member in dyn flag/field
09/06/2020 09:12, Xiaolong Ye: > TAILQ_ENTRY next is not needed in struct mbuf_dynfield_elt and > mbuf_dynflag_elt, since they are actually chained by rte_tailq_entry's > next field when calling TAILQ_INSERT_TAIL(mbuf_dynfield/dynflag_list, te, > next). > > Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") > Cc: sta...@dpdk.org > > Signed-off-by: Xiaolong Ye > Acked-by: Olivier Matz Applied, thanks
Re: [dpdk-dev] [PATCH] test/mbuf: fix one typo in dyn test
09/06/2020 10:24, Xiaolong Ye: > Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") > Cc: sta...@dpdk.org > > Signed-off-by: Xiaolong Ye Applied with title "fix a dynamic flag log".
[dpdk-dev] [PATCH] net/pcap: support hardware Tx timestamps
When hardware timestamping is enabled on Rx path, system time should no longer be used to calculate the timestamps when dumping packets. Instead, use the value stored by the driver in mbuf->timestamp and assume it is already converted to nanoseconds (otherwise the application may edit the packet headers itself afterwards). Signed-off-by: Vivien Didelot Signed-off-by: Patrick Keroulas --- doc/guides/rel_notes/release_20_08.rst | 1 + drivers/net/pcap/rte_eth_pcap.c| 30 +++--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index 7a67c960c..cedceaf9d 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -61,6 +61,7 @@ New Features Updated PCAP driver with new features and improvements, including: * Support software Tx nanosecond timestamps precision. + * Support hardware Tx timestamps. * **Updated Mellanox mlx5 driver.** diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 13a3d0ac7..3d80b699b 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -290,19 +290,23 @@ eth_null_rx(void *queue __rte_unused, #define NSEC_PER_SEC 10L static inline void -calculate_timestamp(struct timeval *ts) { - uint64_t cycles; - struct timeval cur_time; +calculate_timestamp(const struct rte_mbuf *mbuf, struct timeval *ts) { + if (mbuf->ol_flags & PKT_RX_TIMESTAMP) { + ts->tv_sec = mbuf->timestamp / NSEC_PER_SEC; + ts->tv_usec = mbuf->timestamp % NSEC_PER_SEC; + } else { + uint64_t cycles = rte_get_timer_cycles() - start_cycles; + struct timeval cur_time = { + .tv_sec = cycles / hz, + .tv_usec = (cycles % hz) * NSEC_PER_SEC / hz, + }; - cycles = rte_get_timer_cycles() - start_cycles; - cur_time.tv_sec = cycles / hz; - cur_time.tv_usec = (cycles % hz) * NSEC_PER_SEC / hz; - - ts->tv_sec = start_time.tv_sec + cur_time.tv_sec; - ts->tv_usec = start_time.tv_usec + cur_time.tv_usec; - if (ts->tv_usec >= NSEC_PER_SEC) { - ts->tv_usec -= NSEC_PER_SEC; - ts->tv_sec += 1; + ts->tv_sec = start_time.tv_sec + cur_time.tv_sec; + ts->tv_usec = start_time.tv_usec + cur_time.tv_usec; + if (ts->tv_usec >= NSEC_PER_SEC) { + ts->tv_usec -= NSEC_PER_SEC; + ts->tv_sec += 1; + } } } @@ -339,7 +343,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) caplen = sizeof(temp_data); } - calculate_timestamp(&header.ts); + calculate_timestamp(mbuf, &header.ts); header.len = len; header.caplen = caplen; /* rte_pktmbuf_read() returns a pointer to the data directly -- 2.27.0
Re: [dpdk-dev] [PATCH 1/2] doc: announce rte_dev_probe() API change
On 08/06/20 17:53 +0200, Maxime Coquelin wrote: > In order to simplify the use of rte_dev_probe() and > rte_dev_remove() by applications, rte_dev_probe() will > return a reference on the rte_device stating DPDK v20.11. > > Signed-off-by: Maxime Coquelin > --- > doc/guides/rel_notes/deprecation.rst | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/doc/guides/rel_notes/deprecation.rst > b/doc/guides/rel_notes/deprecation.rst > index 0bee924255..47151eac0b 100644 > --- a/doc/guides/rel_notes/deprecation.rst > +++ b/doc/guides/rel_notes/deprecation.rst > @@ -138,3 +138,8 @@ Deprecation Notices >driver probe scheme. The legacy virtio support will be available through >the existing VFIO/UIO based kernel driver scheme. >More details at https://patches.dpdk.org/patch/69351/ On the principle ok, formulation seems heavy though (but I'm not a native speaker so ymmv...): > + > +* eal: Change ``rte_dev_probe`` API to return a pointer on the probed > + rte_device or NULL instead of 0 or an error code in DPDK v20.11. The 'in DPDK v20.11' is confusing here (it could equally apply to first or second part of the sentence). Given the context it's obvious, but maybe: Change ``rte_dev_probe`` API in DPDK v20.11 to return a pointer on ... > + This > + change will help calling application in avoiding to iterate the devices > + list when willing to call rte_dev_remove() later. How about: This change will allow applications avoid iterating on devices after a probe to get access to the new rte_device. > -- > 2.26.2 > -- Gaëtan
[dpdk-dev] [PATCH 00/10] net/ice: base code update for 20.08 batch 2
Main changes: 1. support outer IP filter for GTPU (include IPv6) 2. recipe can be reused between PFs. 3. fix VSI ID mask 4. some code refactor and clean Qi Zhang (10): net/ice/base: adjust profile id map locks net/ice/base: refactor to avoid need to retry net/ice/base: add FD support for outer IP of GTPU net/ice/base: add commands for system diagnostic net/ice/base: rename misleading variable net/ice/base: add FD support for GTPU with outer IPv6 net/ice/base: get tunnel type for recipe net/ice/base: choose TCP dummy packet by protocol net/ice/base: fix the VSI ID mask to be 10 bit net/ice/base: replace RSS profile locks drivers/net/ice/base/ice_adminq_cmd.h | 56 ++- drivers/net/ice/base/ice_common.c | 53 -- drivers/net/ice/base/ice_fdir.c | 42 +++- drivers/net/ice/base/ice_fdir.h | 2 + drivers/net/ice/base/ice_flex_pipe.c | 95 +- drivers/net/ice/base/ice_flow.c | 29 -- drivers/net/ice/base/ice_switch.c | 184 +- drivers/net/ice/base/ice_switch.h | 2 + drivers/net/ice/base/ice_type.h | 1 + 9 files changed, 363 insertions(+), 101 deletions(-) -- 2.13.6
[dpdk-dev] [PATCH 01/10] net/ice/base: adjust profile id map locks
The profile id map lock should be held till the caller completes all references of that profile entries. The current code releases the lock right after the match search. This caused a driver issue when the profile map entries were referenced after it was freed in other thread after the lock was released earlier. Also return type of get/set profile functions were changed to return the ice status instead of the profile entry pointer. This will prevent the caller referencing the profile fields outside the lock. Signed-off-by: Victor Raj Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_flex_pipe.c | 95 ++-- drivers/net/ice/base/ice_flow.c | 16 -- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index f953d891d..016dc2b39 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -4710,22 +4710,21 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], } /** - * ice_search_prof_id_low - Search for a profile tracking ID low level + * ice_search_prof_id - Search for a profile tracking ID * @hw: pointer to the HW struct * @blk: hardware block * @id: profile tracking ID * - * This will search for a profile tracking ID which was previously added. This - * version assumes that the caller has already acquired the prof map lock. + * This will search for a profile tracking ID which was previously added. + * The profile map lock should be held before calling this function. */ -static struct ice_prof_map * -ice_search_prof_id_low(struct ice_hw *hw, enum ice_block blk, u64 id) +struct ice_prof_map * +ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id) { struct ice_prof_map *entry = NULL; struct ice_prof_map *map; - LIST_FOR_EACH_ENTRY(map, &hw->blk[blk].es.prof_map, ice_prof_map, - list) + LIST_FOR_EACH_ENTRY(map, &hw->blk[blk].es.prof_map, ice_prof_map, list) if (map->profile_cookie == id) { entry = map; break; @@ -4735,26 +4734,6 @@ ice_search_prof_id_low(struct ice_hw *hw, enum ice_block blk, u64 id) } /** - * ice_search_prof_id - Search for a profile tracking ID - * @hw: pointer to the HW struct - * @blk: hardware block - * @id: profile tracking ID - * - * This will search for a profile tracking ID which was previously added. - */ -struct ice_prof_map * -ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id) -{ - struct ice_prof_map *entry; - - ice_acquire_lock(&hw->blk[blk].es.prof_map_lock); - entry = ice_search_prof_id_low(hw, blk, id); - ice_release_lock(&hw->blk[blk].es.prof_map_lock); - - return entry; -} - -/** * ice_vsig_prof_id_count - count profiles in a VSIG * @hw: pointer to the HW struct * @blk: hardware block @@ -4969,7 +4948,7 @@ enum ice_status ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id) ice_acquire_lock(&hw->blk[blk].es.prof_map_lock); - pmap = ice_search_prof_id_low(hw, blk, id); + pmap = ice_search_prof_id(hw, blk, id); if (!pmap) { status = ICE_ERR_DOES_NOT_EXIST; goto err_ice_rem_prof; @@ -5002,21 +4981,27 @@ static enum ice_status ice_get_prof(struct ice_hw *hw, enum ice_block blk, u64 hdl, struct LIST_HEAD_TYPE *chg) { + enum ice_status status = ICE_SUCCESS; struct ice_prof_map *map; struct ice_chs_chg *p; u16 i; + ice_acquire_lock(&hw->blk[blk].es.prof_map_lock); /* Get the details on the profile specified by the handle ID */ map = ice_search_prof_id(hw, blk, hdl); - if (!map) - return ICE_ERR_DOES_NOT_EXIST; + if (!map) { + status = ICE_ERR_DOES_NOT_EXIST; + goto err_ice_get_prof; + } for (i = 0; i < map->ptg_cnt; i++) if (!hw->blk[blk].es.written[map->prof_id]) { /* add ES to change list */ p = (struct ice_chs_chg *)ice_malloc(hw, sizeof(*p)); - if (!p) + if (!p) { + status = ICE_ERR_NO_MEMORY; goto err_ice_get_prof; + } p->type = ICE_PTG_ES_ADD; p->ptype = 0; @@ -5032,11 +5017,10 @@ ice_get_prof(struct ice_hw *hw, enum ice_block blk, u64 hdl, LIST_ADD(&p->list_entry, chg); } - return ICE_SUCCESS; - err_ice_get_prof: + ice_release_lock(&hw->blk[blk].es.prof_map_lock); /* let caller clean up the change list */ - return ICE_ERR_NO_MEMORY; + return status; } /** @@ -5090,17 +5074,23 @@ static enum ice_status ice_add_prof_to_lst(str
[dpdk-dev] [PATCH 02/10] net/ice/base: refactor to avoid need to retry
The ice_discover_caps function is used to read the device and function capabilities, updating the hardware capabilities structures with relevant data. The exact number of capabilities returned by the hardware is unknown ahead of time. The AdminQ command will report the total number of capabilities in the return buffer. The current implementation involves requesting capabilities once, reading this returned size, and then re-requested with that size. This isn't really necessary. The firmware interface has a maximum size of ICE_AQ_MAX_BUF_LEN. Firmware can never return more than ICE_AQ_MAX_BUF_LEN / sizeof(struct ice_aqc_list_caps_elem) capabilities. Avoid the retry loop by simply allocating a buffer of size ICE_AQ_MAX_BUF_LEN. This is significantly simpler than retrying. The extra allocation isn't a big deal, as it will be released after we finish parsing the capabilities. Signed-off-by: Jacob Keller Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_common.c | 43 +++ 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index 2c822d7d4..85b6e1a37 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -2054,40 +2054,21 @@ ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc) { enum ice_status status; u32 cap_count; - u16 cbuf_len; - u8 retries; - - /* The driver doesn't know how many capabilities the device will return -* so the buffer size required isn't known ahead of time. The driver -* starts with cbuf_len and if this turns out to be insufficient, the -* device returns ICE_AQ_RC_ENOMEM and also the cap_count it needs. -* The driver then allocates the buffer based on the count and retries -* the operation. So it follows that the retry count is 2. -*/ -#define ICE_GET_CAP_BUF_COUNT 40 -#define ICE_GET_CAP_RETRY_COUNT2 - - cap_count = ICE_GET_CAP_BUF_COUNT; - retries = ICE_GET_CAP_RETRY_COUNT; - - do { - void *cbuf; - - cbuf_len = (u16)(cap_count * -sizeof(struct ice_aqc_list_caps_elem)); - cbuf = ice_malloc(hw, cbuf_len); - if (!cbuf) - return ICE_ERR_NO_MEMORY; + void *cbuf; - status = ice_aq_discover_caps(hw, cbuf, cbuf_len, &cap_count, - opc, NULL); - ice_free(hw, cbuf); + cbuf = ice_malloc(hw, ICE_AQ_MAX_BUF_LEN); + if (!cbuf) + return ICE_ERR_NO_MEMORY; - if (!status || hw->adminq.sq_last_status != ICE_AQ_RC_ENOMEM) - break; + /* Although the driver doesn't know the number of capabilities the +* device will return, we can simply send a 4KB buffer, the maximum +* possible size that firmware can return. +*/ + cap_count = ICE_AQ_MAX_BUF_LEN / sizeof(struct ice_aqc_list_caps_elem); - /* If ENOMEM is returned, try again with bigger buffer */ - } while (--retries); + status = ice_aq_discover_caps(hw, cbuf, ICE_AQ_MAX_BUF_LEN, &cap_count, + opc, NULL); + ice_free(hw, cbuf); return status; } -- 2.13.6
[dpdk-dev] [PATCH 03/10] net/ice/base: add FD support for outer IP of GTPU
Add outer IP address fields while generating the training packets for GTPU, so that we can support FDIR based on outer IP of GTPU. Signed-off-by: Junfeng Guo Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_fdir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c index 466e0ee36..ecdebd384 100644 --- a/drivers/net/ice/base/ice_fdir.c +++ b/drivers/net/ice/base/ice_fdir.c @@ -1026,10 +1026,10 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP: case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP: case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER: - ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET, - input->ip.v4.src_ip); ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, - input->ip.v4.dst_ip); + input->ip.v4.src_ip); + ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET, + input->ip.v4.dst_ip); ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET, input->gtpu_data.teid); ice_pkt_insert_u6_qfi(loc, ICE_IPV4_GTPU_QFI_OFFSET, -- 2.13.6
[dpdk-dev] [PATCH 05/10] net/ice/base: rename misleading variable
The grst_delay variable in ice_check_reset contains the maximum time (in 100 msec units) that the driver will wait for a reset event to transition to the Device Active state. The value is the sum of three separate components: 1) The maximum time it may take for the firmware to process its outstanding command before handling the reset request. 2) The value in RSTCTL.GRSTDEL (the delay firmware inserts between first seeing the driver reset request and the actual hardware assertion). 3) The maximum expected reset processing time in hardware. Referring to this total time as "grst_delay" is misleading and potentially confusing to someone checking the code and cross-referencing the hardware specification. Fix this by renaming the variable to "grst_timeout", which is more descriptive of its actual use. Signed-off-by: Nick Nunley Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_common.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index 85b6e1a37..1683daf28 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -882,23 +882,23 @@ void ice_deinit_hw(struct ice_hw *hw) */ enum ice_status ice_check_reset(struct ice_hw *hw) { - u32 cnt, reg = 0, grst_delay, uld_mask; + u32 cnt, reg = 0, grst_timeout, uld_mask; /* Poll for Device Active state in case a recent CORER, GLOBR, * or EMPR has occurred. The grst delay value is in 100ms units. * Add 1sec for outstanding AQ commands that can take a long time. */ - grst_delay = ((rd32(hw, GLGEN_RSTCTL) & GLGEN_RSTCTL_GRSTDEL_M) >> - GLGEN_RSTCTL_GRSTDEL_S) + 10; + grst_timeout = ((rd32(hw, GLGEN_RSTCTL) & GLGEN_RSTCTL_GRSTDEL_M) >> + GLGEN_RSTCTL_GRSTDEL_S) + 10; - for (cnt = 0; cnt < grst_delay; cnt++) { + for (cnt = 0; cnt < grst_timeout; cnt++) { ice_msec_delay(100, true); reg = rd32(hw, GLGEN_RSTAT); if (!(reg & GLGEN_RSTAT_DEVSTATE_M)) break; } - if (cnt == grst_delay) { + if (cnt == grst_timeout) { ice_debug(hw, ICE_DBG_INIT, "Global reset polling failed to complete.\n"); return ICE_ERR_RESET_FAILED; -- 2.13.6
[dpdk-dev] [PATCH 06/10] net/ice/base: add FD support for GTPU with outer IPv6
Add FDir support for MAC_IPV6_GTPU type with outer IPv6 address, teid and qfi fields matching. Signed-off-by: Junfeng Guo Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_fdir.c | 36 drivers/net/ice/base/ice_fdir.h | 2 ++ drivers/net/ice/base/ice_type.h | 1 + 3 files changed, 39 insertions(+) diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c index ecdebd384..c5a20632c 100644 --- a/drivers/net/ice/base/ice_fdir.c +++ b/drivers/net/ice/base/ice_fdir.c @@ -102,6 +102,25 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = { 0x00, 0x00, }; +static const u8 ice_fdir_ipv6_gtpu6_pkt[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68, + 0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x34, 0xff, + 0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00, + 0x00, 0x85, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3b, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, +}; + static const u8 ice_fdir_ipv4_l2tpv3_pkt[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00, @@ -467,6 +486,13 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = { ice_fdir_ipv4_gtpu4_pkt, }, { + ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER, + sizeof(ice_fdir_ipv6_gtpu6_pkt), + ice_fdir_ipv6_gtpu6_pkt, + sizeof(ice_fdir_ipv6_gtpu6_pkt), + ice_fdir_ipv6_gtpu6_pkt, + }, + { ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3, sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt, sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt, @@ -1035,6 +1061,16 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, ice_pkt_insert_u6_qfi(loc, ICE_IPV4_GTPU_QFI_OFFSET, input->gtpu_data.qfi); break; + case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER: + ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET, +input->ip.v6.src_ip); + ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET, +input->ip.v6.dst_ip); + ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET, + input->gtpu_data.teid); + ice_pkt_insert_u6_qfi(loc, ICE_IPV6_GTPU_QFI_OFFSET, + input->gtpu_data.qfi); + break; case ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3: ice_pkt_insert_u32(loc, ICE_IPV4_L2TPV3_SESS_ID_OFFSET, input->l2tpv3_data.session_id); diff --git a/drivers/net/ice/base/ice_fdir.h b/drivers/net/ice/base/ice_fdir.h index e4f7b1387..1f31debe6 100644 --- a/drivers/net/ice/base/ice_fdir.h +++ b/drivers/net/ice/base/ice_fdir.h @@ -46,6 +46,8 @@ #define ICE_IPV6_PROTO_OFFSET 20 #define ICE_IPV4_GTPU_TEID_OFFSET 46 #define ICE_IPV4_GTPU_QFI_OFFSET 56 +#define ICE_IPV6_GTPU_TEID_OFFSET 66 +#define ICE_IPV6_GTPU_QFI_OFFSET 76 #define ICE_IPV4_L2TPV3_SESS_ID_OFFSET 34 #define ICE_IPV6_L2TPV3_SESS_ID_OFFSET 54 #define ICE_IPV4_ESP_SPI_OFFSET34 diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index 41a1912bf..c13cd7b00 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -296,6 +296,7 @@ enum ice_fltr_ptype { ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP, ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP, ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER, + ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER, ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3, ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3, ICE_FLTR_PTYPE_NONF_IPV4_ESP, -- 2.13.6
[dpdk-dev] [PATCH 07/10] net/ice/base: get tunnel type for recipe
This patch add support to get tunnel type of recipe after get recipe from fw. This will fix the issue in function ice_find_recp() for tunnel type comparing. Signed-off-by: Wei Zhao Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 177 +- drivers/net/ice/base/ice_switch.h | 2 + 2 files changed, 177 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 1b1693dbb..06d8f9c55 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -1024,6 +1024,179 @@ static void ice_collect_result_idx(struct ice_aqc_recipe_data_elem *buf, } /** + * ice_get_tun_type_for_recipe - get tunnel type for the recipe + * @rid: recipe ID that we are populating + */ +static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid) +{ + u8 vxlan_profile[12] = {10, 11, 12, 16, 17, 18, 22, 23, 24, 25, 26, 27}; + u8 gre_profile[12] = {13, 14, 15, 19, 20, 21, 28, 29, 30, 31, 32, 33}; + u8 pppoe_profile[7] = {34, 35, 36, 37, 38, 39, 40}; + u8 non_tun_profile[6] = {4, 5, 6, 7, 8, 9}; + enum ice_sw_tunnel_type tun_type; + u16 i, j, profile_num = 0; + bool non_tun_valid = false; + bool pppoe_valid = false; + bool vxlan_valid = false; + bool gre_valid = false; + bool gtp_valid = false; + bool flag_valid = false; + + for (j = 0; j < ICE_MAX_NUM_PROFILES; j++) { + if (!ice_is_bit_set(recipe_to_profile[rid], j)) + continue; + else + profile_num++; + + for (i = 0; i < 12; i++) { + if (gre_profile[i] == j) + gre_valid = true; + } + + for (i = 0; i < 12; i++) { + if (vxlan_profile[i] == j) + vxlan_valid = true; + } + + for (i = 0; i < 7; i++) { + if (pppoe_profile[i] == j) + pppoe_valid = true; + } + + for (i = 0; i < 6; i++) { + if (non_tun_profile[i] == j) + non_tun_valid = true; + } + + if (j >= ICE_PROFID_IPV4_GTPC_TEID && + j <= ICE_PROFID_IPV6_GTPU_IPV6_OTHER) + gtp_valid = true; + + if (j >= ICE_PROFID_IPV4_ESP && + j <= ICE_PROFID_IPV6_PFCP_SESSION) + flag_valid = true; + } + + if (!non_tun_valid && vxlan_valid) + tun_type = ICE_SW_TUN_VXLAN; + else if (!non_tun_valid && gre_valid) + tun_type = ICE_SW_TUN_NVGRE; + else if (!non_tun_valid && pppoe_valid) + tun_type = ICE_SW_TUN_PPPOE; + else if (!non_tun_valid && gtp_valid) + tun_type = ICE_SW_TUN_GTP; + else if ((non_tun_valid && vxlan_valid) || +(non_tun_valid && gre_valid) || +(non_tun_valid && gtp_valid) || +(non_tun_valid && pppoe_valid)) + tun_type = ICE_SW_TUN_AND_NON_TUN; + else if ((non_tun_valid && !vxlan_valid) || +(non_tun_valid && !gre_valid) || +(non_tun_valid && !gtp_valid) || +(non_tun_valid && !pppoe_valid)) + tun_type = ICE_NON_TUN; + + if (profile_num > 1 && tun_type == ICE_SW_TUN_PPPOE) { + i = ice_is_bit_set(recipe_to_profile[rid], + ICE_PROFID_PPPOE_IPV4_OTHER); + j = ice_is_bit_set(recipe_to_profile[rid], + ICE_PROFID_PPPOE_IPV6_OTHER); + if (i && !j) + tun_type = ICE_SW_TUN_PPPOE_IPV4; + else if (!i && j) + tun_type = ICE_SW_TUN_PPPOE_IPV6; + } + + if (profile_num == 1 && (flag_valid || non_tun_valid)) { + for (j = 0; j < ICE_MAX_NUM_PROFILES; j++) { + if (ice_is_bit_set(recipe_to_profile[rid], j)) { + switch (j) { + case ICE_PROFID_IPV4_TCP: + tun_type = ICE_SW_IPV4_TCP; + break; + case ICE_PROFID_IPV4_UDP: + tun_type = ICE_SW_IPV4_UDP; + break; + case ICE_PROFID_IPV6_TCP: + tun_type = ICE_SW_IPV6_TCP; + break; + case ICE_PROFID_IPV6_UDP: + tun_type = ICE_SW_IPV6_UDP; + break; + case ICE_PROFID_PPPO
[dpdk-dev] [PATCH 08/10] net/ice/base: choose TCP dummy packet by protocol
In order to find proper dummy packets for switch filter, it need to check ipv4 next protocol number, if it is 0x06, which means next payload is TCP, we need to use TCP format dummy packet. Signed-off-by: Wei Zhao Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 06d8f9c55..ee0813b52 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -13,6 +13,7 @@ #define ICE_IPV4_NVGRE_PROTO_ID0x002F #define ICE_PPP_IPV6_PROTO_ID 0x0057 #define ICE_IPV6_ETHER_ID 0x86DD +#define ICE_TCP_PROTO_ID 0x06 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem * struct to configure any switch filter rules. @@ -6836,6 +6837,12 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, lkups[i].m_u.ethertype.ethtype_id == 0x) ipv6 = true; + else if (lkups[i].type == ICE_IPV4_IL && +lkups[i].h_u.ipv4_hdr.protocol == + ICE_TCP_PROTO_ID && +lkups[i].m_u.ipv4_hdr.protocol == + 0xFF) + tcp = true; } if (tun_type == ICE_SW_TUN_IPV4_ESP) { -- 2.13.6
[dpdk-dev] [PATCH 04/10] net/ice/base: add commands for system diagnostic
System diagnostic solution extend the ability to fetch FW internal status data and error indication. Signed-off-by: Sharon Haroni Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_adminq_cmd.h | 54 +++ 1 file changed, 54 insertions(+) diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h index f480917cd..eaf6c3d0e 100644 --- a/drivers/net/ice/base/ice_adminq_cmd.h +++ b/drivers/net/ice/base/ice_adminq_cmd.h @@ -2646,6 +2646,50 @@ struct ice_aqc_event_lan_overflow { u8 reserved[8]; }; +/* Set Health Status (direct 0xFF20) */ +struct ice_aqc_set_health_status_config { + u8 event_source; +#define ICE_AQC_HEALTH_STATUS_SET_PF_SPECIFIC_MASK BIT(0) +#define ICE_AQC_HEALTH_STATUS_SET_ALL_PF_MASK BIT(1) +#define ICE_AQC_HEALTH_STATUS_SET_GLOBAL_MASK BIT(2) + u8 reserved[15]; +}; + +/* Get Health Status codes (indirect 0xFF21) */ +struct ice_aqc_get_supported_health_status_codes { + __le16 health_code_count; + u8 reserved[6]; + __le32 addr_high; + __le32 addr_low; +}; + +/* Get Health Status (indirect 0xFF22) */ +struct ice_aqc_get_health_status { + __le16 health_status_count; + u8 reserved[6]; + __le32 addr_high; + __le32 addr_low; +}; + +/* Get Health Status event buffer entry, (0xFF22) + * repeated per reported health status + */ +struct ice_aqc_health_status_elem { + __le16 health_status_code; + __le16 event_source; +#define ICE_AQC_HEALTH_STATUS_PF (0x1) +#define ICE_AQC_HEALTH_STATUS_PORT (0x2) +#define ICE_AQC_HEALTH_STATUS_GLOBAL (0x3) + __le32 internal_data1; +#define ICE_AQC_HEALTH_STATUS_UNDEFINED_DATA (0xDEADBEEF) + __le32 internal_data2; +}; + +/* Clear Health Status (direct 0xFF23) */ +struct ice_aqc_clear_health_status { + __le32 reserved[4]; +}; + /** * struct ice_aq_desc - Admin Queue (AQ) descriptor * @flags: ICE_AQ_FLAG_* flags @@ -2750,6 +2794,10 @@ struct ice_aq_desc { struct ice_aqc_get_link_status get_link_status; struct ice_aqc_event_lan_overflow lan_overflow; struct ice_aqc_get_link_topo get_link_topo; + struct ice_aqc_set_health_status_config set_health_status_config; + struct ice_aqc_get_supported_health_status_codes get_supported_health_status_codes; + struct ice_aqc_get_health_status get_health_status; + struct ice_aqc_clear_health_status clear_health_status; } params; }; @@ -2989,6 +3037,12 @@ enum ice_adminq_opc { /* Standalone Commands/Events */ ice_aqc_opc_event_lan_overflow = 0x1001, + + /* SystemDiagnostic commands */ + ice_aqc_opc_set_health_status_config= 0xFF20, + ice_aqc_opc_get_supported_health_status_codes = 0xFF21, + ice_aqc_opc_get_health_status = 0xFF22, + ice_aqc_opc_clear_health_status = 0xFF23 }; #endif /* _ICE_ADMINQ_CMD_H_ */ -- 2.13.6
[dpdk-dev] [PATCH 10/10] net/ice/base: replace RSS profile locks
Replacing flow profile locks with RSS profile locks in the function to remove all RSS rules for a given VSI. This is to align the locks used for RSS rule addition to VSI and removal during VSI teardown to avoid a race condition owing to several iterations of the above operations. In function to get RSS rules for given VSI and protocol header replacing the pointer reference of the RSS entry with a copy of hash value to ensure thread safety. Signed-off-by: Vignesh Sridhar Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_flow.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index fb0e34e5f..6adcda844 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -3314,7 +3314,7 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle) if (LIST_EMPTY(&hw->fl_profs[blk])) return ICE_SUCCESS; - ice_acquire_lock(&hw->fl_profs_locks[blk]); + ice_acquire_lock(&hw->rss_locks); LIST_FOR_EACH_ENTRY_SAFE(p, t, &hw->fl_profs[blk], ice_flow_prof, l_entry) if (ice_is_bit_set(p->vsis, vsi_handle)) { @@ -3323,12 +3323,12 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle) break; if (!ice_is_any_bit_set(p->vsis, ICE_MAX_VSI)) { - status = ice_flow_rem_prof_sync(hw, blk, p); + status = ice_flow_rem_prof(hw, blk, p->id); if (status) break; } } - ice_release_lock(&hw->fl_profs_locks[blk]); + ice_release_lock(&hw->rss_locks); return status; } @@ -3820,7 +3820,8 @@ enum ice_status ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle) */ u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs) { - struct ice_rss_cfg *r, *rss_cfg = NULL; + u64 rss_hash = ICE_HASH_INVALID; + struct ice_rss_cfg *r; /* verify if the protocol header is non zero and VSI is valid */ if (hdrs == ICE_FLOW_SEG_HDR_NONE || !ice_is_vsi_valid(hw, vsi_handle)) @@ -3831,10 +3832,10 @@ u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs) ice_rss_cfg, l_entry) if (ice_is_bit_set(r->vsis, vsi_handle) && r->packet_hdr == hdrs) { - rss_cfg = r; + rss_hash = r->hashed_flds; break; } ice_release_lock(&hw->rss_locks); - return rss_cfg ? rss_cfg->hashed_flds : ICE_HASH_INVALID; + return rss_hash; } -- 2.13.6
[dpdk-dev] [PATCH 09/10] net/ice/base: fix the VSI ID mask to be 10 bit
set_rss_lut failed due to incorrect vsi_id mask. vsi_id is 10 bit but mask was 0x1FF whereas it should be 0x3FF. For vsi_num >= 512, FW set_rss_lut has been failing with return code EACCESS (vsi ownership issue) because software was providing incorrect vsi_num (dropping 10th bit due to incorrect mask) for set_rss_lut admin command Fixes: a90fae1d0755 ("net/ice/base: add admin queue structures and commands") Cc: sta...@dpdk.org Signed-off-by: Kiran Patil Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_adminq_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h index eaf6c3d0e..9ee5b4eb5 100644 --- a/drivers/net/ice/base/ice_adminq_cmd.h +++ b/drivers/net/ice/base/ice_adminq_cmd.h @@ -1992,7 +1992,7 @@ struct ice_aqc_get_set_rss_keys { struct ice_aqc_get_set_rss_lut { #define ICE_AQC_GSET_RSS_LUT_VSI_VALID BIT(15) #define ICE_AQC_GSET_RSS_LUT_VSI_ID_S 0 -#define ICE_AQC_GSET_RSS_LUT_VSI_ID_M (0x1FF << ICE_AQC_GSET_RSS_LUT_VSI_ID_S) +#define ICE_AQC_GSET_RSS_LUT_VSI_ID_M (0x3FF << ICE_AQC_GSET_RSS_LUT_VSI_ID_S) __le16 vsi_id; #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S 0 #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M \ -- 2.13.6
Re: [dpdk-dev] [PATCH v2 0/2] pdump: cleanups
> -Original Message- > From: dev On Behalf Of Stephen Hemminger > Sent: Friday, November 8, 2019 4:47 PM > To: dev@dpdk.org > Cc: Stephen Hemminger > Subject: [dpdk-dev] [PATCH v2 0/2] pdump: cleanups > > These are a couple of small cleanups for 19.10 which came out of work on > pcapng support. Full pcapng support and BPF are planned for DPDK 20.02. > > Stephen Hemminger (2): > pdump: use new pktmbuf copy function > pdump: use dynamic logtype Hi luca, will this patch be in 19.11.3 stable release?
Re: [dpdk-dev] [PATCH v6 04/11] eal/mem: extract common code for memseg list initialization
On 10-Jun-20 5:39 PM, Dmitry Kozlyuk wrote: On Wed, 10 Jun 2020 16:48:58 +0100 "Burakov, Anatoly" wrote: On 10-Jun-20 3:31 PM, Dmitry Kozlyuk wrote: On Wed, 10 Jun 2020 11:26:22 +0100 "Burakov, Anatoly" wrote: [snip] + addr = eal_get_virtual_area( + msl->base_va, &mem_sz, page_sz, 0, reserve_flags); + if (addr == NULL) { +#ifndef RTE_EXEC_ENV_WINDOWS + /* The hint would be misleading on Windows, but this function +* is called from many places, including common code, +* so don't duplicate the message. +*/ + if (rte_errno == EADDRNOTAVAIL) + RTE_LOG(ERR, EAL, "Cannot reserve %llu bytes at [%p] - " + "please use '--" OPT_BASE_VIRTADDR "' option\n", + (unsigned long long)mem_sz, msl->base_va); + else + RTE_LOG(ERR, EAL, "Cannot reserve memory\n"); +#endif You're left without any error messages on Windows. How about: const char *err_str = "Cannot reserve memory\n"; #ifndef RTE_EXEC_ENV_WINDOWS if (rte_errno == EADDRNOTAVAIL) err_str = ... #endif RTE_LOG(ERR, EAL, err_str); or something like that? How about removing generic error message here completely and printing more specific messages at call sites? In fact, almost all of them already do this. It would be more helpful in tracking down errors. Agreed, let's do that :) We do pass up the rte_errno, correct? So, we should be able to do that. Actually, callers don't need rte_errno, because we only have to distinguish EADDRNOTAVAIL here, and eal_get_virtual_area() already prints precise diagnostics at WARNING and ERR level. rte_errno is preserved, however. Not sure i agree, we still need the "--base-virtaddr" hint, and we can only do that from the caller (without #ifdef-ery here), so we do need rte_errno for that. Maybe we're talking about different things. The "--base-virtaddr" hint is printed from eal_memseg_list_alloc() on Unices for EADDRNOTAVAIL. This is handy to avoid duplicating the hint and to provide context, so let's keep it despite #ifndef. Otherwise, a generic error is printed from the same function (mistakenly not on Windows in v6). This generic error adds nothing to eal_get_virtual_area() logs and also doesn't help to known which exact eal_memseg_list_alloc() failed. If instead callers printed their own messages, it would be clear which call failed and in which context. Generic error can than be removed, eal_memseg_list_alloc() code simplified. Callers can inspect rte_errno if they ever need it, but really they don't, because hint is printed by eal_memseg_list_alloc() and eal_get_virtual_area() prints even more precise logs. This is what I did in v8. Right, OK :) -- Thanks, Anatoly
[dpdk-dev] [PATCH v2 03/12] net/ice: complete dev configure in DCF
From: Qi Zhang Enable device configuration function in DCF. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf_ethdev.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 7f24ef81a..41d130cd9 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -57,8 +57,17 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev) } static int -ice_dcf_dev_configure(__rte_unused struct rte_eth_dev *dev) +ice_dcf_dev_configure(struct rte_eth_dev *dev) { + struct ice_dcf_adapter *dcf_ad = dev->data->dev_private; + struct ice_adapter *ad = &dcf_ad->parent; + + ad->rx_bulk_alloc_allowed = true; + ad->tx_simple_allowed = true; + + if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) + dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; + return 0; } -- 2.17.1
[dpdk-dev] [PATCH v2 00/12] enable DCF datapath configuration
This patchset adds support to configure DCF datapath, including Rx/Tx queues setup, start and stop, device configuration, RSS and flexible descriptor RXDID initialization and MAC filter setup. Qi Zhang (11): net/ice: init RSS and supported RXDID in DCF net/ice: complete device info get in DCF net/ice: complete dev configure in DCF net/ice: complete queue setup in DCF net/ice: add stop flag for device start / stop net/ice: add Rx queue init in DCF net/ice: init RSS during DCF start net/ice: add queue config in DCF net/ice: add queue start and stop for DCF net/ice: enable stats for DCF net/ice: set MAC filter during dev start for DCF Ting Xu (1): doc: enable DCF datapath configuration doc/guides/rel_notes/release_20_08.rst | 6 + drivers/net/ice/ice_dcf.c | 408 - drivers/net/ice/ice_dcf.h | 17 + drivers/net/ice/ice_dcf_ethdev.c | 771 +++-- drivers/net/ice/ice_dcf_ethdev.h | 3 - drivers/net/ice/ice_dcf_parent.c | 8 + 6 files changed, 1160 insertions(+), 53 deletions(-) --- v2->v1: Optimize coding style Correct some return values Add support to stop started queues when queue start failed -- 2.17.1
[dpdk-dev] [PATCH v2 02/12] net/ice: complete device info get in DCF
From: Qi Zhang Add support to get complete device information for DCF, including Rx/Tx offload capabilities and default configuration. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf_ethdev.c | 72 ++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index e5ba1a61f..7f24ef81a 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -24,6 +24,7 @@ #include "ice_generic_flow.h" #include "ice_dcf_ethdev.h" +#include "ice_rxtx.h" static uint16_t ice_dcf_recv_pkts(__rte_unused void *rx_queue, @@ -66,11 +67,76 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct ice_dcf_adapter *adapter = dev->data->dev_private; + struct ice_dcf_hw *hw = &adapter->real_hw; dev_info->max_mac_addrs = 1; - dev_info->max_rx_pktlen = (uint32_t)-1; - dev_info->max_rx_queues = RTE_DIM(adapter->rxqs); - dev_info->max_tx_queues = RTE_DIM(adapter->txqs); + dev_info->max_rx_queues = hw->vsi_res->num_queue_pairs; + dev_info->max_tx_queues = hw->vsi_res->num_queue_pairs; + dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN; + dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX; + dev_info->hash_key_size = hw->vf_res->rss_key_size; + dev_info->reta_size = hw->vf_res->rss_lut_size; + dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL; + + dev_info->rx_offload_capa = + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_QINQ_STRIP | + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM | + DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_RX_OFFLOAD_SCATTER | + DEV_RX_OFFLOAD_JUMBO_FRAME | + DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_RSS_HASH; + dev_info->tx_offload_capa = + DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_QINQ_INSERT | + DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO | + DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO | + DEV_TX_OFFLOAD_MULTI_SEGS; + + dev_info->default_rxconf = (struct rte_eth_rxconf) { + .rx_thresh = { + .pthresh = ICE_DEFAULT_RX_PTHRESH, + .hthresh = ICE_DEFAULT_RX_HTHRESH, + .wthresh = ICE_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = ICE_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + .offloads = 0, + }; + + dev_info->default_txconf = (struct rte_eth_txconf) { + .tx_thresh = { + .pthresh = ICE_DEFAULT_TX_PTHRESH, + .hthresh = ICE_DEFAULT_TX_HTHRESH, + .wthresh = ICE_DEFAULT_TX_WTHRESH, + }, + .tx_free_thresh = ICE_DEFAULT_TX_FREE_THRESH, + .tx_rs_thresh = ICE_DEFAULT_TX_RSBIT_THRESH, + .offloads = 0, + }; + + dev_info->rx_desc_lim = (struct rte_eth_desc_lim) { + .nb_max = ICE_MAX_RING_DESC, + .nb_min = ICE_MIN_RING_DESC, + .nb_align = ICE_ALIGN_RING_DESC, + }; + + dev_info->tx_desc_lim = (struct rte_eth_desc_lim) { + .nb_max = ICE_MAX_RING_DESC, + .nb_min = ICE_MIN_RING_DESC, + .nb_align = ICE_ALIGN_RING_DESC, + }; return 0; } -- 2.17.1
[dpdk-dev] [PATCH v2 04/12] net/ice: complete queue setup in DCF
From: Qi Zhang Delete original DCF queue setup functions and use ice queue setup and release functions instead. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf_ethdev.c | 42 +++- drivers/net/ice/ice_dcf_ethdev.h | 3 --- drivers/net/ice/ice_dcf_parent.c | 7 ++ 3 files changed, 11 insertions(+), 41 deletions(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 41d130cd9..0c3013228 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -231,11 +231,6 @@ ice_dcf_dev_close(struct rte_eth_dev *dev) ice_dcf_uninit_hw(dev, &adapter->real_hw); } -static void -ice_dcf_queue_release(__rte_unused void *q) -{ -} - static int ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev, __rte_unused int wait_to_complete) @@ -243,45 +238,16 @@ ice_dcf_link_update(__rte_unused struct rte_eth_dev *dev, return 0; } -static int -ice_dcf_rx_queue_setup(struct rte_eth_dev *dev, - uint16_t rx_queue_id, - __rte_unused uint16_t nb_rx_desc, - __rte_unused unsigned int socket_id, - __rte_unused const struct rte_eth_rxconf *rx_conf, - __rte_unused struct rte_mempool *mb_pool) -{ - struct ice_dcf_adapter *adapter = dev->data->dev_private; - - dev->data->rx_queues[rx_queue_id] = &adapter->rxqs[rx_queue_id]; - - return 0; -} - -static int -ice_dcf_tx_queue_setup(struct rte_eth_dev *dev, - uint16_t tx_queue_id, - __rte_unused uint16_t nb_tx_desc, - __rte_unused unsigned int socket_id, - __rte_unused const struct rte_eth_txconf *tx_conf) -{ - struct ice_dcf_adapter *adapter = dev->data->dev_private; - - dev->data->tx_queues[tx_queue_id] = &adapter->txqs[tx_queue_id]; - - return 0; -} - static const struct eth_dev_ops ice_dcf_eth_dev_ops = { .dev_start = ice_dcf_dev_start, .dev_stop= ice_dcf_dev_stop, .dev_close = ice_dcf_dev_close, .dev_configure = ice_dcf_dev_configure, .dev_infos_get = ice_dcf_dev_info_get, - .rx_queue_setup = ice_dcf_rx_queue_setup, - .tx_queue_setup = ice_dcf_tx_queue_setup, - .rx_queue_release= ice_dcf_queue_release, - .tx_queue_release= ice_dcf_queue_release, + .rx_queue_setup = ice_rx_queue_setup, + .tx_queue_setup = ice_tx_queue_setup, + .rx_queue_release= ice_rx_queue_release, + .tx_queue_release= ice_tx_queue_release, .link_update = ice_dcf_link_update, .stats_get = ice_dcf_stats_get, .stats_reset = ice_dcf_stats_reset, diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_ethdev.h index e60e808d8..b54528bea 100644 --- a/drivers/net/ice/ice_dcf_ethdev.h +++ b/drivers/net/ice/ice_dcf_ethdev.h @@ -19,10 +19,7 @@ struct ice_dcf_queue { struct ice_dcf_adapter { struct ice_adapter parent; /* Must be first */ - struct ice_dcf_hw real_hw; - struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS]; - struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS]; }; void ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw, diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index d13e19d78..322a5273f 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -335,6 +335,13 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev) parent_adapter->eth_dev = eth_dev; parent_adapter->pf.adapter = parent_adapter; parent_adapter->pf.dev_data = eth_dev->data; + /* create a dummy main_vsi */ + parent_adapter->pf.main_vsi = + rte_zmalloc(NULL, sizeof(struct ice_vsi), 0); + if (!parent_adapter->pf.main_vsi) + return -ENOMEM; + parent_adapter->pf.main_vsi->adapter = parent_adapter; + parent_hw->back = parent_adapter; parent_hw->mac_type = ICE_MAC_GENERIC; parent_hw->vendor_id = ICE_INTEL_VENDOR_ID; -- 2.17.1
[dpdk-dev] [PATCH v2 05/12] net/ice: add stop flag for device start / stop
From: Qi Zhang Add stop flag for DCF device start and stop. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf_ethdev.c | 12 drivers/net/ice/ice_dcf_parent.c | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 0c3013228..ff2cab054 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -45,6 +45,11 @@ ice_dcf_xmit_pkts(__rte_unused void *tx_queue, static int ice_dcf_dev_start(struct rte_eth_dev *dev) { + struct ice_dcf_adapter *dcf_ad = dev->data->dev_private; + struct ice_adapter *ad = &dcf_ad->parent; + + ad->pf.adapter_stopped = 0; + dev->data->dev_link.link_status = ETH_LINK_UP; return 0; @@ -53,7 +58,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev) static void ice_dcf_dev_stop(struct rte_eth_dev *dev) { + struct ice_dcf_adapter *dcf_ad = dev->data->dev_private; + struct ice_adapter *ad = &dcf_ad->parent; + + if (ad->pf.adapter_stopped == 1) + return; + dev->data->dev_link.link_status = ETH_LINK_DOWN; + ad->pf.adapter_stopped = 1; } static int diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 322a5273f..c5dfdd36e 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -341,6 +341,7 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev) if (!parent_adapter->pf.main_vsi) return -ENOMEM; parent_adapter->pf.main_vsi->adapter = parent_adapter; + parent_adapter->pf.adapter_stopped = 1; parent_hw->back = parent_adapter; parent_hw->mac_type = ICE_MAC_GENERIC; -- 2.17.1
[dpdk-dev] [PATCH v2 01/12] net/ice: init RSS and supported RXDID in DCF
From: Qi Zhang Enable RSS parameters initialization and get the supported flexible descriptor RXDIDs bitmap from PF during DCF init. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf.c | 54 ++- drivers/net/ice/ice_dcf.h | 3 +++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 0cd5d1bf6..93fabd5f7 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -233,7 +233,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw) caps = VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | VIRTCHNL_VF_OFFLOAD_RX_POLLING | VIRTCHNL_VF_CAP_ADV_LINK_SPEED | VIRTCHNL_VF_CAP_DCF | - VF_BASE_MODE_OFFLOADS; + VF_BASE_MODE_OFFLOADS | VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC; err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES, (uint8_t *)&caps, sizeof(caps)); @@ -547,6 +547,30 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw) return err; } +static int +ice_dcf_get_supported_rxdid(struct ice_dcf_hw *hw) +{ + int err; + + err = ice_dcf_send_cmd_req_no_irq(hw, + VIRTCHNL_OP_GET_SUPPORTED_RXDIDS, + NULL, 0); + if (err) { + PMD_INIT_LOG(ERR, "Failed to send OP_GET_SUPPORTED_RXDIDS"); + return -1; + } + + err = ice_dcf_recv_cmd_rsp_no_irq(hw, VIRTCHNL_OP_GET_SUPPORTED_RXDIDS, + (uint8_t *)&hw->supported_rxdid, + sizeof(uint64_t), NULL); + if (err) { + PMD_INIT_LOG(ERR, "Failed to get response of OP_GET_SUPPORTED_RXDIDS"); + return -1; + } + + return 0; +} + int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) { @@ -620,6 +644,29 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) goto err_alloc; } + /* Allocate memory for RSS info */ + if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) { + hw->rss_key = rte_zmalloc(NULL, + hw->vf_res->rss_key_size, 0); + if (!hw->rss_key) { + PMD_INIT_LOG(ERR, "unable to allocate rss_key memory"); + goto err_alloc; + } + hw->rss_lut = rte_zmalloc("rss_lut", + hw->vf_res->rss_lut_size, 0); + if (!hw->rss_lut) { + PMD_INIT_LOG(ERR, "unable to allocate rss_lut memory"); + goto err_rss; + } + } + + if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) { + if (ice_dcf_get_supported_rxdid(hw) != 0) { + PMD_INIT_LOG(ERR, "failed to do get supported rxdid"); + goto err_rss; + } + } + hw->eth_dev = eth_dev; rte_intr_callback_register(&pci_dev->intr_handle, ice_dcf_dev_interrupt_handler, hw); @@ -628,6 +675,9 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) return 0; +err_rss: + rte_free(hw->rss_key); + rte_free(hw->rss_lut); err_alloc: rte_free(hw->vf_res); err_api: @@ -655,4 +705,6 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) rte_free(hw->arq_buf); rte_free(hw->vf_vsi_map); rte_free(hw->vf_res); + rte_free(hw->rss_lut); + rte_free(hw->rss_key); } diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index d2e447b48..152266e3c 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -50,6 +50,9 @@ struct ice_dcf_hw { uint16_t vsi_id; struct rte_eth_dev *eth_dev; + uint8_t *rss_lut; + uint8_t *rss_key; + uint64_t supported_rxdid; }; int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw, -- 2.17.1
[dpdk-dev] [PATCH v2 06/12] net/ice: add Rx queue init in DCF
From: Qi Zhang Enable Rx queues initialization during device start in DCF. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf.h| 1 + drivers/net/ice/ice_dcf_ethdev.c | 83 2 files changed, 84 insertions(+) diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 152266e3c..dcb2a0283 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -53,6 +53,7 @@ struct ice_dcf_hw { uint8_t *rss_lut; uint8_t *rss_key; uint64_t supported_rxdid; + uint16_t num_queue_pairs; }; int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw, diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index ff2cab054..6d0f93ca7 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -42,14 +42,97 @@ ice_dcf_xmit_pkts(__rte_unused void *tx_queue, return 0; } +static int +ice_dcf_init_rxq(struct rte_eth_dev *dev, struct ice_rx_queue *rxq) +{ + struct ice_dcf_adapter *dcf_ad = dev->data->dev_private; + struct rte_eth_dev_data *dev_data = dev->data; + struct iavf_hw *hw = &dcf_ad->real_hw.avf; + uint16_t buf_size, max_pkt_len, len; + + buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM; + rxq->rx_hdr_len = 0; + rxq->rx_buf_len = RTE_ALIGN(buf_size, (1 << ICE_RLAN_CTX_DBUF_S)); + len = ICE_SUPPORT_CHAIN_NUM * rxq->rx_buf_len; + max_pkt_len = RTE_MIN(len, dev->data->dev_conf.rxmode.max_rx_pkt_len); + + /* Check if the jumbo frame and maximum packet length are set +* correctly. +*/ + if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { + if (max_pkt_len <= RTE_ETHER_MAX_LEN || + max_pkt_len > ICE_FRAME_SIZE_MAX) { + PMD_DRV_LOG(ERR, "maximum packet length must be " + "larger than %u and smaller than %u, " + "as jumbo frame is enabled", + (uint32_t)RTE_ETHER_MAX_LEN, + (uint32_t)ICE_FRAME_SIZE_MAX); + return -EINVAL; + } + } else { + if (max_pkt_len < RTE_ETHER_MIN_LEN || + max_pkt_len > RTE_ETHER_MAX_LEN) { + PMD_DRV_LOG(ERR, "maximum packet length must be " + "larger than %u and smaller than %u, " + "as jumbo frame is disabled", + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); + return -EINVAL; + } + } + + rxq->max_pkt_len = max_pkt_len; + if ((dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) || + (rxq->max_pkt_len + 2 * ICE_VLAN_TAG_SIZE) > buf_size) { + dev_data->scattered_rx = 1; + } + rxq->qrx_tail = hw->hw_addr + IAVF_QRX_TAIL1(rxq->queue_id); + IAVF_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); + IAVF_WRITE_FLUSH(hw); + + return 0; +} + +static int +ice_dcf_init_rx_queues(struct rte_eth_dev *dev) +{ + struct ice_rx_queue **rxq = + (struct ice_rx_queue **)dev->data->rx_queues; + int i, ret; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + if (!rxq[i] || !rxq[i]->q_set) + continue; + ret = ice_dcf_init_rxq(dev, rxq[i]); + if (ret) + return ret; + } + + ice_set_rx_function(dev); + ice_set_tx_function(dev); + + return 0; +} + static int ice_dcf_dev_start(struct rte_eth_dev *dev) { struct ice_dcf_adapter *dcf_ad = dev->data->dev_private; struct ice_adapter *ad = &dcf_ad->parent; + struct ice_dcf_hw *hw = &dcf_ad->real_hw; + int ret; ad->pf.adapter_stopped = 0; + hw->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues, + dev->data->nb_tx_queues); + + ret = ice_dcf_init_rx_queues(dev); + if (ret) { + PMD_DRV_LOG(ERR, "Fail to init queues"); + return ret; + } + dev->data->dev_link.link_status = ETH_LINK_UP; return 0; -- 2.17.1
[dpdk-dev] [PATCH v2 07/12] net/ice: init RSS during DCF start
From: Qi Zhang Enable RSS initialization during DCF start. Add RSS LUT and RSS key configuration functions. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf.c| 117 +++ drivers/net/ice/ice_dcf.h| 1 + drivers/net/ice/ice_dcf_ethdev.c | 8 +++ 3 files changed, 126 insertions(+) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 93fabd5f7..f285323dd 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -708,3 +708,120 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) rte_free(hw->rss_lut); rte_free(hw->rss_key); } + +static int +ice_dcf_configure_rss_key(struct ice_dcf_hw *hw) +{ + struct virtchnl_rss_key *rss_key; + struct dcf_virtchnl_cmd args; + int len, err; + + len = sizeof(*rss_key) + hw->vf_res->rss_key_size - 1; + rss_key = rte_zmalloc("rss_key", len, 0); + if (!rss_key) + return -ENOMEM; + + rss_key->vsi_id = hw->vsi_res->vsi_id; + rss_key->key_len = hw->vf_res->rss_key_size; + rte_memcpy(rss_key->key, hw->rss_key, hw->vf_res->rss_key_size); + + args.v_op = VIRTCHNL_OP_CONFIG_RSS_KEY; + args.req_msglen = len; + args.req_msg = (uint8_t *)rss_key; + args.rsp_msglen = 0; + args.rsp_buflen = 0; + args.rsp_msgbuf = NULL; + args.pending = 0; + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_KEY"); + + rte_free(rss_key); + return err; +} + +static int +ice_dcf_configure_rss_lut(struct ice_dcf_hw *hw) +{ + struct virtchnl_rss_lut *rss_lut; + struct dcf_virtchnl_cmd args; + int len, err; + + len = sizeof(*rss_lut) + hw->vf_res->rss_lut_size - 1; + rss_lut = rte_zmalloc("rss_lut", len, 0); + if (!rss_lut) + return -ENOMEM; + + rss_lut->vsi_id = hw->vsi_res->vsi_id; + rss_lut->lut_entries = hw->vf_res->rss_lut_size; + rte_memcpy(rss_lut->lut, hw->rss_lut, hw->vf_res->rss_lut_size); + + args.v_op = VIRTCHNL_OP_CONFIG_RSS_LUT; + args.req_msglen = len; + args.req_msg = (uint8_t *)rss_lut; + args.rsp_msglen = 0; + args.rsp_buflen = 0; + args.rsp_msgbuf = NULL; + args.pending = 0; + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_INIT_LOG(ERR, "Failed to execute OP_CONFIG_RSS_LUT"); + + rte_free(rss_lut); + return err; +} + +int +ice_dcf_init_rss(struct ice_dcf_hw *hw) +{ + struct rte_eth_dev *dev = hw->eth_dev; + struct rte_eth_rss_conf *rss_conf; + uint8_t i, j, nb_q; + int ret; + + rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf; + nb_q = dev->data->nb_rx_queues; + + if (!(hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF)) { + PMD_DRV_LOG(DEBUG, "RSS is not supported"); + return -ENOTSUP; + } + if (dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) { + PMD_DRV_LOG(WARNING, "RSS is enabled by PF by default"); + /* set all lut items to default queue */ + memset(hw->rss_lut, 0, hw->vf_res->rss_lut_size); + return ice_dcf_configure_rss_lut(hw); + } + + /* In IAVF, RSS enablement is set by PF driver. It is not supported +* to set based on rss_conf->rss_hf. +*/ + + /* configure RSS key */ + if (!rss_conf->rss_key) + /* Calculate the default hash key */ + for (i = 0; i < hw->vf_res->rss_key_size; i++) + hw->rss_key[i] = (uint8_t)rte_rand(); + else + rte_memcpy(hw->rss_key, rss_conf->rss_key, + RTE_MIN(rss_conf->rss_key_len, + hw->vf_res->rss_key_size)); + + /* init RSS LUT table */ + for (i = 0, j = 0; i < hw->vf_res->rss_lut_size; i++, j++) { + if (j >= nb_q) + j = 0; + hw->rss_lut[i] = j; + } + /* send virtchnnl ops to configure rss*/ + ret = ice_dcf_configure_rss_lut(hw); + if (ret) + return ret; + ret = ice_dcf_configure_rss_key(hw); + if (ret) + return ret; + + return 0; +} diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index dcb2a0283..eea4b286b 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -63,5 +63,6 @@ int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc, int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw); int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); +int ice_dcf_init_rss(struct ice_dcf_hw *hw); #endif /* _ICE_DCF_H_ */ diff --git a/drivers/net/ice/ice_dcf_ethdev
[dpdk-dev] [PATCH v2 09/12] net/ice: add queue start and stop for DCF
From: Qi Zhang Add queue start and stop in DCF. Support queue enable and disable through virtual channel. Add support for Rx queue mbufs allocation and queue reset. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf.c| 57 ++ drivers/net/ice/ice_dcf.h| 3 +- drivers/net/ice/ice_dcf_ethdev.c | 320 +++ 3 files changed, 379 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 8869e0d1c..f18c0f16a 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -936,3 +936,60 @@ ice_dcf_config_irq_map(struct ice_dcf_hw *hw) rte_free(map_info); return err; } + +int +ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on) +{ + struct virtchnl_queue_select queue_select; + struct dcf_virtchnl_cmd args; + int err; + + memset(&queue_select, 0, sizeof(queue_select)); + queue_select.vsi_id = hw->vsi_res->vsi_id; + if (rx) + queue_select.rx_queues |= 1 << qid; + else + queue_select.tx_queues |= 1 << qid; + + memset(&args, 0, sizeof(args)); + if (on) + args.v_op = VIRTCHNL_OP_ENABLE_QUEUES; + else + args.v_op = VIRTCHNL_OP_DISABLE_QUEUES; + + args.req_msg = (u8 *)&queue_select; + args.req_msglen = sizeof(queue_select); + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, "Failed to execute command of %s", + on ? "OP_ENABLE_QUEUES" : "OP_DISABLE_QUEUES"); + + return err; +} + +int +ice_dcf_disable_queues(struct ice_dcf_hw *hw) +{ + struct virtchnl_queue_select queue_select; + struct dcf_virtchnl_cmd args; + int err; + + memset(&queue_select, 0, sizeof(queue_select)); + queue_select.vsi_id = hw->vsi_res->vsi_id; + + queue_select.rx_queues = BIT(hw->eth_dev->data->nb_rx_queues) - 1; + queue_select.tx_queues = BIT(hw->eth_dev->data->nb_tx_queues) - 1; + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_DISABLE_QUEUES; + args.req_msg = (u8 *)&queue_select; + args.req_msglen = sizeof(queue_select); + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, + "Failed to execute command of OP_DISABLE_QUEUES"); + + return err; +} diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 9470d1df7..68e1661c0 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -70,5 +70,6 @@ void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); int ice_dcf_init_rss(struct ice_dcf_hw *hw); int ice_dcf_configure_queues(struct ice_dcf_hw *hw); int ice_dcf_config_irq_map(struct ice_dcf_hw *hw); - +int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on); +int ice_dcf_disable_queues(struct ice_dcf_hw *hw); #endif /* _ICE_DCF_H_ */ diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 333fee037..239426b09 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -227,6 +227,270 @@ ice_dcf_config_rx_queues_irqs(struct rte_eth_dev *dev, return 0; } +static int +alloc_rxq_mbufs(struct ice_rx_queue *rxq) +{ + volatile union ice_32b_rx_flex_desc *rxd; + struct rte_mbuf *mbuf = NULL; + uint64_t dma_addr; + uint16_t i; + + for (i = 0; i < rxq->nb_rx_desc; i++) { + mbuf = rte_mbuf_raw_alloc(rxq->mp); + if (unlikely(!mbuf)) { + PMD_DRV_LOG(ERR, "Failed to allocate mbuf for RX"); + return -ENOMEM; + } + + rte_mbuf_refcnt_set(mbuf, 1); + mbuf->next = NULL; + mbuf->data_off = RTE_PKTMBUF_HEADROOM; + mbuf->nb_segs = 1; + mbuf->port = rxq->port_id; + + dma_addr = + rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf)); + + rxd = &rxq->rx_ring[i]; + rxd->read.pkt_addr = dma_addr; + rxd->read.hdr_addr = 0; + rxd->read.rsvd1 = 0; + rxd->read.rsvd2 = 0; + + rxq->sw_ring[i].mbuf = (void *)mbuf; + } + + return 0; +} + +static int +ice_dcf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) +{ + struct ice_dcf_adapter *ad = dev->data->dev_private; + struct iavf_hw *hw = &ad->real_hw.avf; + struct ice_rx_queue *rxq; + int err = 0; + + if (rx_queue_id >= dev->data->nb_rx_queues) + return -EINVAL; + + rxq = dev->data->rx_queues[rx_queue_id]; + + err = alloc_rxq_mbufs(rxq); + if (err) { + PMD_DRV_LOG(ERR, "Failed to allocate RX queue mbuf"); + return err; + } + +
[dpdk-dev] [PATCH v2 08/12] net/ice: add queue config in DCF
From: Qi Zhang Add queues and Rx queue irqs configuration during device start in DCF. The setup is sent to PF via virtchnl. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf.c| 111 +++ drivers/net/ice/ice_dcf.h| 6 ++ drivers/net/ice/ice_dcf_ethdev.c | 126 +++ 3 files changed, 243 insertions(+) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index f285323dd..8869e0d1c 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -24,6 +24,7 @@ #include #include "ice_dcf.h" +#include "ice_rxtx.h" #define ICE_DCF_AQ_LEN 32 #define ICE_DCF_AQ_BUF_SZ 4096 @@ -825,3 +826,113 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw) return 0; } + +#define IAVF_RXDID_LEGACY_1 1 +#define IAVF_RXDID_COMMS_GENERIC 16 + +int +ice_dcf_configure_queues(struct ice_dcf_hw *hw) +{ + struct ice_rx_queue **rxq = + (struct ice_rx_queue **)hw->eth_dev->data->rx_queues; + struct ice_tx_queue **txq = + (struct ice_tx_queue **)hw->eth_dev->data->tx_queues; + struct virtchnl_vsi_queue_config_info *vc_config; + struct virtchnl_queue_pair_info *vc_qp; + struct dcf_virtchnl_cmd args; + uint16_t i, size; + int err; + + size = sizeof(*vc_config) + + sizeof(vc_config->qpair[0]) * hw->num_queue_pairs; + vc_config = rte_zmalloc("cfg_queue", size, 0); + if (!vc_config) + return -ENOMEM; + + vc_config->vsi_id = hw->vsi_res->vsi_id; + vc_config->num_queue_pairs = hw->num_queue_pairs; + + for (i = 0, vc_qp = vc_config->qpair; +i < hw->num_queue_pairs; +i++, vc_qp++) { + vc_qp->txq.vsi_id = hw->vsi_res->vsi_id; + vc_qp->txq.queue_id = i; + if (i < hw->eth_dev->data->nb_tx_queues) { + vc_qp->txq.ring_len = txq[i]->nb_tx_desc; + vc_qp->txq.dma_ring_addr = txq[i]->tx_ring_dma; + } + vc_qp->rxq.vsi_id = hw->vsi_res->vsi_id; + vc_qp->rxq.queue_id = i; + vc_qp->rxq.max_pkt_size = rxq[i]->max_pkt_len; + + if (i >= hw->eth_dev->data->nb_rx_queues) + continue; + + vc_qp->rxq.ring_len = rxq[i]->nb_rx_desc; + vc_qp->rxq.dma_ring_addr = rxq[i]->rx_ring_dma; + vc_qp->rxq.databuffer_size = rxq[i]->rx_buf_len; + + if (hw->vf_res->vf_cap_flags & + VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC && + hw->supported_rxdid & + BIT(IAVF_RXDID_COMMS_GENERIC)) { + vc_qp->rxq.rxdid = IAVF_RXDID_COMMS_GENERIC; + PMD_DRV_LOG(NOTICE, "request RXDID == %d in " + "Queue[%d]", vc_qp->rxq.rxdid, i); + } else { + PMD_DRV_LOG(ERR, "RXDID 16 is not supported"); + return -EINVAL; + } + } + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES; + args.req_msg = (uint8_t *)vc_config; + args.req_msglen = size; + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, "Failed to execute command of" + " VIRTCHNL_OP_CONFIG_VSI_QUEUES"); + + rte_free(vc_config); + return err; +} + +int +ice_dcf_config_irq_map(struct ice_dcf_hw *hw) +{ + struct virtchnl_irq_map_info *map_info; + struct virtchnl_vector_map *vecmap; + struct dcf_virtchnl_cmd args; + int len, i, err; + + len = sizeof(struct virtchnl_irq_map_info) + + sizeof(struct virtchnl_vector_map) * hw->nb_msix; + + map_info = rte_zmalloc("map_info", len, 0); + if (!map_info) + return -ENOMEM; + + map_info->num_vectors = hw->nb_msix; + for (i = 0; i < hw->nb_msix; i++) { + vecmap = &map_info->vecmap[i]; + vecmap->vsi_id = hw->vsi_res->vsi_id; + vecmap->rxitr_idx = 0; + vecmap->vector_id = hw->msix_base + i; + vecmap->txq_map = 0; + vecmap->rxq_map = hw->rxq_map[hw->msix_base + i]; + } + + memset(&args, 0, sizeof(args)); + args.v_op = VIRTCHNL_OP_CONFIG_IRQ_MAP; + args.req_msg = (u8 *)map_info; + args.req_msglen = len; + + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP"); + + rte_free(map_info); + return err; +} diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index eea4b286b..9470d1df7 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -54,6 +54,10 @@ struct ice_dcf_hw { uint8_t *rss_key; uint64_t supported_rxdid; uint16_
[dpdk-dev] [PATCH v2 10/12] net/ice: enable stats for DCF
From: Qi Zhang Add support to get and reset Rx/Tx stats in DCF. Query stats from PF. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf.c| 27 drivers/net/ice/ice_dcf.h| 4 ++ drivers/net/ice/ice_dcf_ethdev.c | 102 +++ 3 files changed, 120 insertions(+), 13 deletions(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index f18c0f16a..bb848bed1 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -993,3 +993,30 @@ ice_dcf_disable_queues(struct ice_dcf_hw *hw) return err; } + +int +ice_dcf_query_stats(struct ice_dcf_hw *hw, + 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->vsi_res->vsi_id; + + args.v_op = VIRTCHNL_OP_GET_STATS; + args.req_msg = (uint8_t *)&q_stats; + args.req_msglen = sizeof(q_stats); + args.rsp_msglen = sizeof(*pstats); + args.rsp_msgbuf = (uint8_t *)pstats; + args.rsp_buflen = sizeof(*pstats); + + 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; +} diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index 68e1661c0..e82bc7748 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -58,6 +58,7 @@ struct ice_dcf_hw { uint16_t msix_base; uint16_t nb_msix; uint16_t rxq_map[16]; + struct virtchnl_eth_stats eth_stats_offset; }; int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw, @@ -72,4 +73,7 @@ int ice_dcf_configure_queues(struct ice_dcf_hw *hw); int ice_dcf_config_irq_map(struct ice_dcf_hw *hw); int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on); int ice_dcf_disable_queues(struct ice_dcf_hw *hw); +int ice_dcf_query_stats(struct ice_dcf_hw *hw, + struct virtchnl_eth_stats *pstats); + #endif /* _ICE_DCF_H_ */ diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 239426b09..1a675064a 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -695,19 +695,6 @@ ice_dcf_dev_info_get(struct rte_eth_dev *dev, return 0; } -static int -ice_dcf_stats_get(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct rte_eth_stats *igb_stats) -{ - return 0; -} - -static int -ice_dcf_stats_reset(__rte_unused struct rte_eth_dev *dev) -{ - return 0; -} - static int ice_dcf_dev_promiscuous_enable(__rte_unused struct rte_eth_dev *dev) { @@ -760,6 +747,95 @@ ice_dcf_dev_filter_ctrl(struct rte_eth_dev *dev, return ret; } +#define ICE_DCF_32_BIT_WIDTH (CHAR_BIT * 4) +#define ICE_DCF_48_BIT_WIDTH (CHAR_BIT * 6) +#define ICE_DCF_48_BIT_MASK RTE_LEN2MASK(ICE_DCF_48_BIT_WIDTH, uint64_t) + +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_48_BIT_WIDTH)) - *offset); + + *stat &= ICE_DCF_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_32_BIT_WIDTH)) - *offset); +} + +static void +ice_dcf_update_stats(struct virtchnl_eth_stats *oes, +struct virtchnl_eth_stats *nes) +{ + 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_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + struct ice_dcf_adapter *ad = dev->data->dev_private; + struct ice_dcf_hw *hw = &ad->real_hw; + struct virtchnl_eth_stats pstats; + int ret; + + ret = ice_dcf_query_stats(hw, &pstats); + if (ret == 0) { + ice_dcf_update_stats(&hw->eth_stats_offset, &pstats);
[dpdk-dev] [PATCH v2 11/12] net/ice: set MAC filter during dev start for DCF
From: Qi Zhang Add support to add and delete MAC address filter in DCF. Signed-off-by: Qi Zhang Signed-off-by: Ting Xu --- drivers/net/ice/ice_dcf.c| 42 drivers/net/ice/ice_dcf.h| 1 + drivers/net/ice/ice_dcf_ethdev.c | 7 ++ 3 files changed, 50 insertions(+) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index bb848bed1..0e430bd76 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -1020,3 +1020,45 @@ ice_dcf_query_stats(struct ice_dcf_hw *hw, return 0; } + +int +ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add) +{ + struct virtchnl_ether_addr_list *list; + struct rte_ether_addr *addr; + struct dcf_virtchnl_cmd args; + int len, err = 0; + + len = sizeof(struct virtchnl_ether_addr_list); + addr = hw->eth_dev->data->mac_addrs; + len += sizeof(struct virtchnl_ether_addr); + + list = rte_zmalloc(NULL, len, 0); + if (!list) { + PMD_DRV_LOG(ERR, "fail to allocate memory"); + return -ENOMEM; + } + + rte_memcpy(list->list[0].addr, addr->addr_bytes, + sizeof(addr->addr_bytes)); + PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x", + addr->addr_bytes[0], addr->addr_bytes[1], + addr->addr_bytes[2], addr->addr_bytes[3], + addr->addr_bytes[4], addr->addr_bytes[5]); + + list->vsi_id = hw->vsi_res->vsi_id; + list->num_elements = 1; + + memset(&args, 0, sizeof(args)); + args.v_op = add ? VIRTCHNL_OP_ADD_ETH_ADDR : + VIRTCHNL_OP_DEL_ETH_ADDR; + args.req_msg = (uint8_t *)list; + args.req_msglen = len; + err = ice_dcf_execute_virtchnl_cmd(hw, &args); + if (err) + PMD_DRV_LOG(ERR, "fail to execute command %s", + add ? "OP_ADD_ETHER_ADDRESS" : + "OP_DEL_ETHER_ADDRESS"); + rte_free(list); + return err; +} diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index e82bc7748..a44a01e90 100644 --- a/drivers/net/ice/ice_dcf.h +++ b/drivers/net/ice/ice_dcf.h @@ -75,5 +75,6 @@ int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on); int ice_dcf_disable_queues(struct ice_dcf_hw *hw); int ice_dcf_query_stats(struct ice_dcf_hw *hw, struct virtchnl_eth_stats *pstats); +int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add); #endif /* _ICE_DCF_H_ */ diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 1a675064a..7912dc18a 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -542,6 +542,12 @@ ice_dcf_dev_start(struct rte_eth_dev *dev) return ret; } + ret = ice_dcf_add_del_all_mac_addr(hw, true); + if (ret) { + PMD_DRV_LOG(ERR, "Failed to add mac addr"); + return ret; + } + dev->data->dev_link.link_status = ETH_LINK_UP; return 0; @@ -597,6 +603,7 @@ ice_dcf_dev_stop(struct rte_eth_dev *dev) intr_handle->intr_vec = NULL; } + ice_dcf_add_del_all_mac_addr(&dcf_ad->real_hw, false); dev->data->dev_link.link_status = ETH_LINK_DOWN; ad->pf.adapter_stopped = 1; } -- 2.17.1
[dpdk-dev] [PATCH v2 12/12] doc: enable DCF datapath configuration
Add doc for DCF datapath configuration in DPDK 20.08 release note. Signed-off-by: Ting Xu --- doc/guides/rel_notes/release_20_08.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index dee4ccbb5..1a3a4cdb2 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -56,6 +56,12 @@ New Features Also, make sure to start the actual text at the margin. = +* **Updated the Intel ice driver.** + + Updated the Intel ice driver with new features and improvements, including: + + * Added support for DCF datapath configuration. + * **Updated Mellanox mlx5 driver.** Updated Mellanox mlx5 driver with new features and improvements, including: -- 2.17.1
Re: [dpdk-dev] [EXTERNAL] Re: [PATCH v2 1/4] eal: disable function versioning on Windows
So apologies for resurrecting an old thread - I did want to chime on this. From a past life as a Windows Programmer, I would say that shared libraries model on Windows is not as strong as on Linux/Unix. Libraries on Windows are typically packaged and distributed along with the applications, not usually at a system level as in Linux/Unix. That said - I strongly agree with Omar - that does not mean that stable ABI's should not be goal on Windows. This does not diminish the value of enabling Windows applications to seamless upgrade their DPDK, at an application level. So I don't have a problem with disabling function-level versioning as an interim measure, until we figure out the best mechanism. What I would suggest is that we aim to get this sort for the v22 ABI in the 21.11 release. And that we clearly indicate in v21 in 20.11 that Windows is not yet covered in the ABI policy. Make sense? Ray K On 02/06/2020 11:40, Thomas Monjalon wrote: > 02/06/2020 12:27, Neil Horman: >> On Mon, Jun 01, 2020 at 09:46:18PM +, Omar Cardona wrote: > Do we know if we have future plans of supporting dlls on windows in the > future? >>> - Hi Neil, yes this is of interest to us (Windows). >>> - Specifically to aid in non-disruptive granular servicing/updating. >>> - Our primary scenario Userspace VMSwitch is biased towards shared >>> libraries for production servicing >>> >> Ok, do you have recommendations on how to provide backwards compatibility >> between dpdk versions? From what I read the most direct solution would be >> per-application dll bundling (which seems to me to defeat the purpose of >> creating a dll, but if its the only solution, perhaps thats all we have to >> work >> with). Is there a better solution? >> >> If not, then I would suggest that, instead of disabling shared libraries on >> Windows, as we do below, we allow it, and redefine >> VERSION_SYMBOL[_EXPERIMENTAL] >> to do nothing, and implement BIND_DEFAULT_SYMBOL to act like >> MAP_STATIC_SYMBOL >> by aliasing the supplied symbol name to the provided export name. I think >> msvc >> supports aliasing, correct? > We don't use msvc, but clang and MinGW. > >
[dpdk-dev] [PATCH v1 1/2] eal/x86: add WC store function
Add rte_write32_wc function that implements a WC store using movdiri instruction. Signed-off-by: Radu Nicolau --- lib/librte_eal/x86/include/rte_io.h | 20 1 file changed, 20 insertions(+) diff --git a/lib/librte_eal/x86/include/rte_io.h b/lib/librte_eal/x86/include/rte_io.h index 2db71b1..3d74bec 100644 --- a/lib/librte_eal/x86/include/rte_io.h +++ b/lib/librte_eal/x86/include/rte_io.h @@ -11,6 +11,26 @@ extern "C" { #include "generic/rte_io.h" +/** + * Write a 32-bit value to I/O device memory address *addr*. + * Uses MOVDIRI instruction to perform a direct-store operation using WC + * memory write protocol. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static __rte_always_inline void +rte_write32_wc(uint32_t value, volatile void *addr) +{ + asm volatile("sfence\n\t" + /* MOVDIRI */ + ".byte 0x40, 0x0f, 0x38, 0xf9, 0x02" + : + : "a" (value), "d" (addr)); +} + #ifdef __cplusplus } #endif -- 2.7.4
[dpdk-dev] [PATCH v1 2/2] net/i40e: use movdiri to update queue tail registers
If available use movdiri instruction instead of a regular mmio write to update queue tail registers. Signed-off-by: Radu Nicolau --- drivers/net/i40e/base/i40e_osdep.h| 20 drivers/net/i40e/i40e_ethdev_vf.c | 10 ++ drivers/net/i40e/i40e_fdir.c | 4 drivers/net/i40e/i40e_rxtx.c | 19 +++ drivers/net/i40e/i40e_rxtx.h | 2 ++ drivers/net/i40e/i40e_rxtx_vec_avx2.c | 4 ++-- drivers/net/i40e/i40e_rxtx_vec_sse.c | 4 ++-- 7 files changed, 55 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h index 58be396..b642c6f 100644 --- a/drivers/net/i40e/base/i40e_osdep.h +++ b/drivers/net/i40e/base/i40e_osdep.h @@ -138,6 +138,26 @@ static inline uint32_t i40e_read_addr(volatile void *addr) #define I40E_PCI_REG_WRITE_RELAXED(reg, value) \ rte_write32_relaxed((rte_cpu_to_le_32(value)), reg) +#if defined(RTE_ARCH_X86) +#define I40E_PCI_REG_WC_WRITE(queue, reg, value, ...) \ + do {\ + uint32_t val = rte_cpu_to_le_32(value); \ + volatile void *addr = reg; \ + if (queue->use_movdiri) \ + rte_write32_wc(val, addr); \ + else\ + rte_write32##__VA_ARGS__(val, addr);\ + } while (0) +#define I40E_PCI_REG_WC_WRITE_RELAXED(queue, reg, value) \ + I40E_PCI_REG_WC_WRITE(queue, reg, value, _relaxed) +#else + #define I40E_PCI_REG_WC_WRITE(queue, reg, value) \ + I40E_PCI_REG_WRITE(reg, value) + #define I40E_PCI_REG_WC_WRITE_RELAXED(queue, reg, value) \ + I40E_PCI_REG_WRITE_RELAXED(reg, value) +#endif + + #define I40E_WRITE_FLUSH(a) I40E_READ_REG(a, I40E_GLGEN_STAT) #define I40EVF_WRITE_FLUSH(a) I40E_READ_REG(a, I40E_VFGEN_RSTAT) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index eca716a..6a82b7b 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1790,6 +1790,11 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq) rxq->max_pkt_len = RTE_MIN(len, dev_data->dev_conf.rxmode.max_rx_pkt_len); +#if defined(RTE_ARCH_X86) + /* use MOVDIRI if supported*/ + rxq->use_movdiri = rte_cpu_get_flag_enabled(RTE_CPUFLAG_MOVDIRI); +#endif + /** * Check if the jumbo frame and maximum packet length are set correctly */ @@ -1855,6 +1860,11 @@ i40evf_tx_init(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_tx_queues; i++) txq[i]->qtx_tail = hw->hw_addr + I40E_QTX_TAIL1(i); +#if defined(RTE_ARCH_X86) + /* use MOVDIRI if supported*/ + txq[i]->use_movdiri = rte_cpu_get_flag_enabled(RTE_CPUFLAG_MOVDIRI); +#endif + i40e_set_tx_function(dev); } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index d59399a..6f1bc86 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -142,6 +142,10 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq) } rxq->qrx_tail = hw->hw_addr + I40E_QRX_TAIL(rxq->vsi->base_queue); +#if defined(RTE_ARCH_X86) + /* use MOVDIRI if supported*/ + rxq->use_movdiri = rte_cpu_get_flag_enabled(RTE_CPUFLAG_MOVDIRI); +#endif rte_wmb(); /* Init the RX tail regieter. */ diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 840b6f3..44bba68 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -760,7 +760,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (nb_hold > rxq->rx_free_thresh) { rx_id = (uint16_t) ((rx_id == 0) ? (rxq->nb_rx_desc - 1) : (rx_id - 1)); - I40E_PCI_REG_WRITE(rxq->qrx_tail, rx_id); + I40E_PCI_REG_WC_WRITE(rxq, rxq->qrx_tail, rx_id); nb_hold = 0; } rxq->nb_rx_hold = nb_hold; @@ -938,7 +938,7 @@ i40e_recv_scattered_pkts(void *rx_queue, if (nb_hold > rxq->rx_free_thresh) { rx_id = (uint16_t)(rx_id == 0 ? (rxq->nb_rx_desc - 1) : (rx_id - 1)); - I40E_PCI_REG_WRITE(rxq->qrx_tail, rx_id); + I40E_PCI_REG_WC_WRITE(rxq, rxq->qrx_tail, rx_id); nb_hold = 0; } rxq->nb_rx_hold = nb_hold; @@ -1249,7 +1249,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) (unsigned) tx_id, (unsigned) nb_tx); rte_cio_wmb(); - I40E_PCI_REG_WRITE_RELAXED(txq->qtx_tail, tx_id); + I40E_PCI_REG_WC_WRITE_RELAXED(txq, txq->
[dpdk-dev] [PATCH v1 1/2] vhost: introduce async data path registration API
From: Patrick This patch introduces registration/un-registration APIs for async data path together with all required data structures and DMA callback function proto-types. Signed-off-by: Patrick --- lib/librte_vhost/Makefile | 3 +- lib/librte_vhost/rte_vhost.h | 1 + lib/librte_vhost/rte_vhost_async.h | 134 + lib/librte_vhost/socket.c | 20 ++ lib/librte_vhost/vhost.c | 74 +++- lib/librte_vhost/vhost.h | 30 - lib/librte_vhost/vhost_user.c | 28 ++-- 7 files changed, 283 insertions(+), 7 deletions(-) create mode 100644 lib/librte_vhost/rte_vhost_async.h diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile index e592795..3aed094 100644 --- a/lib/librte_vhost/Makefile +++ b/lib/librte_vhost/Makefile @@ -41,7 +41,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \ vhost_user.c virtio_net.c vdpa.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_vhost.h rte_vdpa.h +SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_vhost.h rte_vdpa.h \ + rte_vhost_async.h # only compile vhost crypto when cryptodev is enabled ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h index d43669f..cec4d07 100644 --- a/lib/librte_vhost/rte_vhost.h +++ b/lib/librte_vhost/rte_vhost.h @@ -35,6 +35,7 @@ #define RTE_VHOST_USER_EXTBUF_SUPPORT (1ULL << 5) /* support only linear buffers (no chained mbufs) */ #define RTE_VHOST_USER_LINEARBUF_SUPPORT (1ULL << 6) +#define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7) /** Protocol features. */ #ifndef VHOST_USER_PROTOCOL_F_MQ diff --git a/lib/librte_vhost/rte_vhost_async.h b/lib/librte_vhost/rte_vhost_async.h new file mode 100644 index 000..82f2ebe --- /dev/null +++ b/lib/librte_vhost/rte_vhost_async.h @@ -0,0 +1,134 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#ifndef _RTE_VHOST_ASYNC_H_ +#define _RTE_VHOST_ASYNC_H_ + +#include "rte_vhost.h" + +/** + * iovec iterator + */ +struct iov_it { + /** offset to the first byte of interesting data */ + size_t offset; + /** total bytes of data in this iterator */ + size_t count; + /** pointer to the iovec array */ + struct iovec *iov; + /** number of iovec in this iterator */ + unsigned long nr_segs; +}; + +/** + * dma transfer descriptor pair + */ +struct dma_trans_desc { + /** source memory iov_it */ + struct iov_it *src; + /** destination memory iov_it */ + struct iov_it *dst; +}; + +/** + * dma transfer status + */ +struct dma_trans_status { + /** An array of application specific data for source memory */ + uintptr_t *src_opaque_data; + /** An array of application specific data for destination memory */ + uintptr_t *dst_opaque_data; +}; + +/** + * dma operation callbacks to be implemented by applications + */ +struct rte_vhost_async_channel_ops { + /** +* instruct a DMA channel to perform copies for a batch of packets +* +* @param vid +* id of vhost device to perform data copies +* @param queue_id +* queue id to perform data copies +* @param descs +* an array of DMA transfer memory descriptors +* @param opaque_data +* opaque data pair sending to DMA engine +* @param count +* number of elements in the "descs" array +* @return +* -1 on failure, number of descs processed on success +*/ + int (*transfer_data)(int vid, uint16_t queue_id, + struct dma_trans_desc *descs, + struct dma_trans_status *opaque_data, + uint16_t count); + /** +* check copy-completed packets from a DMA channel +* @param vid +* id of vhost device to check copy completion +* @param queue_id +* queue id to check copyp completion +* @param opaque_data +* buffer to receive the opaque data pair from DMA engine +* @param max_packets +* max number of packets could be completed +* @return +* -1 on failure, number of iov segments completed on success +*/ + int (*check_completed_copies)(int vid, uint16_t queue_id, + struct dma_trans_status *opaque_data, + uint16_t max_packets); +}; + +/** + * dma channel feature bit definition + */ +struct dma_channel_features { + union { + uint32_t intval; + struct { + uint32_t inorder:1; + uint32_t resvd0115:15; + uint32_t threshold:12; + uint32_t resvd2831:4; + }; + }; +}; + +/** + * register a dma channe
[dpdk-dev] [PATCH v1 2/2] vhost: introduce async enqueue for split ring
From: Patrick This patch implement async enqueue data path for split ring. Signed-off-by: Patrick --- lib/librte_vhost/rte_vhost_async.h | 38 +++ lib/librte_vhost/virtio_net.c | 538 - 2 files changed, 574 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/rte_vhost_async.h b/lib/librte_vhost/rte_vhost_async.h index 82f2ebe..efcba0a 100644 --- a/lib/librte_vhost/rte_vhost_async.h +++ b/lib/librte_vhost/rte_vhost_async.h @@ -131,4 +131,42 @@ int rte_vhost_async_channel_register(int vid, uint16_t queue_id, */ int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id); +/** + * This function submit enqueue data to DMA. This function has no + * guranttee to the transfer completion upon return. Applications should + * poll transfer status by rte_vhost_poll_enqueue_completed() + * + * @param vid + * id of vhost device to enqueue data + * @param queue_id + * queue id to enqueue data + * @param pkts + * array of packets to be enqueued + * @param count + * packets num to be enqueued + * @return + * num of packets enqueued + */ +uint16_t rte_vhost_submit_enqueue_burst(int vid, uint16_t queue_id, + struct rte_mbuf **pkts, uint16_t count); + +/** + * This function check DMA completion status for a specific vhost + * device queue. Packets which finish copying (enqueue) operation + * will be returned in an array. + * + * @param vid + * id of vhost device to enqueue data + * @param queue_id + * queue id to enqueue data + * @param pkts + * blank array to get return packet pointer + * @param count + * size of the packet array + * @return + * num of packets returned + */ +uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, + struct rte_mbuf **pkts, uint16_t count); + #endif /* _RTE_VDPA_H_ */ diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 751c1f3..cf9f884 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -17,14 +17,15 @@ #include #include #include +#include #include "iotlb.h" #include "vhost.h" -#define MAX_PKT_BURST 32 - #define MAX_BATCH_LEN 256 +#define VHOST_ASYNC_BATCH_THRESHOLD 8 + static __rte_always_inline bool rxvq_is_mergeable(struct virtio_net *dev) { @@ -117,6 +118,35 @@ } static __rte_always_inline void +async_flush_shadow_used_ring_split(struct virtio_net *dev, + struct vhost_virtqueue *vq) +{ + uint16_t used_idx = vq->last_used_idx & (vq->size - 1); + + if (used_idx + vq->shadow_used_idx <= vq->size) { + do_flush_shadow_used_ring_split(dev, vq, used_idx, 0, + vq->shadow_used_idx); + } else { + uint16_t size; + + /* update used ring interval [used_idx, vq->size] */ + size = vq->size - used_idx; + do_flush_shadow_used_ring_split(dev, vq, used_idx, 0, size); + + /* update the left half used ring interval [0, left_size] */ + do_flush_shadow_used_ring_split(dev, vq, 0, size, + vq->shadow_used_idx - size); + } + vq->last_used_idx += vq->shadow_used_idx; + + rte_smp_wmb(); + + vhost_log_cache_sync(dev, vq); + + vq->shadow_used_idx = 0; +} + +static __rte_always_inline void update_shadow_used_ring_split(struct vhost_virtqueue *vq, uint16_t desc_idx, uint32_t len) { @@ -905,6 +935,199 @@ return error; } +static __rte_always_inline void +async_fill_vec(struct iovec *v, void *base, size_t len) +{ + v->iov_base = base; + v->iov_len = len; +} + +static __rte_always_inline void +async_fill_it(struct iov_it *it, size_t count, + struct iovec *vec, unsigned long nr_seg) +{ + it->offset = 0; + it->count = count; + + if (count) { + it->iov = vec; + it->nr_segs = nr_seg; + } else { + it->iov = 0; + it->nr_segs = 0; + } +} + +static __rte_always_inline void +async_fill_des(struct dma_trans_desc *desc, + struct iov_it *src, struct iov_it *dst) +{ + desc->src = src; + desc->dst = dst; +} + +static __rte_always_inline int +async_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, + struct rte_mbuf *m, struct buf_vector *buf_vec, + uint16_t nr_vec, uint16_t num_buffers, + struct iovec *src_iovec, struct iovec *dst_iovec, + struct iov_it *src_it, struct iov_it *dst_it) +{ + uint32_t vec_idx = 0; + uint32_t mbuf_offset, mbuf_avail; + uint32_t buf_offset, buf_avail; + uint64_t buf_addr, buf_iova, buf_len; + uint32_t cpy_len, cpy_threshold; + uint64_t hdr_addr; + struct rte_mbuf *hdr_mbuf; + struct batch_copy_elem *batch_copy = vq->batch_copy_elems; + struct virtio_net_hdr_mrg_rxbuf tm
[dpdk-dev] [PATCH v1 0/2] introduce asynchronous data path for vhost
From: Patrick Fu Performing large memory copies usually takes up a major part of CPU cycles and becomes the hot spot in vhost-user enqueue operation. To offload expensive memory operations from the CPU, this patch set proposes to leverage DMA engines, e.g., I/OAT, a DMA engine in the Intel's processor, to accelerate large copies. Large copies are offloaded from the CPU to the DMA in an asynchronous manner. The CPU just submits copy jobs to the DMA but without waiting for its copy completion. Thus, there is no CPU intervention during data transfer; we can save precious CPU cycles and improve the overall throughput for vhost-user based applications, like OVS. During packet transmission, it offloads large copies to the DMA and performs small copies by the CPU, due to startup overheads associated with the DMA. This patch set construct a general framework that applications can leverage to attach DMA channels with vhost-user transmit queues. Four new RTE APIs are introduced to vhost library for applications to register and use the asynchronous data path. In addition, two new DMA operation callbacks are defined, by which vhost-user asynchronous data path can interact with DMA hardware. Currently only enqueue operation for split queue is implemented, but the frame is flexible to extend support for dequeue & packed queue. Patrick Fu (2): vhost: introduce async data path registration API vhost: introduce async enqueue for split ring lib/librte_vhost/Makefile | 3 +- lib/librte_vhost/rte_vhost.h | 1 + lib/librte_vhost/rte_vhost_async.h | 172 lib/librte_vhost/socket.c | 20 ++ lib/librte_vhost/vhost.c | 74 - lib/librte_vhost/vhost.h | 30 ++- lib/librte_vhost/vhost_user.c | 28 +- lib/librte_vhost/virtio_net.c | 538 - 8 files changed, 857 insertions(+), 9 deletions(-) create mode 100644 lib/librte_vhost/rte_vhost_async.h -- 1.8.3.1
[dpdk-dev] [PATCH 1/2] eal: remove redundant code
The event status has been cleaned up by the CAS operation when we free the event data, so there is no need to set it to invalid after that. Fixes: 49e2f374e45a ("eal/linux: support external Rx interrupt") Cc: shah...@mellanox.com Cc: sta...@dpdk.org Signed-off-by: Phil Yang Reviewed-by: Ruifeng Wang --- lib/librte_eal/linux/eal_interrupts.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/librte_eal/linux/eal_interrupts.c b/lib/librte_eal/linux/eal_interrupts.c index 16e7a7d..2f369dc 100644 --- a/lib/librte_eal/linux/eal_interrupts.c +++ b/lib/librte_eal/linux/eal_interrupts.c @@ -1431,7 +1431,6 @@ rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle) if (rte_epoll_ctl(rev->epfd, EPOLL_CTL_DEL, rev->fd, rev)) { /* force free if the entry valid */ eal_epoll_data_safe_free(rev); - rev->status = RTE_EPOLL_INVALID; } } } -- 2.7.4
[dpdk-dev] [PATCH 2/2] eal: use c11 atomics for interrupt status
The event status is defined as a volatile variable and shared between threads. Use c11 atomics with explicit ordering instead of rte_atomic ops which enforce unnecessary barriers on aarch64. Signed-off-by: Phil Yang Reviewed-by: Ruifeng Wang --- lib/librte_eal/include/rte_eal_interrupts.h | 2 +- lib/librte_eal/linux/eal_interrupts.c | 47 - 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/lib/librte_eal/include/rte_eal_interrupts.h b/lib/librte_eal/include/rte_eal_interrupts.h index 773a34a..b1e8a29 100644 --- a/lib/librte_eal/include/rte_eal_interrupts.h +++ b/lib/librte_eal/include/rte_eal_interrupts.h @@ -59,7 +59,7 @@ enum { /** interrupt epoll event obj, taken by epoll_event.ptr */ struct rte_epoll_event { - volatile uint32_t status; /**< OUT: event status */ + uint32_t status; /**< OUT: event status */ int fd;/**< OUT: event fd */ int epfd; /**< OUT: epoll instance the ev associated with */ struct rte_epoll_data epdata; diff --git a/lib/librte_eal/linux/eal_interrupts.c b/lib/librte_eal/linux/eal_interrupts.c index 2f369dc..1486acf 100644 --- a/lib/librte_eal/linux/eal_interrupts.c +++ b/lib/librte_eal/linux/eal_interrupts.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -1221,11 +1220,18 @@ eal_epoll_process_event(struct epoll_event *evs, unsigned int n, { unsigned int i, count = 0; struct rte_epoll_event *rev; + uint32_t valid_status; for (i = 0; i < n; i++) { rev = evs[i].data.ptr; - if (!rev || !rte_atomic32_cmpset(&rev->status, RTE_EPOLL_VALID, -RTE_EPOLL_EXEC)) + valid_status = RTE_EPOLL_VALID; + /* ACQUIRE memory ordering here pairs with RELEASE +* ordering bellow acting as a lock to synchronize +* the event data updating. +*/ + if (!rev || !__atomic_compare_exchange_n(&rev->status, + &valid_status, RTE_EPOLL_EXEC, 0, + __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) continue; events[count].status= RTE_EPOLL_VALID; @@ -1237,8 +1243,11 @@ eal_epoll_process_event(struct epoll_event *evs, unsigned int n, rev->epdata.cb_fun(rev->fd, rev->epdata.cb_arg); - rte_compiler_barrier(); - rev->status = RTE_EPOLL_VALID; + /* the status update should be observed after +* the other fields changes. +*/ + __atomic_store_n(&rev->status, RTE_EPOLL_VALID, + __ATOMIC_RELEASE); count++; } return count; @@ -1308,10 +1317,14 @@ rte_epoll_wait(int epfd, struct rte_epoll_event *events, static inline void eal_epoll_data_safe_free(struct rte_epoll_event *ev) { - while (!rte_atomic32_cmpset(&ev->status, RTE_EPOLL_VALID, - RTE_EPOLL_INVALID)) - while (ev->status != RTE_EPOLL_VALID) + uint32_t valid_status = RTE_EPOLL_VALID; + while (!__atomic_compare_exchange_n(&ev->status, &valid_status, + RTE_EPOLL_INVALID, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) { + while (__atomic_load_n(&ev->status, + __ATOMIC_RELAXED) != RTE_EPOLL_VALID) rte_pause(); + valid_status = RTE_EPOLL_VALID; + } memset(&ev->epdata, 0, sizeof(ev->epdata)); ev->fd = -1; ev->epfd = -1; @@ -1333,7 +1346,8 @@ rte_epoll_ctl(int epfd, int op, int fd, epfd = rte_intr_tls_epfd(); if (op == EPOLL_CTL_ADD) { - event->status = RTE_EPOLL_VALID; + __atomic_store_n(&event->status, RTE_EPOLL_VALID, + __ATOMIC_RELAXED); event->fd = fd; /* ignore fd in event */ event->epfd = epfd; ev.data.ptr = (void *)event; @@ -1345,11 +1359,13 @@ rte_epoll_ctl(int epfd, int op, int fd, op, fd, strerror(errno)); if (op == EPOLL_CTL_ADD) /* rollback status when CTL_ADD fail */ - event->status = RTE_EPOLL_INVALID; + __atomic_store_n(&event->status, RTE_EPOLL_INVALID, + __ATOMIC_RELAXED); return -1; } - if (op == EPOLL_CTL_DEL && event->status != RTE_EPOLL_INVALID) + if (op == EPOLL_CTL_DEL && __atomic_load_n(&event->status, + __ATOMIC_RELAXED) != RTE_EPOLL_INVALID) eal_epoll_data_safe_free(event); return 0; @@ -1378,7 +1394,8 @@ rte_intr
[dpdk-dev] [PATCH] mbuf: use c11 atomics for refcnt operations
Use c11 atomics with explicit ordering instead of rte_atomic ops which enforce unnecessary barriers on aarch64. Signed-off-by: Phil Yang Reviewed-by: Ruifeng Wang --- lib/librte_mbuf/rte_mbuf.c | 1 - lib/librte_mbuf/rte_mbuf.h | 19 ++- lib/librte_mbuf/rte_mbuf_core.h | 11 +++ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 220eb2f..e41b153 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f8e492e..86270a7 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -365,7 +364,7 @@ rte_pktmbuf_priv_flags(struct rte_mempool *mp) static inline uint16_t rte_mbuf_refcnt_read(const struct rte_mbuf *m) { - return (uint16_t)(rte_atomic16_read(&m->refcnt_atomic)); + return __atomic_load_n(&m->refcnt, __ATOMIC_RELAXED); } /** @@ -378,14 +377,15 @@ rte_mbuf_refcnt_read(const struct rte_mbuf *m) static inline void rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value) { - rte_atomic16_set(&m->refcnt_atomic, (int16_t)new_value); + __atomic_store_n(&m->refcnt, new_value, __ATOMIC_RELAXED); } /* internal */ static inline uint16_t __rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) { - return (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value)); + return (uint16_t)(__atomic_add_fetch((int16_t *)&m->refcnt, value, + __ATOMIC_ACQ_REL)); } /** @@ -466,7 +466,7 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value) static inline uint16_t rte_mbuf_ext_refcnt_read(const struct rte_mbuf_ext_shared_info *shinfo) { - return (uint16_t)(rte_atomic16_read(&shinfo->refcnt_atomic)); + return __atomic_load_n(&shinfo->refcnt, __ATOMIC_RELAXED); } /** @@ -481,7 +481,7 @@ static inline void rte_mbuf_ext_refcnt_set(struct rte_mbuf_ext_shared_info *shinfo, uint16_t new_value) { - rte_atomic16_set(&shinfo->refcnt_atomic, (int16_t)new_value); + __atomic_store_n(&shinfo->refcnt, new_value, __ATOMIC_RELAXED); } /** @@ -505,7 +505,8 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo, return (uint16_t)value; } - return (uint16_t)rte_atomic16_add_return(&shinfo->refcnt_atomic, value); + return (uint16_t)(__atomic_add_fetch((int16_t *)&shinfo->refcnt, value, + __ATOMIC_ACQ_REL)); } /** Mbuf prefetch */ @@ -1304,8 +1305,8 @@ static inline int __rte_pktmbuf_pinned_extbuf_decref(struct rte_mbuf *m) * Direct usage of add primitive to avoid * duplication of comparing with one. */ - if (likely(rte_atomic16_add_return - (&shinfo->refcnt_atomic, -1))) + if (likely(__atomic_add_fetch((int *)&shinfo->refcnt, -1, + __ATOMIC_ACQ_REL))) return 1; /* Reinitialize counter before mbuf freeing. */ diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h index b9a59c8..12cc38a 100644 --- a/lib/librte_mbuf/rte_mbuf_core.h +++ b/lib/librte_mbuf/rte_mbuf_core.h @@ -16,7 +16,6 @@ #include #include -#include #ifdef __cplusplus extern "C" { @@ -493,12 +492,8 @@ struct rte_mbuf { * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC * config option. */ - RTE_STD_C11 - union { - rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */ - /** Non-atomically accessed refcnt */ - uint16_t refcnt; - }; + uint16_t refcnt; + uint16_t nb_segs; /**< Number of segments. */ /** Input port (16 bits to support more than 256 virtual ports). @@ -676,7 +671,7 @@ typedef void (*rte_mbuf_extbuf_free_callback_t)(void *addr, void *opaque); struct rte_mbuf_ext_shared_info { rte_mbuf_extbuf_free_callback_t free_cb; /**< Free callback function */ void *fcb_opaque;/**< Free callback argument */ - rte_atomic16_t refcnt_atomic;/**< Atomically accessed refcnt */ + uint16_t refcnt; /**< Atomically accessed refcnt */ }; /**< Maximum number of nb_segs allowed. */ -- 2.7.4
Re: [dpdk-dev] [PATCH] mbuf: align rte_mbuf for Windows
On Tue, May 19, 2020 at 03:15:19PM -0700, Ranjit Menon wrote: > On 5/19/2020 1:18 PM, Thomas Monjalon wrote: > > 19/05/2020 21:57, Dmitry Kozlyuk: > > > On Tue, 19 May 2020 20:49:50 +0200 > > > Thomas Monjalon wrote: > > > > > > > +Cc more maintainers > > > > > > > > 19/05/2020 20:41, tal...@mellanox.com: > > > > > From: Tal Shnaiderman > > > > > > > > > > Using uint32_t type bit-fields in Windows will pads the > > > > > 'L2/L3/L4 and tunnel information' union with additional bits. > > > > > > > > > > This padding causes rte_mbuf size misalignment and the total size > > > > > increases to 3 cache-lines. > > > > > > > > > > Changed packet_type bit-fields types from uint32_t to uint8_t > > > > > to allow unified 2 cache-line structure size. > > > > > > > > > > Added the __extension__ attribute over the modified struct to avoid > > > > > the warning: > > > > > > > > > > type of bit-field ... is a GCC extension [-pedantic] > > > > > > > > > > Signed-off-by: Tal Shnaiderman Acked-by: Olivier Matz
[dpdk-dev] [PATCH] net/ice: add support for ether type filter on FDIR
This patch enables FDIR with input set ethertype. Signed-off-by: Simei Su --- drivers/net/ice/ice_fdir_filter.c | 58 +++ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index c3f23a0..3bee4a1 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -18,6 +18,9 @@ #define ICE_FDIR_MAX_QREGION_SIZE 128 +#define ICE_FDIR_INSET_ETH (\ + ICE_INSET_ETHERTYPE) + #define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_INSET_DMAC | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \ @@ -102,6 +105,7 @@ }; static struct ice_pattern_match_item ice_fdir_pattern_comms[] = { + {pattern_ethertype,ICE_FDIR_INSET_ETH, ICE_INSET_NONE}, {pattern_eth_ipv4, ICE_FDIR_INSET_ETH_IPV4, ICE_INSET_NONE}, {pattern_eth_ipv4_udp, ICE_FDIR_INSET_ETH_IPV4_UDP, ICE_INSET_NONE}, {pattern_eth_ipv4_tcp, ICE_FDIR_INSET_ETH_IPV4_TCP, ICE_INSET_NONE}, @@ -894,6 +898,7 @@ }; static const struct ice_inset_map ice_inset_map[] = { {ICE_INSET_DMAC, ICE_FLOW_FIELD_IDX_ETH_DA}, + {ICE_INSET_ETHERTYPE, ICE_FLOW_FIELD_IDX_ETH_TYPE}, {ICE_INSET_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA}, {ICE_INSET_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA}, {ICE_INSET_IPV4_TOS, ICE_FLOW_FIELD_IDX_IPV4_DSCP}, @@ -1008,6 +1013,9 @@ else PMD_DRV_LOG(ERR, "not supported tunnel type."); break; + case ICE_FLTR_PTYPE_NON_IP_L2: + ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP); + break; default: PMD_DRV_LOG(ERR, "not supported filter type."); break; @@ -1613,6 +1621,8 @@ }; uint32_t vtc_flow_cpu; + enum rte_flow_item_type next_type; + uint16_t ether_type; for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { if (item->last) { @@ -1628,29 +1638,41 @@ case RTE_FLOW_ITEM_TYPE_ETH: eth_spec = item->spec; eth_mask = item->mask; + next_type = (item + 1)->type; + + if (next_type == RTE_FLOW_ITEM_TYPE_END && + (!eth_spec || !eth_mask)) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, "NULL eth spec/mask."); + return -rte_errno; + } if (eth_spec && eth_mask) { - if (!rte_is_zero_ether_addr(ð_spec->src) || - !rte_is_zero_ether_addr(ð_mask->src)) { - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ITEM, - item, - "Src mac not support"); - return -rte_errno; + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { + input_set |= ICE_INSET_DMAC; + rte_memcpy(&filter->input.ext_data.dst_mac, + ð_spec->dst, + RTE_ETHER_ADDR_LEN); } - if (!rte_is_broadcast_ether_addr(ð_mask->dst)) { - rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ITEM, - item, - "Invalid mac addr mask"); - return -rte_errno; + if (eth_mask->type == RTE_BE16(0x)) { + ether_type = rte_be_to_cpu_16(eth_spec->type); + if (ether_type == RTE_ETHER_TYPE_IPV4 || + ether_type == RTE_ETHER_TYPE_IPV6) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Unsupported ether_type."); + return -rte_errno; + } + + input_set |= ICE_INSET_ETHERTYPE; +
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi David, > > > > > > > > > > > > > > /** Status of crypto operation */ @@ -121,6 +123,13 @@ struct > > > > > rte_crypto_op { > > > > > struct rte_crypto_asym_op asym[0]; > > > > > /**< Asymmetric operation parameters */ > > > > > > > > > > +#ifdef RTE_LIBRTE_SECURITY > > > > > + uint8_t security[0]; > > > > > + /**< Security operation parameters > > > > > + * - Must be accessed through a rte_security_op pointer > > > > > + */ > > > > > +#endif > > > > > + > > > > > }; /**< operation specific parameters */ }; > > > > > > > > Is there any point to have this extra level of indirection? > > > > Might be simply: > > > > > > > > enum rte_crypto_op_type { > > > > > > > > + RTE_CRYPTO_OP_TYPE_SEC_DOCSIS, > > > > }; > > > > ... > > > > struct rte_crypto_op { > > > > > > > > __extension__ > > > > union { > > > > struct rte_crypto_sym_op sym[0]; > > > > /**< Symmetric operation parameters */ > > > > > > > > struct rte_crypto_asym_op asym[0]; > > > > /**< Asymmetric operation parameters */ > > > > > > > > + struct rte_security_docsis_op docsis[0]; > > > > > > > > }; /**< operation specific parameters */ > > > > > > > > ? > > > [DC] This was to allow some form of extensibility and not to limit this > > > to just > > DOCSIS. > > > If it's felt that having the extra level of indirection is overkill, it > > > can be easily > > changed. > > > > > > However, we cannot include a struct of type 'struct > > > rte_security_docsis_op' (or 'struct rte_security_op') directly here, > > > without creating nasty circular dependency of includes between > > rte_cryptodev and rte_security. > > > > > > I had tried defining an opaque version 'struct rte_security_op' (i.e. > > > no fields within the struct) here in rte_crypto.h, but the compiler > > > complained that it couldn't determine the size of the struct, even though > > it's a zero length array. > > > > > > That is why I had to use the uint8_t in 'uint8_t security[0];' - I > > > don't like this, but I couldn't find another way that kept the compiler > > > happy > > and didn't create a circular dependency. > > > > I see... would it be an option to name this struct 'struct rte_sym_docsis_op > > and and move actual definition inside > > lib/librte_cryptodev/rte_crypto_sym.h? > > > [DC] It's certainly an option and would work but I don't think it's a good > idea to be putting > protocol specific structs like this in rte_cryptodev - that's what > rte_security is for. > Do you think it would be ok to do this? I personally don't see a problem with this. In fact, as an extra thought - why we can't have docsis xform defined in lib/librte_cryptodev/rte_crypto_sym.h too, and then just have it as a member inside struct rte_crypto_sym_xform union? Then we can have rte_cryptodev_sym_session that supports docsis stuff. > > I'd be interested to hear what cryptodev/security maintainers and others > think too. > Akhil/Declan - any thoughts on best approach here?
Re: [dpdk-dev] [PATCH v1 1/2] eal/x86: add WC store function
On Thu, Jun 11, 2020 at 3:41 PM Radu Nicolau wrote: > > Add rte_write32_wc function that implements a WC store > using movdiri instruction. > > Signed-off-by: Radu Nicolau > --- > lib/librte_eal/x86/include/rte_io.h | 20 > 1 file changed, 20 insertions(+) > > diff --git a/lib/librte_eal/x86/include/rte_io.h > b/lib/librte_eal/x86/include/rte_io.h > index 2db71b1..3d74bec 100644 > --- a/lib/librte_eal/x86/include/rte_io.h > +++ b/lib/librte_eal/x86/include/rte_io.h > @@ -11,6 +11,26 @@ extern "C" { > > #include "generic/rte_io.h" > > +/** > + * Write a 32-bit value to I/O device memory address *addr*. > + * Uses MOVDIRI instruction to perform a direct-store operation using WC > + * memory write protocol. It will be an x86 specific API, Please change the API name to reflect that. > + * > + * @param value > + * Value to write > + * @param addr > + * I/O memory address to write the value to > + */ > +static __rte_always_inline void > +rte_write32_wc(uint32_t value, volatile void *addr) > +{ > + asm volatile("sfence\n\t" > + /* MOVDIRI */ > + ".byte 0x40, 0x0f, 0x38, 0xf9, 0x02" > + : > + : "a" (value), "d" (addr)); > +} > + > #ifdef __cplusplus > } > #endif > -- > 2.7.4 >
[dpdk-dev] [PATCH] examples: fix return value of function that parses portmask
Giving invalid or zero portmask as command line option to these applications will have an unexpected response. The reason behind this is that the return value of function that parses portmask is stored in a variable whose datatype is unsigned int, hence returning -1 in case of zero or invalid portmask causes an unexpected behaviour. If we return 0 instead of -1 this issue can be resolved. The program already contains the functionality to print "invalid portmask" and program usage if zero is returned. Signed-off-by: Sarosh Arif --- examples/distributor/main.c | 5 + examples/ioat/ioatfwd.c | 2 +- examples/ip_reassembly/main.c | 5 + examples/l2fwd-event/main.c | 5 + examples/l2fwd-jobstats/main.c | 5 + examples/l2fwd-keepalive/main.c | 5 + examples/l2fwd/main.c | 5 + examples/l3fwd-acl/main.c | 5 + examples/l3fwd-graph/main.c | 5 + examples/l3fwd-power/main.c | 5 + examples/l3fwd/main.c | 5 + examples/link_status_interrupt/main.c | 5 + examples/performance-thread/l3fwd-thread/main.c | 5 + examples/ptpclient/ptpclient.c | 5 + examples/qos_meter/main.c | 5 + examples/tep_termination/main.c | 5 + examples/vhost/main.c | 5 + examples/vm_power_manager/main.c| 5 + examples/vmdq/main.c| 5 + examples/vmdq_dcb/main.c| 5 + 20 files changed, 20 insertions(+), 77 deletions(-) diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 567c5e989..dca48c2ab 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -647,10 +647,7 @@ parse_portmask(const char *portmask) /* parse hexadecimal string */ pm = strtoul(portmask, &end, 16); if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) - return -1; - - if (pm == 0) - return -1; + return 0; return pm; } diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c index 53de23179..863dc0454 100644 --- a/examples/ioat/ioatfwd.c +++ b/examples/ioat/ioatfwd.c @@ -582,7 +582,7 @@ ioat_parse_portmask(const char *portmask) /* Parse hexadecimal string */ pm = strtoul(portmask, &end, 16); if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) - return -1; + return 0; return pm; } diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 494d7ee77..550fb53be 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -580,10 +580,7 @@ parse_portmask(const char *portmask) /* parse hexadecimal string */ pm = strtoul(portmask, &end, 16); if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) - return -1; - - if (pm == 0) - return -1; + return 0; return pm; } diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c index 9593ef11e..951a02106 100644 --- a/examples/l2fwd-event/main.c +++ b/examples/l2fwd-event/main.c @@ -39,10 +39,7 @@ l2fwd_event_parse_portmask(const char *portmask) /* parse hexadecimal string */ pm = strtoul(portmask, &end, 16); if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) - return -1; - - if (pm == 0) - return -1; + return 0; return pm; } diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 396fd89db..275407419 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -562,10 +562,7 @@ l2fwd_parse_portmask(const char *portmask) /* parse hexadecimal string */ pm = strtoul(portmask, &end, 16); if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) - return -1; - - if (pm == 0) - return -1; + return 0; return pm; } diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index b7585d55e..8d4a65990 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -305,10 +305,7 @@ l2fwd_parse_portmask(const char *portmask) /* parse hexadecimal string */ pm = strtoul(portmask, &end, 16); if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0')) - return -1; - - if (pm == 0) - return -1; + return 0; return pm; } diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index f8d14b843..a99b7558a 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -311,10 +311,7 @@ l2fwd_
[dpdk-dev] [RFC] ethdev: introduce sample action for rte flow
When using full offload, all traffic will be handled by the HW, and directed to the requested vf or wire, the control application loses visibility on the traffic. So there's a need for an action that will enable the control application some visibility. The solution is introduced a new action that will sample the incoming traffic and send a duplicated traffic in some predefined ratio to the application, while the original packet will continue to the target destination. The packets sampled equals is '1/ratio', if the ratio value be set to 1 , means that the packets would be completely mirrored. The sample packet can be assigned with different set of actions from the original packet. In order to support the sample packet in rte_flow, new rte_flow action definition RTE_FLOW_ACTION_TYPE_SAMPLE and structure rte_flow_action_sample will be introduced. The examples for the sample flow use case and result as below: 1. pattern eth / actions decap / sample (ratio=2, actions=mark 8, queue 2) / jump This flow will result in all the matched ingress packets will be decapsulated and jumped to next flow table, and the each second packet will also be decapsulated, marked and sent to queue 2 of the control application. 2. pattern eth / actions sample (ratio=1, actions=port 1) / port 2 The flow will result in all the matched ingress packets will be sent to port 2, and also mirrored the packets and sent to port 2. 3. pattern eth / actions sample (ratio=1, actions=encap, port 0) / encap / port 0 The flow will result in all the matched egress packets will be encapsulated and sent to wire, and also mirrored the packets and with the different encapsulated data and sent to wire. Add a new testpmd command 'set sample_actions' that supports the multiple sample actions list configuration by using the index: set sample_actions The examples for the test-pmd command that according the above sample flow case: 1. set sample_actions 0 mark id 0x8 / queue index 2 / end flow create...pattern eth / end actions raw_decap / sample ratio 2 index 0 / jump group 2 / end 2. set sample_actions 1 port_id id 1 / end flow create...pattern eth / end actions sample ratio 1 index 1 / port_id id 2 / end 3. set raw_encap 0 eth src.../ipv4.../... set raw_encap 1 eth src.../ipv4.../... set sample_actions 2 raw_encap index 0 / port_id id 0 / end flow create...pattern eth / end actions sample ratio 1 index 2 / raw_encap index 1 / port_id id 0 / end Signed-off-by: Jiawei Wang --- lib/librte_ethdev/rte_flow.c | 1 + lib/librte_ethdev/rte_flow.h | 29 + 2 files changed, 30 insertions(+) diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 1685be5f73..733871de63 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -173,6 +173,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(SET_IPV4_DSCP, sizeof(struct rte_flow_action_set_dscp)), MK_FLOW_ACTION(SET_IPV6_DSCP, sizeof(struct rte_flow_action_set_dscp)), MK_FLOW_ACTION(AGE, sizeof(struct rte_flow_action_age)), + MK_FLOW_ACTION(SAMPLE, sizeof(struct rte_flow_action_sample)), }; int diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index b0e4199192..71dd82c64f 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -2099,6 +2099,13 @@ enum rte_flow_action_type { * see enum RTE_ETH_EVENT_FLOW_AGED */ RTE_FLOW_ACTION_TYPE_AGE, + + /** +* Redirects specific ratio of packets to vport or queue. +* +* See struct rte_flow_action_sample. +*/ + RTE_FLOW_ACTION_TYPE_SAMPLE, }; /** @@ -2708,6 +2715,28 @@ struct rte_flow_action { */ struct rte_flow; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_SAMPLE + * + * Adds a sample action to a matched flow. + * + * The matching packets will be duplicated to a special queue or vport + * in the predefined probabiilty, All the packets continues processing + * on the default flow path. + * + * When the sample ratio is set to 1 then the packets will be 100% mirrored. + * Additional action list be supported to add for sampled or mirrored packets. + */ +struct rte_flow_action_sample { + /* packets sampled equals to '1/ratio' */ + const uint32_t ratio; + /* sub-action list specific for the sampling hit cases */ + const struct rte_flow_action *actions; +}; + /** * Verbose error types. * -- 2.21.0
Re: [dpdk-dev] [PATCH 1/2] cryptodev: add function to check if qp was setup
Hi Arek, > -Original Message- > From: Kusztal, ArkadiuszX > Sent: Wednesday, June 10, 2020 7:53 PM > To: dev@dpdk.org > Cc: akhil.go...@nxp.com; Trahe, Fiona ; > arkaduszx.kusz...@intel.com > Subject: [PATCH 1/2] cryptodev: add function to check if qp was setup > > From: Fiona Trahe > > This patch adds function that can check if queue pair > was already setup. This may be useful when dealing with > multi process approach in cryptodev. > > Signed-off-by: Fiona Trahe > --- > lib/librte_cryptodev/rte_cryptodev.c | 28 > lib/librte_cryptodev/rte_cryptodev.h | 14 ++ > 2 files changed, 42 insertions(+) > > diff --git a/lib/librte_cryptodev/rte_cryptodev.c > b/lib/librte_cryptodev/rte_cryptodev.c > index e37b83a..705387b 100644 > --- a/lib/librte_cryptodev/rte_cryptodev.c > +++ b/lib/librte_cryptodev/rte_cryptodev.c > @@ -1080,6 +1080,34 @@ rte_cryptodev_close(uint8_t dev_id) > } > > int > +rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id) [Fiona] This should be marked as experimental & added to map file > +{ > + struct rte_cryptodev *dev; > + > + if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) { > + CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id); > + return -(ENODEV); > + } > + > + dev = &rte_crypto_devices[dev_id]; > + if (queue_pair_id >= dev->data->nb_queue_pairs) { > + CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id); > + return -(ENODEV); [Fiona] -EINVAL would be more appropriate here > + } > + void **qps = dev->data->queue_pairs; > + > + if (qps[queue_pair_id]) { > + CDEV_LOG_INFO("qp %d on dev %d is initialised", [Fiona] This and below should use CDEV_LOG_DEBUG > + queue_pair_id, dev_id); > + return 1; > + } > + > + CDEV_LOG_INFO("qp %d on dev %d is not initialised", > + queue_pair_id, dev_id); > + return 0; > +} > + > +int > rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, > const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) > > diff --git a/lib/librte_cryptodev/rte_cryptodev.h > b/lib/librte_cryptodev/rte_cryptodev.h > index 4aaee73..d01a658 100644 > --- a/lib/librte_cryptodev/rte_cryptodev.h > +++ b/lib/librte_cryptodev/rte_cryptodev.h > @@ -727,6 +727,20 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t > queue_pair_id, > const struct rte_cryptodev_qp_conf *qp_conf, int socket_id); > > /** > + * Get the status of queue pairs setup on a specific crypto device > + * > + * @paramdev_id Crypto device identifier. > + * @paramqueue_pair_id The index of the queue pair to check. > + * > + * @return > + * - 0: qp was not configured > + * - 1: qp was configured > + * - -ENODEV: device was not configured > + */ > +int > +rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id); > + > +/** > * Get the number of queue pairs on a specific crypto device > * > * @paramdev_id Crypto device identifier. > -- > 2.1.0
[dpdk-dev] [PATCH 3/3] examples/fips_validation: fix overwrite of COUNT for TDES vectors
Application updates first line of each test vector with COUNT = i(where i = 1,2,3..) assuming first line contains COUNT string. But few of the TDES input test vectors don't contain COUNT string and thus COUNT is getting overwritten on other data. Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing") Signed-off-by: Archana Muniganti Signed-off-by: Kanaka Durga Kotamarthy --- examples/fips_validation/fips_validation.c | 8 examples/fips_validation/main.c| 5 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 3aaec20..9bdf257 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -640,6 +640,14 @@ cb = &info.writeback_callbacks[0]; + if (!(strstr(info.vec[0], cb->key))) { + fprintf(info.fp_wr, "%s%u\n", cb->key, count); + i = 0; + } else { + snprintf(info.vec[0], strlen(info.vec[0]) + 4, "%s%u", cb->key, + count); + i = 1; + } snprintf(info.vec[0], strlen(info.vec[0]) + 4, "%s%u", cb->key, count); for (i = 1; i < info.nb_vec_lines; i++) { diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index f9b2056..efd32a8 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1070,7 +1070,10 @@ struct fips_test_ops { int test_mode = info.interim_info.tdes_data.test_mode; for (i = 0; i < TDES_EXTERN_ITER; i++) { - if (i != 0) + if (i == 0) { + if (!(strstr(info.vec[0], "COUNT"))) + fprintf(info.fp_wr, "%s%u\n", "COUNT = ", 0); + } else update_info_vec(i); fips_test_write_one_case(); -- 1.8.3.1
Re: [dpdk-dev] [PATCH 2/2] cryptodev: add cryptodev trace in multi process function
> -Original Message- > From: Kusztal, ArkadiuszX > Sent: Wednesday, June 10, 2020 7:53 PM > To: dev@dpdk.org > Cc: akhil.go...@nxp.com; Trahe, Fiona ; > arkaduszx.kusz...@intel.com > Subject: [PATCH 2/2] cryptodev: add cryptodev trace in multi process function > > From: Fiona Trahe > > This patch adds traces to some Cryptodev functions that are used > in primary/secondary context. > > Signed-off-by: Fiona Trahe Acked-by: Fiona Trahe
[dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback
Fix missing callback registration and the incorrect callback definition for interim NK_STR. The callback should compare input key against the interim. Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing") Signed-off-by: Archana Muniganti --- examples/fips_validation/fips_validation_tdes.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/fips_validation/fips_validation_tdes.c b/examples/fips_validation/fips_validation_tdes.c index 84dd288..a1ddd57 100644 --- a/examples/fips_validation/fips_validation_tdes.c +++ b/examples/fips_validation/fips_validation_tdes.c @@ -59,9 +59,7 @@ struct { parse_tdes_uint8_hex_str(const char *key, char *src, struct fips_val *val); static int -parse_tdes_interim(const char *key, - __rte_unused char *text, - struct fips_val *val); +parse_tdes_interim(const char *key, char *text, struct fips_val *val); struct fips_test_callback tdes_tests_vectors[] = { {KEYS_STR, parse_tdes_uint8_hex_str, &vec.cipher_auth.key}, @@ -77,6 +75,7 @@ struct fips_test_callback tdes_tests_vectors[] = { struct fips_test_callback tdes_tests_interim_vectors[] = { {ENC_STR, parse_tdes_interim, NULL}, {DEC_STR, parse_tdes_interim, NULL}, + {NK_STR, parse_tdes_interim, NULL}, {NULL, NULL, NULL} /**< end pointer */ }; @@ -94,21 +93,23 @@ struct fips_test_callback tdes_writeback_callbacks[] = { }; static int -parse_tdes_interim(const char *key, - __rte_unused char *text, +parse_tdes_interim(const char *key, char *text, __rte_unused struct fips_val *val) { if (strstr(key, ENC_STR)) info.op = FIPS_TEST_ENC_AUTH_GEN; else if (strstr(key, DEC_STR)) info.op = FIPS_TEST_DEC_AUTH_VERIF; - else if (strstr(NK_STR, "NumKeys = 1")) - info.interim_info.tdes_data.nb_keys = 1; - else if (strstr(NK_STR, "NumKeys = 2")) - info.interim_info.tdes_data.nb_keys = 2; - else if (strstr(NK_STR, "NumKeys = 3")) - info.interim_info.tdes_data.nb_keys = 3; - else + else if (strstr(key, NK_STR)) { + if (strcmp(text, "NumKeys = 1") == 0) + info.interim_info.tdes_data.nb_keys = 1; + else if (strcmp(text, "NumKeys = 2") == 0) + info.interim_info.tdes_data.nb_keys = 2; + else if (strcmp(text, "NumKeys = 3") == 0) + info.interim_info.tdes_data.nb_keys = 3; + else + return -EINVAL; + } else return -EINVAL; return 0; -- 1.8.3.1
[dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors
From: Ayuj Verma Processing of test vector for COUNT = 0 is getting skipped, as some of the NIST TDES files doesn't have an empty line after [ENCRYPT]/[DECRYPT] and thus treated as an interim block. Parse function now identifies such blocks, separates out interim and test vector data, and then parses each with their respective callbacks. Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application") Signed-off-by: Archana Muniganti Signed-off-by: Ayuj Verma --- examples/fips_validation/fips_validation.c | 21 +++-- examples/fips_validation/fips_validation.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index a34e34d..3aaec20 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -340,11 +340,13 @@ fips_test_parse_one_case(void) { uint32_t i, j = 0; - uint32_t is_interim = 0; + uint32_t is_interim; + uint32_t interim_cnt = 0; int ret; if (info.interim_callbacks) { for (i = 0; i < info.nb_vec_lines; i++) { + is_interim = 0; for (j = 0; info.interim_callbacks[j].key != NULL; j++) if (strstr(info.vec[i], info.interim_callbacks[j].key)) { @@ -357,17 +359,24 @@ if (ret < 0) return ret; } + + if (is_interim) + interim_cnt += 1; } } - if (is_interim) { - for (i = 0; i < info.nb_vec_lines; i++) + info.vec_start_off = interim_cnt; + + if (interim_cnt) { + for (i = 0; i < interim_cnt; i++) fprintf(info.fp_wr, "%s\n", info.vec[i]); fprintf(info.fp_wr, "\n"); - return 1; + + if (info.nb_vec_lines == interim_cnt) + return 1; } - for (i = 0; i < info.nb_vec_lines; i++) { + for (i = info.vec_start_off; i < info.nb_vec_lines; i++) { for (j = 0; info.callbacks[j].key != NULL; j++) if (strstr(info.vec[i], info.callbacks[j].key)) { ret = info.callbacks[j].cb( @@ -387,7 +396,7 @@ { uint32_t i; - for (i = 0; i < info.nb_vec_lines; i++) + for (i = info.vec_start_off; i < info.nb_vec_lines; i++) fprintf(info.fp_wr, "%s\n", info.vec[i]); } diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index 5aee955..75fa555 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -161,6 +161,7 @@ struct fips_test_interim_info { enum fips_test_algorithms algo; char *one_line_text; char *vec[MAX_LINE_PER_VECTOR]; + uint32_t vec_start_off; uint32_t nb_vec_lines; char device_name[MAX_STRING_SIZE]; char file_name[MAX_STRING_SIZE]; -- 1.8.3.1
Re: [dpdk-dev] [PATCH] crypto/qat: add handling of multi process
Hi Arek, > -Original Message- > From: Kusztal, ArkadiuszX > Sent: Wednesday, June 10, 2020 8:06 PM > To: dev@dpdk.org > Cc: akhil.go...@nxp.com; Trahe, Fiona ; Kusztal, > ArkadiuszX > > Subject: [PATCH] crypto/qat: add handling of multi process > > This patch improves handling of multi process applications > using Intel QuickAssist Technology PMD. > > Signed-off-by: Arek Kusztal > --- > drivers/common/qat/qat_device.c | 103 > > drivers/common/qat/qat_device.h | 69 +--- > drivers/common/qat/qat_qp.c | 10 ++-- > drivers/compress/qat/qat_comp_pmd.c | 43 +++ > drivers/compress/qat/qat_comp_pmd.h | 2 + > drivers/crypto/qat/qat_asym.c | 4 +- > drivers/crypto/qat/qat_asym_pmd.c | 62 +- > drivers/crypto/qat/qat_asym_pmd.h | 4 +- > drivers/crypto/qat/qat_sym.c| 2 +- > drivers/crypto/qat/qat_sym.h| 2 +- > drivers/crypto/qat/qat_sym_pmd.c| 87 +++--- > drivers/crypto/qat/qat_sym_pmd.h| 4 +- > 12 files changed, 277 insertions(+), 115 deletions(-) > > diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c > index 2b41d9a..fc25b02 100644 > --- a/drivers/common/qat/qat_device.c > +++ b/drivers/common/qat/qat_device.c > @@ -32,8 +32,8 @@ struct qat_gen_hw_data qat_gen_config[] = { > }, > }; > > - > -static struct qat_pci_device qat_pci_devices[RTE_PMD_QAT_MAX_PCI_DEVICES]; > +/* per-process array of device data */ > +struct qat_device_info qat_pci_devs[RTE_PMD_QAT_MAX_PCI_DEVICES]; > static int qat_nb_pci_devices; > > /* > @@ -60,26 +60,20 @@ static const struct rte_pci_id pci_id_qat_map[] = { > }; > > static struct qat_pci_device * > -qat_pci_get_dev(uint8_t dev_id) > -{ > - return &qat_pci_devices[dev_id]; > -} > - > -static struct qat_pci_device * > qat_pci_get_named_dev(const char *name) > { > - struct qat_pci_device *dev; > unsigned int i; > > if (name == NULL) > return NULL; > > for (i = 0; i < RTE_PMD_QAT_MAX_PCI_DEVICES; i++) { > - dev = &qat_pci_devices[i]; > - > - if ((dev->attached == QAT_ATTACHED) && > - (strcmp(dev->name, name) == 0)) > - return dev; > + if (qat_pci_devs[i].mz && > + (strcmp(((struct qat_pci_device *) > + qat_pci_devs[i].mz->addr)->name, name) > + == 0)) > + return (struct qat_pci_device *) > + qat_pci_devs[i].mz->addr; > } > > return NULL; > @@ -88,13 +82,13 @@ qat_pci_get_named_dev(const char *name) > static uint8_t > qat_pci_find_free_device_index(void) > { > - uint8_t dev_id; > + uint8_t dev_id; > > - for (dev_id = 0; dev_id < RTE_PMD_QAT_MAX_PCI_DEVICES; dev_id++) { > - if (qat_pci_devices[dev_id].attached == QAT_DETACHED) > - break; > - } > - return dev_id; > + for (dev_id = 0; dev_id < RTE_PMD_QAT_MAX_PCI_DEVICES; > dev_id++) { > + if (qat_pci_devs[dev_id].mz == NULL) > + break; > + } > + return dev_id; > } > > struct qat_pci_device * > @@ -169,12 +163,29 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev, > struct qat_dev_cmd_param *qat_dev_cmd_param) > { > struct qat_pci_device *qat_dev; > - uint8_t qat_dev_id; > + uint8_t qat_dev_id = 0; > char name[QAT_DEV_NAME_MAX_LEN]; > struct rte_devargs *devargs = pci_dev->device.devargs; > > rte_pci_device_name(&pci_dev->addr, name, sizeof(name)); > snprintf(name+strlen(name), QAT_DEV_NAME_MAX_LEN-strlen(name), "_qat"); > + > + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { > + const struct rte_memzone *mz = rte_memzone_lookup(name); > + > + if (mz == NULL) { > + QAT_LOG(ERR, "Error when searching allocated %s", name); > + return NULL; > + } > + qat_dev = mz->addr; > + qat_pci_devs[qat_dev->qat_dev_id].mz = mz; > + qat_pci_devs[qat_dev->qat_dev_id].pci_dev = pci_dev; > + qat_nb_pci_devices++; > + QAT_LOG(DEBUG, "QAT device %d found, name %s, total QATs %d", > + qat_dev->qat_dev_id, qat_dev->name, qat_nb_pci_devices); > + return qat_dev; > + } > + > if (qat_pci_get_named_dev(name) != NULL) { > QAT_LOG(ERR, "QAT device with name %s already allocated!", > name); > @@ -187,12 +198,22 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev, > return NULL; > } > > - qat_dev = qat_pci_get_dev(qat_dev_id); > + qat_pci_devs[qat_dev_id].mz = rte_memzone_reserve(name, > +
Re: [dpdk-dev] [PATCH v1 1/2] eal/x86: add WC store function
On 6/11/2020 1:23 PM, Jerin Jacob wrote: On Thu, Jun 11, 2020 at 3:41 PM Radu Nicolau wrote: Add rte_write32_wc function that implements a WC store using movdiri instruction. Signed-off-by: Radu Nicolau --- lib/librte_eal/x86/include/rte_io.h | 20 1 file changed, 20 insertions(+) diff --git a/lib/librte_eal/x86/include/rte_io.h b/lib/librte_eal/x86/include/rte_io.h index 2db71b1..3d74bec 100644 --- a/lib/librte_eal/x86/include/rte_io.h +++ b/lib/librte_eal/x86/include/rte_io.h @@ -11,6 +11,26 @@ extern "C" { #include "generic/rte_io.h" +/** + * Write a 32-bit value to I/O device memory address *addr*. + * Uses MOVDIRI instruction to perform a direct-store operation using WC + * memory write protocol. It will be an x86 specific API, Please change the API name to reflect that. You mean something like rte_x86_write32_wc?
Re: [dpdk-dev] [PATCH 2/3] cryptodev: add security operation to crypto operation
Hi Konstantin, > > > > > > > > > > > > > > > > > /** Status of crypto operation */ @@ -121,6 +123,13 @@ struct > > > > > > rte_crypto_op { > > > > > > struct rte_crypto_asym_op asym[0]; > > > > > > /**< Asymmetric operation parameters */ > > > > > > > > > > > > +#ifdef RTE_LIBRTE_SECURITY > > > > > > + uint8_t security[0]; > > > > > > + /**< Security operation parameters > > > > > > +* - Must be accessed through a rte_security_op > pointer > > > > > > +*/ > > > > > > +#endif > > > > > > + > > > > > > }; /**< operation specific parameters */ }; > > > > > > > > > > Is there any point to have this extra level of indirection? > > > > > Might be simply: > > > > > > > > > > enum rte_crypto_op_type { > > > > > > > > > > + RTE_CRYPTO_OP_TYPE_SEC_DOCSIS, > > > > > }; > > > > > ... > > > > > struct rte_crypto_op { > > > > > > > > > > __extension__ > > > > > union { > > > > > struct rte_crypto_sym_op sym[0]; > > > > > /**< Symmetric operation parameters */ > > > > > > > > > > struct rte_crypto_asym_op asym[0]; > > > > > /**< Asymmetric operation parameters */ > > > > > > > > > > + struct rte_security_docsis_op docsis[0]; > > > > > > > > > > }; /**< operation specific parameters */ > > > > > > > > > > ? > > > > [DC] This was to allow some form of extensibility and not to limit > > > > this to just > > > DOCSIS. > > > > If it's felt that having the extra level of indirection is > > > > overkill, it can be easily > > > changed. > > > > > > > > However, we cannot include a struct of type 'struct > > > > rte_security_docsis_op' (or 'struct rte_security_op') directly > > > > here, without creating nasty circular dependency of includes > > > > between > > > rte_cryptodev and rte_security. > > > > > > > > I had tried defining an opaque version 'struct rte_security_op' (i.e. > > > > no fields within the struct) here in rte_crypto.h, but the > > > > compiler complained that it couldn't determine the size of the > > > > struct, even though > > > it's a zero length array. > > > > > > > > That is why I had to use the uint8_t in 'uint8_t security[0];' - I > > > > don't like this, but I couldn't find another way that kept the > > > > compiler happy > > > and didn't create a circular dependency. > > > > > > I see... would it be an option to name this struct 'struct > > > rte_sym_docsis_op and and move actual definition inside > > > lib/librte_cryptodev/rte_crypto_sym.h? > > > > > [DC] It's certainly an option and would work but I don't think it's a > > good idea to be putting protocol specific structs like this in > > rte_cryptodev - > that's what rte_security is for. > > Do you think it would be ok to do this? > > I personally don't see a problem with this. > In fact, as an extra thought - why we can't have docsis xform defined in > lib/librte_cryptodev/rte_crypto_sym.h too, and then just have it as a > member inside struct rte_crypto_sym_xform union? > Then we can have rte_cryptodev_sym_session that supports docsis stuff. > [DC] Because DOCSIS protocol and CRC are not specifically crypto related is why we initially went down the rawdev/multi-fn route and now the rte_security route. I think adding docsis xforms/ops and CRC related data to cryptodev would be adding too much non-crypto algorithm related stuff to this library. There would then be some protocols like IPSec and PDCP with their definitions in rte_security and others like DOCSIS in rte_cryptodev - that doesn't seem good to me. Yes, from a DOCSIS equipment vendors point-of-view, who already use cryptodev for just encryption/decryption, adding DOCSIS to cryptodev would be best for them in order to get better DOCSIS support in DPDK as it would mean less churn for their applications. However, from a DPDK point-of-view, I don't think it would be correct to do this. That's just my opinion, and again I'd be interested to hear other people's thoughts. > > > > I'd be interested to hear what cryptodev/security maintainers and others > think too. > > Akhil/Declan - any thoughts on best approach here?
Re: [dpdk-dev] [PATCH] mbuf: align rte_mbuf for Windows
11/06/2020 13:43, Olivier Matz: > On Tue, May 19, 2020 at 03:15:19PM -0700, Ranjit Menon wrote: > > On 5/19/2020 1:18 PM, Thomas Monjalon wrote: > > > 19/05/2020 21:57, Dmitry Kozlyuk: > > > > On Tue, 19 May 2020 20:49:50 +0200 > > > > Thomas Monjalon wrote: > > > > > > > > > +Cc more maintainers > > > > > > > > > > 19/05/2020 20:41, tal...@mellanox.com: > > > > > > From: Tal Shnaiderman > > > > > > > > > > > > Using uint32_t type bit-fields in Windows will pads the > > > > > > 'L2/L3/L4 and tunnel information' union with additional bits. > > > > > > > > > > > > This padding causes rte_mbuf size misalignment and the total size > > > > > > increases to 3 cache-lines. > > > > > > > > > > > > Changed packet_type bit-fields types from uint32_t to uint8_t > > > > > > to allow unified 2 cache-line structure size. > > > > > > > > > > > > Added the __extension__ attribute over the modified struct to avoid > > > > > > the warning: > > > > > > > > > > > > type of bit-field ... is a GCC extension [-pedantic] > > > > > > > > > > > > Signed-off-by: Tal Shnaiderman > > Acked-by: Olivier Matz Applied, thanks
Re: [dpdk-dev] [PATCH v3] eal/windows: fix invalid thread handle
02/06/2020 04:00, Tasnim Bashar: > --- a/lib/librte_eal/windows/include/rte_windows.h > +++ b/lib/librte_eal/windows/include/rte_windows.h > @@ -29,6 +29,7 @@ > #define INITGUID > #endif > #include > +#include Why do you need adding rte_log in rte_windows?
Re: [dpdk-dev] [PATCH v1] net/axgbe: enable IEEE 1588 PTP support for axgbe
[AMD Official Use Only - Internal Distribution Only] Hi Pablo, Can you please help ? Thanks and Regards Selwin Sebastian -Original Message- From: Ferruh Yigit Sent: Tuesday, June 9, 2020 9:34 PM To: Sebastian, Selwin ; dev@dpdk.org Cc: Somalapuram, Amaranath ; Pablo de Lara Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: enable IEEE 1588 PTP support for axgbe [CAUTION: External Email] On 6/9/2020 4:42 PM, Sebastian, Selwin wrote: > [AMD Official Use Only - Internal Distribution Only] > > Hi Ferruh, > Added recommended modifications and resubmitted the patch. Removed > offloads handling part and "DEV_TX_OFFLOAD_MULTI_SEGS" Flag also as it is not > yet supported by driver. > Commit 0625a29f42c62998318ee3e05b2420e436318678 forces the usage of > DEV_TX_OFFLOAD_MULTI_SEGS for using ptpclient test application. I had to > remove this commit for my test. Any inputs on how this can be handled ? Cc'ed Pablo. According to the commit log "full Tx path" required for IEEE1588. Is the DEV_TX_OFFLOAD_MULTI_SEGS requirement for IEEE1588, if so axgbe driver needs to implement it before claiming the IEEE1588 support. Or 'DEV_TX_OFFLOAD_MULTI_SEGS' may be used to force the underlying PMD to the use the scalar data path. Pablo can answer this better. > > Regards > Selwin > > -Original Message- > From: Ferruh Yigit > Sent: Friday, June 5, 2020 8:34 PM > To: Sebastian, Selwin ; dev@dpdk.org > Cc: Somalapuram, Amaranath > Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: enable IEEE 1588 PTP > support for axgbe > > [CAUTION: External Email] > > On 6/1/2020 1:57 PM, selwin.sebast...@amd.com wrote: >> From: Selwin Sebastian >> >> Add ethdev APIs to support PTP timestamping > > For the patch title, "net/axgbe: " already says the change is in the 'axgbe' > driver, no need to duplicate " .. support for axgbe". > > <...> > >> +static inline uint64_t >> +div_u64_rem(uint64_t dividend, uint32_t divisor, uint32_t >> +*remainder) { >> + *remainder = dividend % divisor; >> + return dividend / divisor; >> +} >> + >> +static inline uint64_t div_u64(uint64_t dividend, uint32_t divisor) >> +{ > > The coding convention [1] we have says return type will be on seperate line, > as already done in some of these functions. Since this is new code, better to > start good, can you please apply the coding convention to all fucntions, like: > > static inline uint64_t > div_u64(uint64_t dividend, uint32_t divisor) > > [1] > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc. > dpdk.org%2Fguides%2Fcontributing%2Fcoding_style.html&data=02%7C01% > 7CSelwin.Sebastian%40amd.com%7Cf68e63a441694a33637c08d80c8ec76f%7C3dd8 > 961fe4884e608e11a82d994e183d%7C0%7C0%7C637273154657245807&sdata=P6 > vU9bOzwKTBSJZFWQXEnnb6Wu%2FCViJ6kM1Cm2faeJU%3D&reserved=0 > (I definitly suggest reading it if you didn't already) > > <...> > >> @@ -487,6 +490,7 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, >> uint16_t queue_idx, >> struct axgbe_tx_queue *txq; >> unsigned int tsize; >> const struct rte_memzone *tz; >> + struct rte_eth_dev_data *dev_data; >> >> tx_desc = nb_desc; >> pdata = dev->data->dev_private; @@ -507,6 +511,7 @@ int >> axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, >> return -ENOMEM; >> txq->pdata = pdata; >> >> + dev_data = pdata->eth_dev->data; >> txq->nb_desc = tx_desc; >> txq->free_thresh = tx_conf->tx_free_thresh ? >> tx_conf->tx_free_thresh : AXGBE_TX_FREE_THRESH; @@ >> -518,7 +523,7 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, >> uint16_t queue_idx, >> if (txq->nb_desc % txq->free_thresh != 0) >> txq->vector_disable = 1; >> >> - if (tx_conf->offloads != 0) >> + if ((tx_conf->offloads != 0) || >> + dev_data->dev_conf.txmode.offloads) >> txq->vector_disable = 1; > > > This change seems unrelated with the rest of the patch, and I far as I > remember this was in the another patch too. What do you think making this > seperate patch with the proper description it deserves? >
Re: [dpdk-dev] [PATCH v2] eal/windows: support thread ID query
25/05/2020 03:08, Dmitry Kozlyuk: > On Wed, 20 May 2020 17:32:53 -0700 > Tasnim Bashar wrote: > > > Add rte_sys_gettid function to use rte_gettid() on Windows. > > rte_gettid() is required for recursive spin lock and recursive ticket lock. > > > > Signed-off-by: Tasnim Bashar > > Acked-by: Dmitry Kozlyuk Applied, thanks
Re: [dpdk-dev] [PATCH v7 0/3] eal timer split and implementation for Windows
19/05/2020 01:20, Fady Bader: > This patchset splits OS dependent EAL timer functions and implements them for > windows. > > Fady Bader (3): > timer: move from common to Unix directory > eal: proc type function for Windows > timer: support EAL functions on Windows This series is pending for review.
Re: [dpdk-dev] [PATCH v2] mbuf: fix out-of-bounds access
On Thu, Jun 11, 2020 at 08:48:01AM +0800, Xiaolong Ye wrote: > We should make sure off + size < sizeof(struct rte_mbuf) to avoid > possible out-of-bounds access of free_space array, there is no issue > currently due to the low bits of free_flags (which is adjacent to > free_space) are always set to 0. But we shouldn't rely on it since it's > fragile and layout of struct mbuf_dyn_shm may be changed in the future. > This patch adds boundary check explicitly to avoid potential risk of > out-of-bounds access. > > Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") > Cc: sta...@dpdk.org > > Signed-off-by: Xiaolong Ye I suggest to change the title in: mbuf: fix out-of-bounds access at dyn field register Thomas, as Xiaolong pointed-out, it fixes a bug in the code but there is no impact. I let you decide if it should be tagged as a fix or not, and if it should be backported. I'll tend to say yes. Acked-by: Olivier Matz > --- > > V2: put the check before accessing free_space > > lib/librte_mbuf/rte_mbuf_dyn.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c > index d6931f847..9d6388cff 100644 > --- a/lib/librte_mbuf/rte_mbuf_dyn.c > +++ b/lib/librte_mbuf/rte_mbuf_dyn.c > @@ -71,7 +71,8 @@ process_score(void) > > for (off = 0; off < sizeof(struct rte_mbuf); off++) { > /* get the size of the free zone */ > - for (size = 0; shm->free_space[off + size]; size++) > + for (size = 0; (off + size) < sizeof(struct rte_mbuf) && > + shm->free_space[off + size]; size++) > ; > if (size == 0) > continue; > -- > 2.17.1 >
Re: [dpdk-dev] [PATCH v4 2/2] test/cryptodev: add chacha poly test cases to cryptodev
Minor nit inline. Acked-by: Anoob Joseph > -Original Message- > From: dev On Behalf Of Arek Kusztal > Sent: Thursday, June 11, 2020 12:48 AM > To: dev@dpdk.org > Cc: akhil.go...@nxp.com; fiona.tr...@intel.com; Arek Kusztal > > Subject: [dpdk-dev] [PATCH v4 2/2] test/cryptodev: add chacha poly test > cases to cryptodev > > This patch adds Chacha20-Poly1305 implementation to cryptodev tests. > > Signed-off-by: Arek Kusztal > --- > v4: > - resent in 20.08 DPDK window > > app/test/test_cryptodev.c | 18 ++- > app/test/test_cryptodev_aead_test_vectors.h | 75 > + > 2 files changed, 92 insertions(+), 1 deletion(-) > > diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index > 8f63146..2f94ab1 100644 > --- a/app/test/test_cryptodev.c > +++ b/app/test/test_cryptodev.c > @@ -11502,6 +11502,18 @@ > auth_decrypt_AES128CBC_HMAC_SHA1_esn_check(void) > &aes128cbc_hmac_sha1_aad_test_vector); > } > > +static int > +test_chacha20_poly1305_encrypt_test_case_rfc8439(void) > +{ > + return > test_authenticated_encryption(&chacha20_poly1305_case_rfc8439); > +} > + > +static int > +test_chacha20_poly1305_decrypt_test_case_rfc8439(void) > +{ > + return > test_authenticated_decryption(&chacha20_poly1305_case_rfc8439); > +} > + > #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER > > /* global AESNI slave IDs for the scheduler test */ @@ -11956,7 +11968,11 > @@ static struct unit_test_suite cryptodev_testsuite = { > test_AES_GMAC_authentication_test_case_4), > TEST_CASE_ST(ut_setup, ut_teardown, > > test_AES_GMAC_authentication_verify_test_case_4), > - > + /** Chacha20-Poly1305 */ > + TEST_CASE_ST(ut_setup, ut_teardown, > + > test_chacha20_poly1305_encrypt_test_case_rfc8439), > + TEST_CASE_ST(ut_setup, ut_teardown, > + [Anoob] Might be better to keep a blank line between individual test blocks. Can keep the existing blank line (which got removed in this patch) and add a new one after. > test_chacha20_poly1305_decrypt_test_case_rfc8439), > /** SNOW 3G encrypt only (UEA2) */ > TEST_CASE_ST(ut_setup, ut_teardown, > test_snow3g_encryption_test_case_1), > diff --git a/app/test/test_cryptodev_aead_test_vectors.h > b/app/test/test_cryptodev_aead_test_vectors.h > index e62fdb2..140f253 100644 > --- a/app/test/test_cryptodev_aead_test_vectors.h > +++ b/app/test/test_cryptodev_aead_test_vectors.h > @@ -3823,4 +3823,79 @@ static const struct aead_test_data > ccm_test_case_256_3 = { > .len = 8 > } > }; > +static uint8_t chacha_aad_rfc8439[] = { > + 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, > + 0xc4, 0xc5, 0xc6, 0xc7 > +}; > + > +static const struct aead_test_data chacha20_poly1305_case_rfc8439 = { > + .algo = RTE_CRYPTO_AEAD_CHACHA20_POLY1305, > + .key = { > + .data = { > + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, > + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, > + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, > + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f > + }, > + .len = 32 > + }, > + .iv = { > + .data = { > + 0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43, > + 0x44, 0x45, 0x46, 0x47 > + }, > + .len = 12 > + }, > + .aad = { > + .data = chacha_aad_rfc8439, > + .len = 12 > + }, > + .plaintext = { > + .data = { > + 0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61, > + 0x6e, 0x64, 0x20, 0x47, 0x65, 0x6e, 0x74, 0x6c, > + 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20, > + 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x73, > + 0x73, 0x20, 0x6f, 0x66, 0x20, 0x27, 0x39, 0x39, > + 0x3a, 0x20, 0x49, 0x66, 0x20, 0x49, 0x20, 0x63, > + 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x66, > + 0x65, 0x72, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x6f, > + 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20, > + 0x74, 0x69, 0x70, 0x20, 0x66, 0x6f, 0x72, 0x20, > + 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x74, 0x75, > + 0x72, 0x65, 0x2c, 0x20, 0x73, 0x75, 0x6e, 0x73, > + 0x63, 0x72, 0x65, 0x65, 0x6e, 0x20, 0x77, 0x6f, > + 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69, > + 0x74, 0x2e > + }, > + .len = 114 > + }, > + .ciphertext = { > + .data = { > + 0xd3, 0x1a, 0x8d, 0x34, 0x64, 0x8e, 0x60, 0xdb, > + 0x7b, 0x86, 0xaf, 0xbc,
[dpdk-dev] [RFC][PATCH v2 1/3] net/mlx5: add counter-to-ns converter from libibverbs
While some devices update their own clock info to provide current time, mlx5dv part of libibverbs already handles this and also converts any raw counter cycle to nanoseconds. Signed-off-by: Patrick Keroulas --- drivers/common/mlx5/linux/mlx5_glue.c | 16 ++ drivers/common/mlx5/linux/mlx5_glue.h | 4 drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_ethdev.c| 30 +++ 5 files changed, 52 insertions(+) diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index c91ee33bb..cac24015b 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -80,6 +80,20 @@ mlx5_glue_query_rt_values_ex(struct ibv_context *context, return ibv_query_rt_values_ex(context, values); } +static int +mlx5_glue_get_clock_info(struct ibv_context *context, + struct mlx5dv_clock_info *clock_info) +{ + return mlx5dv_get_clock_info(context, clock_info); +} + +static uint64_t +mlx5_glue_mlx5dv_ts_to_ns(struct mlx5dv_clock_info *clock_info, + uint64_t device_timestamp) +{ + return mlx5dv_ts_to_ns(clock_info, device_timestamp); +} + static int mlx5_glue_query_port(struct ibv_context *context, uint8_t port_num, struct ibv_port_attr *port_attr) @@ -1207,6 +1221,8 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) { .query_device = mlx5_glue_query_device, .query_device_ex = mlx5_glue_query_device_ex, .query_rt_values_ex = mlx5_glue_query_rt_values_ex, + .get_clock_info = mlx5_glue_get_clock_info, + .convert_ts_to_ns = mlx5_glue_mlx5dv_ts_to_ns, .query_port = mlx5_glue_query_port, .create_comp_channel = mlx5_glue_create_comp_channel, .destroy_comp_channel = mlx5_glue_destroy_comp_channel, diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index 5d238a40a..8d05e7398 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -123,6 +123,10 @@ struct mlx5_glue { struct ibv_port_attr *port_attr); struct ibv_comp_channel *(*create_comp_channel) (struct ibv_context *context); + int (*get_clock_info)(struct ibv_context *context, + struct mlx5dv_clock_info *clock_info); + uint64_t (*convert_ts_to_ns)(struct mlx5dv_clock_info *clock_info, + uint64_t device_timestamp); int (*destroy_comp_channel)(struct ibv_comp_channel *channel); struct ibv_cq *(*create_cq)(struct ibv_context *context, int cqe, void *cq_context, diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 7c5e23d9f..c14117f5b 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1241,6 +1241,7 @@ const struct eth_dev_ops mlx5_dev_ops = { .xstats_get_names = mlx5_xstats_get_names, .fw_version_get = mlx5_fw_version_get, .dev_infos_get = mlx5_dev_infos_get, + .convert_ts_to_ns = mlx5_convert_ts_to_ns, .read_clock = mlx5_read_clock, .dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get, .vlan_filter_set = mlx5_vlan_filter_set, diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 8c4b234e5..f4906a54e 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -720,6 +720,7 @@ int mlx5_set_flags(struct rte_eth_dev *dev, unsigned int keep, unsigned int flags); int mlx5_dev_configure(struct rte_eth_dev *dev); int mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info); +int mlx5_convert_ts_to_ns(struct rte_eth_dev *dev, uint64_t *timestamp); int mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock); int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size); const uint32_t *mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 6b8b30322..374c9a226 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -690,6 +690,36 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) return 0; } +/** + * Convert raw clock counter to nanoseconds + * + * @param dev + * Pointer to Ethernet device structure. + * @param[in&out] timestamp + * Pointer to the timestamp to be converted. + * + * @return + * 0 if the clock has correctly been read + * The value of errno in case of error + */ +int +mlx5_convert_ts_to_ns(struct rte_eth_dev *dev, uint64_t *timestamp) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct ibv_context *ctx = priv->sh->ctx; + struct mlx5dv_clock_info clock_info; + + int err = mlx5_glue->get_clock_info(ctx, &clock_info); + if (err !=
[dpdk-dev] [RFC][PATCH v2 2/3] ethdev: add API to convert raw timestamps to nsec
Existing ethdev functions can read/write time from/to device but they're all related to timesync and none of them can translate a raw counter in real time unit which is usefull in a pdump application. A new API is required because the conversion is derived from dev clock info. Signed-off-by: Patrick Keroulas --- lib/librte_ethdev/rte_ethdev.c | 12 lib/librte_ethdev/rte_ethdev.h | 17 + lib/librte_ethdev/rte_ethdev_core.h | 5 + lib/librte_ethdev/rte_ethdev_version.map | 2 ++ lib/librte_mbuf/rte_mbuf_core.h | 3 ++- lib/librte_pdump/rte_pdump.c | 14 +- 6 files changed, 51 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 8e10a6fc3..822fa6d5a 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -4810,6 +4810,18 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp) timestamp)); } +int +rte_eth_convert_ts_to_ns(uint16_t port_id, uint64_t *timestamp) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->convert_ts_to_ns, -ENOTSUP); + return eth_err(port_id, (*dev->dev_ops->convert_ts_to_ns)(dev, timestamp)); +} + int rte_eth_read_clock(uint16_t port_id, uint64_t *clock) { diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index a49242bcd..2d4d0bc7d 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -4103,6 +4103,23 @@ int rte_eth_timesync_read_time(uint16_t port_id, struct timespec *time); */ int rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *time); +/** + * Convert a raw clock counter to nanoseconds from device clock + * + * @param port_id + * The port identifier of the Ethernet device. + * @param[in&out] timestamp + * Pointer to the timestamp to be converted. + * + * @return + * - 0: Success. + * - -ENODEV: The port ID is invalid. + * - -ENOTSUP: The function is not supported by the Ethernet driver. + */ +__rte_experimental +int +rte_eth_convert_ts_to_ns(uint16_t port_id, uint64_t *timestamp); + /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 32407dd41..255b41b67 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -464,6 +464,10 @@ typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev, const struct timespec *timestamp); /**< @internal Function used to get time from the device clock */ +typedef int (*eth_convert_ts_to_ns)(struct rte_eth_dev *dev, + uint64_t *timestamp); +/**< @internal Function used to convert timestamp from device clock */ + typedef int (*eth_read_clock)(struct rte_eth_dev *dev, uint64_t *timestamp); /**< @internal Function used to get the current value of the device clock. */ @@ -730,6 +734,7 @@ struct eth_dev_ops { eth_timesync_read_time timesync_read_time; /** Get the device clock time. */ eth_timesync_write_timetimesync_write_time; /** Set the device clock time. */ + eth_convert_ts_to_ns convert_ts_to_ns; eth_read_clock read_clock; eth_xstats_get_by_id_t xstats_get_by_id; diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index 715505604..754c05630 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -241,4 +241,6 @@ EXPERIMENTAL { __rte_ethdev_trace_rx_burst; __rte_ethdev_trace_tx_burst; rte_flow_get_aged_flows; + + rte_eth_convert_ts_to_ns; }; diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h index b9a59c879..7f51f9157 100644 --- a/lib/librte_mbuf/rte_mbuf_core.h +++ b/lib/librte_mbuf/rte_mbuf_core.h @@ -592,7 +592,8 @@ struct rte_mbuf { /** Valid if PKT_RX_TIMESTAMP is set. The unit and time reference * are not normalized but are always the same for a given port. * Some devices allow to query rte_eth_read_clock that will return the -* current device timestamp. +* current device timestamp or rte_eth_ts_to_ns that will convert raw +* counter to nanoseconds. */ uint64_t timestamp; diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index f96709f95..03d9ba484 100644 --- a/lib/librte_pdump/rte_pdump.c +++ b/lib/librte_pdump/rte_pdump.c @@ -100,12 +100,24 @@ pdump_copy(struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params) } } +static inline vo
[dpdk-dev] [RFC][PATCH v2 3/3] net/pcap: dump hardware timestamps
When hardware timestamping is activated, system time should no longer be used to timestamp dumped the packets. Instead, use value held by forwarded and assume they were converted to nanoseconds. Signed-off-by: Patrick Keroulas Signed-off-by: Vivien Didelot --- drivers/net/pcap/rte_eth_pcap.c | 35 ++--- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 13a3d0ac7..6a4ffae7b 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -45,6 +45,8 @@ #define RTE_PMD_PCAP_MAX_QUEUES 16 +#define NSEC_PER_SEC 10L + static char errbuf[PCAP_ERRBUF_SIZE]; static struct timeval start_time; static uint64_t start_cycles; @@ -287,22 +289,23 @@ eth_null_rx(void *queue __rte_unused, return 0; } -#define NSEC_PER_SEC 10L - static inline void -calculate_timestamp(struct timeval *ts) { - uint64_t cycles; - struct timeval cur_time; - - cycles = rte_get_timer_cycles() - start_cycles; - cur_time.tv_sec = cycles / hz; - cur_time.tv_usec = (cycles % hz) * NSEC_PER_SEC / hz; - - ts->tv_sec = start_time.tv_sec + cur_time.tv_sec; - ts->tv_usec = start_time.tv_usec + cur_time.tv_usec; - if (ts->tv_usec >= NSEC_PER_SEC) { - ts->tv_usec -= NSEC_PER_SEC; - ts->tv_sec += 1; +calculate_timestamp(const struct rte_mbuf *mbuf, struct timeval *ts) { + if (mbuf->ol_flags & PKT_RX_TIMESTAMP) { + /* timestamp unit is nanoseconds but must fit in timeval */ + ts->tv_sec = mbuf->timestamp / NSEC_PER_SEC; + ts->tv_usec = mbuf->timestamp % NSEC_PER_SEC; + } else { + uint64_t cycles = rte_get_timer_cycles() - start_cycles; + struct timeval cur_time; + cur_time.tv_sec = cycles / hz; + cur_time.tv_usec = (cycles % hz) * NSEC_PER_SEC / hz; + ts->tv_sec = start_time.tv_sec + cur_time.tv_sec; + ts->tv_usec = start_time.tv_usec + cur_time.tv_usec; + if (ts->tv_usec > NSEC_PER_SEC) { + ts->tv_usec -= NSEC_PER_SEC; + ts->tv_sec += 1; + } } } @@ -339,7 +342,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) caplen = sizeof(temp_data); } - calculate_timestamp(&header.ts); + calculate_timestamp(mbuf, &header.ts); header.len = len; header.caplen = caplen; /* rte_pktmbuf_read() returns a pointer to the data directly -- 2.17.1
[dpdk-dev] [RFC][PATCH v2 0/3] pdump HW timestamps for mlx5
The intention is to produce a pcap with nanosecond precision when timestamp offloading is activated on mlx5 NIC. The packets forwarded by testpmd hold the raw counter but a pcap requires a time unit. Assuming that the NIC clock is already synced with external master clock, this patchset simply integrates the nanosecond converter that is already implemented by ibverbs. RFC: The conversion is performed in Rx callback, in primary process because the required clock info carried by ibv_context is not shared with secundary process (pdump). Thus mbuf->timestamp is the chosen candidate to convey the nanoseconds to pdump, since doc says: "unit and time reference are not normalized but are always the same for a given port" Patrick Keroulas (3): net/mlx5: add counter-to-ns converter from libibverbs ethdev: add API to convert raw timestamps to nsec net/pcap: dump hardware timestamps drivers/common/mlx5/linux/mlx5_glue.c| 16 +++ drivers/common/mlx5/linux/mlx5_glue.h| 4 +++ drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_ethdev.c | 30 drivers/net/pcap/rte_eth_pcap.c | 35 +--- lib/librte_ethdev/rte_ethdev.c | 12 lib/librte_ethdev/rte_ethdev.h | 17 lib/librte_ethdev/rte_ethdev_core.h | 5 lib/librte_ethdev/rte_ethdev_version.map | 2 ++ lib/librte_mbuf/rte_mbuf_core.h | 3 +- lib/librte_pdump/rte_pdump.c | 14 +- 12 files changed, 122 insertions(+), 18 deletions(-) -- 2.17.1
[dpdk-dev] [PATCH v3] mbuf: fix out-of-bounds access at dyn field register
We should make sure off + size < sizeof(struct rte_mbuf) to avoid possible out-of-bounds access of free_space array, there is no issue currently due to the low bits of free_flags (which is adjacent to free_space) are always set to 0. But we shouldn't rely on it since it's fragile and layout of struct mbuf_dyn_shm may be changed in the future. This patch adds boundary check explicitly to avoid potential risk of out-of-bounds access. Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") Cc: sta...@dpdk.org Signed-off-by: Xiaolong Ye --- V3: update subject as Olivier suggested lib/librte_mbuf/rte_mbuf_dyn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c index d6931f847..9d6388cff 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.c +++ b/lib/librte_mbuf/rte_mbuf_dyn.c @@ -71,7 +71,8 @@ process_score(void) for (off = 0; off < sizeof(struct rte_mbuf); off++) { /* get the size of the free zone */ - for (size = 0; shm->free_space[off + size]; size++) + for (size = 0; (off + size) < sizeof(struct rte_mbuf) && +shm->free_space[off + size]; size++) ; if (size == 0) continue; -- 2.17.1
Re: [dpdk-dev] [PATCH v1 1/2] eal/x86: add WC store function
On Thu, Jun 11, 2020 at 7:26 PM Nicolau, Radu wrote: > > > On 6/11/2020 1:23 PM, Jerin Jacob wrote: > > On Thu, Jun 11, 2020 at 3:41 PM Radu Nicolau wrote: > >> Add rte_write32_wc function that implements a WC store > >> using movdiri instruction. > >> > >> Signed-off-by: Radu Nicolau > >> --- > >> lib/librte_eal/x86/include/rte_io.h | 20 > >> 1 file changed, 20 insertions(+) > >> > >> diff --git a/lib/librte_eal/x86/include/rte_io.h > >> b/lib/librte_eal/x86/include/rte_io.h > >> index 2db71b1..3d74bec 100644 > >> --- a/lib/librte_eal/x86/include/rte_io.h > >> +++ b/lib/librte_eal/x86/include/rte_io.h > >> @@ -11,6 +11,26 @@ extern "C" { > >> > >> #include "generic/rte_io.h" > >> > >> +/** > >> + * Write a 32-bit value to I/O device memory address *addr*. > >> + * Uses MOVDIRI instruction to perform a direct-store operation using WC > >> + * memory write protocol. > > It will be an x86 specific API, Please change the API name to reflect that. > > > You mean something like rte_x86_write32_wc? Yes. Something like that...
[dpdk-dev] [PATCH] vhost: fix host notifier configuration error flow
A vDPA driver can configure its device FD to be notified directly by the guest memory mapping using `rte_vhost_host_notifier_ctrl` API. The driver request is managed by the dpdk vhost management and is forwarded to the QEMU, the vhost massage includes reply request in order to be sure that the memory mapping was done correctly by the QEMU. When QEMU finishes the configuration, it marks that its replay is valid in the slave FD using VHOST_USER_REPLY_MASK flag. The flag is set only in success and when the slave FD includes the reply data. The vhost library didn't validate the above flag before accessing to the slave FD, it leaded to the thread to be blocked on recvmsg call forever in case the QEMU has some problems in the notifier configuration. Handle VHOST_USER_REPLY_MASK flag to validate that slave FD includes a reply data. Fixes: d90cf7d111ac ("vhost: support host notifier") Cc: sta...@dpdk.org Signed-off-by: Matan Azrad --- lib/librte_vhost/vhost_user.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 84bebad..aa19d15 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -2833,8 +2833,14 @@ static int process_slave_message_reply(struct virtio_net *dev, struct VhostUserMsg msg_reply; int ret; - if ((msg->flags & VHOST_USER_NEED_REPLY) == 0) - return 0; + if (!(msg->flags & VHOST_USER_REPLY_MASK)) { + if (msg->flags & VHOST_USER_NEED_REPLY) { + ret = -1; + goto out; + } else { + return 0; + } + } ret = read_vhost_message(dev->slave_req_fd, &msg_reply); if (ret <= 0) { -- 1.8.3.1
Re: [dpdk-dev] [PATCH v3 2/2] build: treat warning as an error on Windows
29/05/2020 01:14, Pallavi Kadam: > Added -Werror in meson file to consider all the warnings > as errors on Windows. > > Signed-off-by: Pallavi Kadam > Reviewed-by: Ranjit Menon > --- > --- a/config/meson.build > +++ b/config/meson.build > +# add -Werror to treat warnings as errors on Windows > +if is_windows > + warning_flags += '-Werror' > +endif This should be not needed. When configuring meson in a CI, we are supposed to use --werror as it is done in devtools/test-meson-builds.sh.
Re: [dpdk-dev] [PATCH v3 1/2] eal: fix warnings on Windows
29/05/2020 01:14, Pallavi Kadam: > Fixed bunch of warnings when compiling using clang on Windows > such as the use of an unsafe string function (strerror), > [-Wunused-variable], [-Wunused-function] in eal_common_options.c > [-Wunused-const-variable] in getopt.c and [-Wunused-parameter] > in eal_common_thread.c. > Also fixed warnings generated using Mingw: > [-Werror=old-style-definition], [-Werror=cast-function-type] and > [-Werror=attributes] > > Signed-off-by: Ranjit Menon > Signed-off-by: Pallavi Kadam > Tested-by: Pallavi Kadam Tested-by is useless if you are the author of the patch. > lib/librte_eal/common/eal_common_options.c | 8 +++- > lib/librte_eal/windows/eal.c | 2 +- > lib/librte_eal/windows/eal_lcore.c | 2 +- > lib/librte_eal/windows/eal_thread.c| 3 ++- > lib/librte_eal/windows/getopt.c| 4 ++-- > lib/librte_eal/windows/include/pthread.h | 6 -- > 6 files changed, 17 insertions(+), 8 deletions(-) There were some changes since v2 which were not reviewed. Someone please?
Re: [dpdk-dev] [PATCH v8 02/11] eal: introduce internal wrappers for file operations
10/06/2020 16:27, Dmitry Kozlyuk: > Introduce OS-independent wrappers in order to support common EAL code > on Unix and Windows: > > * eal_file_open: open or create a file. > * eal_file_lock: lock or unlock an open file. > * eal_file_truncate: enforce a given size for an open file. > > Implementation for Linux and FreeBSD is placed in "unix" subdirectory, > which is intended for common code between the two. These thin wrappers > require no special maintenance. [...] > --- a/MAINTAINERS > +++ b/MAINTAINERS > +Unix shared files > +F: lib/librte_eal/unix/ Can be moved in "EAL API and common code".
Re: [dpdk-dev] [PATCH v8 00/11] Windows basic memory management
10/06/2020 16:27, Dmitry Kozlyuk: > This patchset implements basic MM with the following features: There are some compilation issues on FreeBSD and 32-bit Linux: http://mails.dpdk.org/archives/test-report/2020-June/135764.html
[dpdk-dev] [PATCH] net/mlx5: do not select legacy MPW implicitly
The Legacy MPW (multi-packet write) should not be engaged implicitly. We should exclude this function form a Tx burst routine selection process unless it is requested specifically by setting the txq_mpw_en devarg. Exclude this function from the selection process the same way it is done for the Enhanced MPW in the mlx5_select_tx_function() routine. Fixes: eb8121ab9dac ("net/mlx5: introduce Tx burst routine template") Cc: sta...@dpdk.org Signed-off-by: Alexander Kozyrev --- drivers/net/mlx5/mlx5_rxtx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 6a17a9a..df58af5 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -5542,6 +5542,9 @@ enum mlx5_txcmp_code { /* Does not meet requested offloads at all. */ continue; } + if ((olx ^ tmp) & MLX5_TXOFF_CONFIG_MPW) + /* Do not enable legacy MPW if not configured. */ + continue; if ((olx ^ tmp) & MLX5_TXOFF_CONFIG_EMPW) /* Do not enable eMPW if not configured. */ continue; -- 1.8.3.1
[dpdk-dev] [PATCH] net/mlx5: fix Rx/Tx descriptors number adjustment
The number of descriptors to configure in a Rx/Tx queue is passed to the mlx5_tx/rx_queue_pre_setup() function by value. That means any adjustments of this variable are local and cannot affect the actual value that is used to allocate mbufs in the mlx5_txq/rxq_new() functions. Pass the number as a reference to actually update it. Fixes: 6218063b ("net/mlx5: refactor Rx data path") Fixes: 1d88ba17 ("net/mlx5: refactor Tx data path") Cc: sta...@dpdk.org Signed-off-by: Alexander Kozyrev Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 14 +++--- drivers/net/mlx5/mlx5_txq.c | 22 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 78046fd..dda0073 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -453,19 +453,19 @@ * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_rx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc) +mlx5_rx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc) { struct mlx5_priv *priv = dev->data->dev_private; - if (!rte_is_power_of_2(desc)) { - desc = 1 << log2above(desc); + if (!rte_is_power_of_2(*desc)) { + *desc = 1 << log2above(*desc); DRV_LOG(WARNING, "port %u increased number of descriptors in Rx queue %u" " to the next power of two (%d)", - dev->data->port_id, idx, desc); + dev->data->port_id, idx, *desc); } DRV_LOG(DEBUG, "port %u configuring Rx queue %u for %u descriptors", - dev->data->port_id, idx, desc); + dev->data->port_id, idx, *desc); if (idx >= priv->rxqs_n) { DRV_LOG(ERR, "port %u Rx queue index out of range (%u >= %u)", dev->data->port_id, idx, priv->rxqs_n); @@ -511,7 +511,7 @@ container_of(rxq, struct mlx5_rxq_ctrl, rxq); int res; - res = mlx5_rx_queue_pre_setup(dev, idx, desc); + res = mlx5_rx_queue_pre_setup(dev, idx, &desc); if (res) return res; rxq_ctrl = mlx5_rxq_new(dev, idx, desc, socket, conf, mp); @@ -552,7 +552,7 @@ container_of(rxq, struct mlx5_rxq_ctrl, rxq); int res; - res = mlx5_rx_queue_pre_setup(dev, idx, desc); + res = mlx5_rx_queue_pre_setup(dev, idx, &desc); if (res) return res; if (hairpin_conf->peer_count != 1 || diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index f7b548f..90f3296 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -150,27 +150,27 @@ * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_tx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc) +mlx5_tx_queue_pre_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t *desc) { struct mlx5_priv *priv = dev->data->dev_private; - if (desc <= MLX5_TX_COMP_THRESH) { + if (*desc <= MLX5_TX_COMP_THRESH) { DRV_LOG(WARNING, "port %u number of descriptors requested for Tx queue" " %u must be higher than MLX5_TX_COMP_THRESH, using %u" - " instead of %u", - dev->data->port_id, idx, MLX5_TX_COMP_THRESH + 1, desc); - desc = MLX5_TX_COMP_THRESH + 1; + " instead of %u", dev->data->port_id, idx, + MLX5_TX_COMP_THRESH + 1, *desc); + *desc = MLX5_TX_COMP_THRESH + 1; } - if (!rte_is_power_of_2(desc)) { - desc = 1 << log2above(desc); + if (!rte_is_power_of_2(*desc)) { + *desc = 1 << log2above(*desc); DRV_LOG(WARNING, "port %u increased number of descriptors in Tx queue" " %u to the next power of two (%d)", - dev->data->port_id, idx, desc); + dev->data->port_id, idx, *desc); } DRV_LOG(DEBUG, "port %u configuring queue %u for %u descriptors", - dev->data->port_id, idx, desc); + dev->data->port_id, idx, *desc); if (idx >= priv->txqs_n) { DRV_LOG(ERR, "port %u Tx queue index out of range (%u >= %u)", dev->data->port_id, idx, priv->txqs_n); @@ -213,7 +213,7 @@ container_of(txq, struct mlx5_txq_ctrl, txq); int res; - res = mlx5_tx_queue_pre_setup(dev, idx, desc); + res = mlx5_tx_queue_pre_setup(dev, idx, &desc); if (res) return res; txq_ctrl = mlx5_txq_new(dev, idx, desc, socket, conf); @@ -254,7 +254,7 @@ container_of(txq, struct mlx5_txq_ctrl, txq); int res
Re: [dpdk-dev] [PATCH v2 10/52] net/ice/base: fix variable type for ACL
On 6/9/2020 12:59 PM, Qi Zhang wrote: > The commit ef92cee94cdb ("ice-shared: Fix remaining minor casting > issues") changed the idx variable within ice_acl_add_entry() from > a u16 to a u8. Where is this commit, I guess it is not in the DPDK repo, and the DPDK repo one is already listed in the 'Fixes' line, is there a benefit to have it, what do you think to remove this reference? > This causes the code to truncate the values greater > than 255 to 255 or less when calling ice_aq_program_acl_entry() > resulting in the wrong TCAM index being programmed for the specified > rule. The result is that the rule action doesn't work correctly > (packets don't get routed to the correct queue or dropped if that > is the action). Fix the issue by changing the variable to be a u16 > again. > > Fixes: f3202a097f12 ("net/ice/base: add ACL module") > Cc: sta...@dpdk.org > > Signed-off-by: Paul M Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 29/52] net/ice/base: remove unnecessary code
On 6/9/2020 12:59 PM, Qi Zhang wrote: > Remove unncessary case branch. 's/unncessary/unnecessary/' 'ICE_BLK_SW' & 'ICE_BLK_PE' cases seems removed, is there any context for record why they are unnecessary, can you please add to the commit log? > > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 15/52] net/ice/base: group function protoypes together
On 6/9/2020 12:59 PM, Qi Zhang wrote: In patch title, 's/protoypes/prototypes/' > There are some function prototypes at the beginning of the file and > some at the end, group them all together so that they are in one > consistent location. > > Signed-off-by: Tony Nguyen > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 43/52] net/ice/base: adjust scheduler default BW weight
On 6/9/2020 12:59 PM, Qi Zhang wrote: > By default the queues are configured in legacy mode. The default > BW settings for legacy/advanced modes are different. BW == Bandwidth? > The existing > code was using the advanced mode default value of 1 which was > incorrect. This caused the unbalanced BW sharing among siblings. > The recommneded default value is applied. 's/recommneded/recommended/' > > Signed-off-by: Tarun Singh > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 48/52] net/ice/base: add more tunnel type for IPv4 and IPv6
On 6/9/2020 12:59 PM, Qi Zhang wrote: > This patch add more tunnel type defination ipv4/ipv6 packet, 's/defination/definition/' > it enable tcp/udp layer of ipv4/ipv6 as L4 payload but without > L4 dst/src port number as input set for switch filter rule. > > For example: > we can download a switch rule to direct ipv4 packet with specific > source and destination ip address to queue index 1. > "eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / udp / > end actions queue index 1 / end" > this type of rule will be matched with ipv4/udp file only. > > Signed-off-by: Wei Zhao > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 01/52] net/ice/base: add support for non-IP Layer2 protocol
On 6/9/2020 12:59 PM, Qi Zhang wrote: > FDIR can forward Ethernet packets with non-IP ethertype. In patch title, isn't "non-IP Layer2 protocol" confusing? Should it be "non-IP Layer 3 protocol"? But I think description in commit log is better, what do you think: "support flow director for non-IP packets" > > Signed-off-by: Yahui Cao > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 22/52] net/ice/base: increase timeout after PFR
On 6/9/2020 12:59 PM, Qi Zhang wrote: > To allow for resets during package download, increase the timeout period > after performing a PFR. The time waited is the global config lock > timeout plus the normal PFSWR timeout. Is PFR == PF Reset, right? And is this same as FLR? > > Signed-off-by: Dan Nowlin > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 28/52] net/ice/base: return correct error code
On 6/9/2020 12:59 PM, Qi Zhang wrote: > Return ICE_ERR_DOES_NOT_EXIST return code if admin command error code is > ICE_AQ_RC_ENOENT (not exist). ice_aq_sw_rules is used when switch > rule is getting added/deleted/updated. In case of delete/update > switch rule, admin command can return ICE_AQ_RC_ENOENT error code > if such rule does not exist, hence return ICE_ERR_DOES_NOT_EXIST error > code from ice_aq_sw_rule, so that caller of this fucnction can decide 's/fucnction/function/' > how to handle ICE_ERR_DOES_NOT_EXIST. > > Allow proper cleanup of internal data structures from ice_rem_adv_rule > function if ice_aq_sw_rules return error code ICE_ERR_DOES_NOT_EXIST > otherwise per recipe:rule list will never become empty. > > Signed-off-by: Kiran Patil > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 23/52] net/ice/base: remove unnecessary braces
On 6/9/2020 12:59 PM, Qi Zhang wrote: > This patch mainly does cleanups related to unnecessary braces. Personally I think better to keep the braces when the block is more than single line, otherwise you are mostly relying on indentation which is prone to error. If you have strong opinion/need to remove them that is OK but if this is optional my 5cents is to keep the braces. > > A few other minor fixes are included which include fixing a typo, > pulling up some lines, and fixing RCT. I can't find the typo fix and I can't find othe change (fixing RCT), are they still valid in this patch? > > Signed-off-by: Tony Nguyen > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 33/52] net/ice/base: add RL profile bit mask check
On 6/9/2020 12:59 PM, Qi Zhang wrote: > Mask bits before accessing the profile type field. RL profile == Rate Limiter profile? > > Signed-off-by: Tarun Singh > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
[dpdk-dev] [PATCH] eal/vfio: reduce severity of startup messages
The startup of VFIO is too noisy. Logging is expensive on some systems, and distracting to the user. It should not be logging at NOTICE level, reduce it to INFO level. It really should be DEBUG here but that would hide it by default. Signed-off-by: Stephen Hemminger --- lib/librte_eal/linux/eal_vfio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c index d26e1649a54e..cb869bfafaf0 100644 --- a/lib/librte_eal/linux/eal_vfio.c +++ b/lib/librte_eal/linux/eal_vfio.c @@ -891,7 +891,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, /* we have successfully initialized VFIO, notify user */ const struct vfio_iommu_type *t = default_vfio_cfg->vfio_iommu_type; - RTE_LOG(NOTICE, EAL, " using IOMMU type %d (%s)\n", + RTE_LOG(INFO, EAL, " using IOMMU type %d (%s)\n", t->type_id, t->name); } @@ -1069,7 +1069,7 @@ rte_vfio_enable(const char *modname) /* check if we have VFIO driver enabled */ if (default_vfio_cfg->vfio_container_fd != -1) { - RTE_LOG(NOTICE, EAL, "VFIO support initialized\n"); + RTE_LOG(INFO, EAL, "VFIO support initialized\n"); default_vfio_cfg->vfio_enabled = 1; } else { RTE_LOG(NOTICE, EAL, "VFIO support could not be initialized\n"); -- 2.26.2
Re: [dpdk-dev] [PATCH v2 35/52] net/ice/base: correct return value
On 6/9/2020 12:59 PM, Qi Zhang wrote: > Function ice_rem_adv_rule_id return incorrect error code (ICE_ERR_PARAM) > whereas it should have returned ICE_ERR_DOES_NOT_EXIST return code > if filter list is empty or unable to find "rule" in list Can you please add the "Fixes: " tag? And the patch title is too generic, can it be possible to add details fixing return value for which case? > > Signed-off-by: Kiran Patil > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v2 34/52] net/ice/base: update the vsi handle to remaining VSI
On 6/9/2020 12:59 PM, Qi Zhang wrote: > Needs to update the VSI handle to the last remaining VSI using the > rule for ICE_FWD_TO_VSI. Otherwise it may have error for deleting the > rule. The reason of the patch is not clear, it looks to "prevent an error for deleting the rule", but can you please give more detail? Why it cause the error, what rule are we talking about, when this happens, what happens if it gives error, why setting to the last remaining VSI helps? Thanks > > Signed-off-by: Haiyue Wang > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang > --- > drivers/net/ice/base/ice_switch.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ice/base/ice_switch.c > b/drivers/net/ice/base/ice_switch.c > index f379a5f5d..01dcace55 100644 > --- a/drivers/net/ice/base/ice_switch.c > +++ b/drivers/net/ice/base/ice_switch.c > @@ -7491,6 +7491,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 > vsi_handle, > ice_get_hw_vsi_num(hw, rem_vsi_handle); > fm_list->rule_info.sw_act.fwd_id.hw_vsi_id = > ice_get_hw_vsi_num(hw, rem_vsi_handle); > + fm_list->rule_info.sw_act.vsi_handle = rem_vsi_handle; > > /* Update the previous switch rule of "MAC forward to VSI" to >* "MAC fwd to VSI list" >
Re: [dpdk-dev] [PATCH v2 40/52] net/ice/base: add new API to check all autoneg enable bits
On 6/9/2020 12:59 PM, Qi Zhang wrote: > struct ice_aqc_get_phy_caps_data has multiple autoneg enable bits. > ice_is_phy_caps_an_enabled checks all bits and returns true if any > autoneg enable bits are set. We refer as API to the functions that are exposed to applications, what do you think about following: net/ice/base: support checking all autoneg enable bits > > Signed-off-by: Paul Greenwalt > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [dpdk-stable] [PATCH v2 49/52] net/ice/base: fix uninitialized flag
On 6/9/2020 12:59 PM, Qi Zhang wrote: > This patch add initialization for prof_res_bm_init flag > to zero in order that the possible resource for field vector > in the files can be initialized. I guess this is fixing initialization of _something_ (resource for field vector in package file?), and this is done by zeroing an uninitialized flag. Can you please update the patch title to document what is fixed (why change is done)? > > Fixes: 453d087ccaff ("net/ice/base: add common functions") > Cc: sta...@dpdk.org > > Signed-off-by: Wei Zhao > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang > --- > drivers/net/ice/base/ice_common.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ice/base/ice_common.c > b/drivers/net/ice/base/ice_common.c > index 54112e8f2..baaeee321 100644 > --- a/drivers/net/ice/base/ice_common.c > +++ b/drivers/net/ice/base/ice_common.c > @@ -536,6 +536,7 @@ enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw > *hw) > return ICE_ERR_NO_MEMORY; > > INIT_LIST_HEAD(&sw->vsi_list_map_head); > + sw->prof_res_bm_init = 0; > > status = ice_init_def_sw_recp(hw, &hw->switch_info->recp_list); > if (status) { >
Re: [dpdk-dev] [PATCH v4] devtools: add new SPDX license compliance checker
On Mon, 24 Feb 2020 13:01:30 -0800 Stephen Hemminger wrote: > Simple script to look for drivers and scripts that > are missing requires SPDX header. > > Update the contribution guidelines to indicate that SPDX license > identfier is required for this project. > > Signed-off-by: Stephen Hemminger > --- > v4 - add MAINTAINERS entry > update coding style document > change name of script > > MAINTAINERS | 1 + > devtools/check-spdx-tag.sh | 77 > doc/guides/contributing/coding_style.rst | 9 ++- > 3 files changed, 85 insertions(+), 2 deletions(-) > create mode 100755 devtools/check-spdx-tag.sh > Going through the patch backlog. Why is this not merged yet? Why is not in DPDK 20.05?
Re: [dpdk-dev] [PATCH v2 52/52] net/ice/base: update IPV4 and IPV6 flow ptype masks
On 6/9/2020 1:00 PM, Qi Zhang wrote: > In the flow API, add ability to add IPV4/IPV6 rules that match on > packets with or without inner L4 protocols. > > Also, remove PPPOD packet from PPPOE bitmap. I can't spot this change among other changes, if it is not directly related to the main feature, what do you think to separate it to its own patch? > > Signed-off-by: Dan Nowlin > Signed-off-by: Paul M. Stillwell Jr > Signed-off-by: Qi Zhang <...>
Re: [dpdk-dev] [PATCH v3 2/2] build: treat warning as an error on Windows
On 6/11/2020 9:12 AM, Thomas Monjalon wrote: 29/05/2020 01:14, Pallavi Kadam: Added -Werror in meson file to consider all the warnings as errors on Windows. Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon --- --- a/config/meson.build +++ b/config/meson.build +# add -Werror to treat warnings as errors on Windows +if is_windows + warning_flags += '-Werror' +endif This should be not needed. When configuring meson in a CI, we are supposed to use --werror as it is done in devtools/test-meson-builds.sh. Ok, will fix this in v4.
Re: [dpdk-dev] [PATCH v3 1/2] eal: fix warnings on Windows
On 6/11/2020 9:14 AM, Thomas Monjalon wrote: 29/05/2020 01:14, Pallavi Kadam: Fixed bunch of warnings when compiling using clang on Windows such as the use of an unsafe string function (strerror), [-Wunused-variable], [-Wunused-function] in eal_common_options.c [-Wunused-const-variable] in getopt.c and [-Wunused-parameter] in eal_common_thread.c. Also fixed warnings generated using Mingw: [-Werror=old-style-definition], [-Werror=cast-function-type] and [-Werror=attributes] Signed-off-by: Ranjit Menon Signed-off-by: Pallavi Kadam Tested-by: Pallavi Kadam Tested-by is useless if you are the author of the patch. Sorry for this, will remove the tag in v4. lib/librte_eal/common/eal_common_options.c | 8 +++- lib/librte_eal/windows/eal.c | 2 +- lib/librte_eal/windows/eal_lcore.c | 2 +- lib/librte_eal/windows/eal_thread.c| 3 ++- lib/librte_eal/windows/getopt.c| 4 ++-- lib/librte_eal/windows/include/pthread.h | 6 -- 6 files changed, 17 insertions(+), 8 deletions(-) There were some changes since v2 which were not reviewed. Someone please?
[dpdk-dev] [PATCH v4] eal: fix warnings on Windows
Fixed bunch of warnings when compiling using clang on Windows such as the use of an unsafe string function (strerror), [-Wunused-variable], [-Wunused-function] in eal_common_options.c [-Wunused-const-variable] in getopt.c and [-Wunused-parameter] in eal_common_thread.c. Also fixed warnings generated using Mingw: [-Werror=old-style-definition], [-Werror=cast-function-type] and [-Werror=attributes] v4 changes: Removed -Werror that was added on Windows in v3 Removed self 'Tested-by' line v3 changes: Fixed pthread warning Added -Werror on Windows Fixed MinGW warnings v2 changes: Excluded dirent.h file on Windows temporarily. (This file will stay on Windows for later use) Signed-off-by: Ranjit Menon Signed-off-by: Pallavi Kadam --- lib/librte_eal/common/eal_common_options.c | 8 +++- lib/librte_eal/windows/eal.c | 2 +- lib/librte_eal/windows/eal_lcore.c | 2 +- lib/librte_eal/windows/eal_thread.c| 3 ++- lib/librte_eal/windows/getopt.c| 4 ++-- lib/librte_eal/windows/include/pthread.h | 6 -- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 8f2cbd1c6..0546beb3a 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -18,7 +18,9 @@ #endif #include #include +#ifndef RTE_EXEC_ENV_WINDOWS #include +#endif #include #include @@ -115,8 +117,10 @@ struct shared_driver { static struct shared_driver_list solib_list = TAILQ_HEAD_INITIALIZER(solib_list); +#ifndef RTE_EXEC_ENV_WINDOWS /* Default path of external loadable drivers */ static const char *default_solib_dir = RTE_EAL_PMD_PATH; +#endif /* * Stringified version of solib path used by dpdk-pmdinfo.py @@ -329,6 +333,7 @@ eal_plugin_add(const char *path) return 0; } +#ifndef RTE_EXEC_ENV_WINDOWS static int eal_plugindir_init(const char *path) { @@ -362,6 +367,7 @@ eal_plugindir_init(const char *path) /* XXX this ignores failures from readdir() itself */ return (dent == NULL) ? 0 : -1; } +#endif int eal_plugins_init(void) @@ -394,8 +400,8 @@ eal_plugins_init(void) } } - return 0; #endif + return 0; } /* diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c index d084606a6..a34e519ea 100644 --- a/lib/librte_eal/windows/eal.c +++ b/lib/librte_eal/windows/eal.c @@ -139,7 +139,7 @@ eal_log_level_parse(int argc, char **argv) } /* Parse the argument given in the command line of the application */ -__attribute__((optnone)) static int +static int eal_parse_args(int argc, char **argv) { int opt, ret; diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c index 82ee45413..b36f0a83b 100644 --- a/lib/librte_eal/windows/eal_lcore.c +++ b/lib/librte_eal/windows/eal_lcore.c @@ -27,7 +27,7 @@ static struct _wcpu_map { * Create a map of all processors and associated cores on the system */ void -eal_create_cpu_map() +eal_create_cpu_map(void) { wcpu_map.total_procs = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS); diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c index 4c1e31c58..3dd56519c 100644 --- a/lib/librte_eal/windows/eal_thread.c +++ b/lib/librte_eal/windows/eal_thread.c @@ -140,7 +140,8 @@ eal_thread_create(pthread_t *thread) { HANDLE th; - th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eal_thread_loop, + th = CreateThread(NULL, 0, + (LPTHREAD_START_ROUTINE)(ULONG_PTR)eal_thread_loop, NULL, 0, (LPDWORD)thread); if (!th) return -1; diff --git a/lib/librte_eal/windows/getopt.c b/lib/librte_eal/windows/getopt.c index 170c9b5e0..a08f7c109 100644 --- a/lib/librte_eal/windows/getopt.c +++ b/lib/librte_eal/windows/getopt.c @@ -25,8 +25,8 @@ int opterr = 1; /* if error message should be printed */ intoptind = 1; /* index into parent argv vector */ intoptopt = '?'; /* character checked for validity */ -static void pass(void) {} -#define warnx(a, ...) pass() +static void pass(const char *a) {(void) a; } +#define warnx(a, ...) pass(a) #define PRINT_ERROR((opterr) && (*options != ':')) diff --git a/lib/librte_eal/windows/include/pthread.h b/lib/librte_eal/windows/include/pthread.h index 0bbed5c3b..e2274cf4e 100644 --- a/lib/librte_eal/windows/include/pthread.h +++ b/lib/librte_eal/windows/include/pthread.h @@ -45,7 +45,7 @@ typedef SYNCHRONIZATION_BARRIER pthread_barrier_t; #define pthread_getaffinity_np(thread, size, cpuset) \ eal_get_thread_affinity_mask(thread, (unsigned long *) cpuset) #define pthread_create(threadid, threadattr, threadfunc, args) \ - eal_create_thread(threadid, threadfunc, args) +
Re: [dpdk-dev] [PATCH v4] eal: fix warnings on Windows
On Thu, Jun 11, 2020 at 12:50:55PM -0700, Pallavi Kadam wrote: > Fixed bunch of warnings when compiling using clang on Windows > such as the use of an unsafe string function (strerror), > [-Wunused-variable], [-Wunused-function] in eal_common_options.c > [-Wunused-const-variable] in getopt.c and [-Wunused-parameter] > in eal_common_thread.c. > Also fixed warnings generated using Mingw: > [-Werror=old-style-definition], [-Werror=cast-function-type] and > [-Werror=attributes] > > v4 changes: > Removed -Werror that was added on Windows in v3 > Removed self 'Tested-by' line > > v3 changes: > Fixed pthread warning > Added -Werror on Windows > Fixed MinGW warnings > > v2 changes: > Excluded dirent.h file on Windows temporarily. > (This file will stay on Windows for later use) > > Signed-off-by: Ranjit Menon > Signed-off-by: Pallavi Kadam > --- Tested with clang, no warnings generated. Tested-by: Narcisa Vasile Acked-by: Narcisa Vasile
Re: [dpdk-dev] [PATCH v4] devtools: add new SPDX license compliance checker
11/06/2020 20:46, Stephen Hemminger: > On Mon, 24 Feb 2020 13:01:30 -0800 > Stephen Hemminger wrote: > > > Simple script to look for drivers and scripts that > > are missing requires SPDX header. > > > > Update the contribution guidelines to indicate that SPDX license > > identfier is required for this project. > > > > Signed-off-by: Stephen Hemminger > > Going through the patch backlog. > > Why is this not merged yet? > Why is not in DPDK 20.05? I would like to see some reviews on such patch which looks like a policy.
[dpdk-dev] [PATCH 02/14] bus/fslmc: fix null pointer dereference
This patches fixes a null pointer derefencing that happens when the device string passed to the iterator is NULL. This situation can happen when iterating on a class type. For example: RTE_DEV_FOREACH(dev, "class=eth", &dev_iter) { ... } Fixes: e67a61614d0b ("bus/fslmc: support device iteration") Cc: sta...@dpdk.org Cc: shreyansh.j...@nxp.com Signed-off-by: Maxime Coquelin --- drivers/bus/fslmc/fslmc_bus.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index afbd82e8db..75c15d6b67 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -603,6 +603,11 @@ fslmc_bus_dev_iterate(const void *start, const char *str, struct rte_dpaa2_device *dev; char *dup, *dev_name = NULL; + if (str == NULL) { + DPAA2_BUS_DEBUG("No device string\n"); + return NULL; + } + /* Expectation is that device would be name=device_name */ if (strncmp(str, "name=", 5) != 0) { DPAA2_BUS_DEBUG("Invalid device string (%s)\n", str); -- 2.26.2
[dpdk-dev] [PATCH 01/14] bus/dpaa: fix null pointer dereference
This patches fixes a null pointer derefencing that happens when the device string passed to the iterator is NULL. This situation can happen when iterating on a class type. For example: RTE_DEV_FOREACH(dev, "class=eth", &dev_iter) { ... } Fixes: e79df833d3f6 ("bus/dpaa: support hotplug ops") Cc: sta...@dpdk.org Cc: shreyansh.j...@nxp.com Signed-off-by: Maxime Coquelin --- drivers/bus/dpaa/dpaa_bus.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index d53fe6083a..216f38acd4 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -703,6 +703,11 @@ dpaa_bus_dev_iterate(const void *start, const char *str, struct rte_dpaa_device *dev; char *dup, *dev_name = NULL; + if (str == NULL) { + DPAA_BUS_DEBUG("No device string\n"); + return NULL; + } + /* Expectation is that device would be name=device_name */ if (strncmp(str, "name=", 5) != 0) { DPAA_BUS_DEBUG("Invalid device string (%s)\n", str); -- 2.26.2