Re: [PATCH] eventdev/timer: add API to get remaining ticks
On 2022-12-16 22:56, Erik Gabriel Carrillo wrote: Introduce an event timer adapter API which allows users to determine how many adapter ticks remain until an event timer fires. Signed-off-by: Erik Gabriel Carrillo --- app/test/test_event_timer_adapter.c| 68 ++ lib/eventdev/event_timer_adapter_pmd.h | 7 +++ lib/eventdev/rte_event_timer_adapter.c | 52 lib/eventdev/rte_event_timer_adapter.h | 27 ++ lib/eventdev/version.map | 3 ++ 5 files changed, 157 insertions(+) diff --git a/app/test/test_event_timer_adapter.c b/app/test/test_event_timer_adapter.c index 1a440dfd10..6529b14ff9 100644 --- a/app/test/test_event_timer_adapter.c +++ b/app/test/test_event_timer_adapter.c @@ -1920,6 +1920,72 @@ adapter_create_max(void) return TEST_SUCCESS; } +static inline int +test_timer_ticks_remaining(void) +{ + uint64_t ticks_remaining = UINT64_MAX; + struct rte_event_timer *ev_tim; + struct rte_event ev; + int ret, i; + const struct rte_event_timer tim = { + .ev.op = RTE_EVENT_OP_NEW, + .ev.queue_id = 0, + .ev.sched_type = RTE_SCHED_TYPE_ATOMIC, + .ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL, + .ev.event_type = RTE_EVENT_TYPE_TIMER, + .state = RTE_EVENT_TIMER_NOT_ARMED, + }; + + rte_mempool_get(eventdev_test_mempool, (void **)&ev_tim); + *ev_tim = tim; + ev_tim->ev.event_ptr = ev_tim; +#define TEST_TICKS 5 + ev_tim->timeout_ticks = CALC_TICKS(TEST_TICKS); + + /* Test that unarmed timer returns error */ + TEST_ASSERT_FAIL(rte_event_timer_ticks_remaining_get(timdev, ev_tim, +&ticks_remaining), +"Didn't fail to get ticks for unarmed event timer"); + + TEST_ASSERT_EQUAL(rte_event_timer_arm_burst(timdev, &ev_tim, 1), 1, + "Failed to arm timer with proper timeout."); + TEST_ASSERT_EQUAL(ev_tim->state, RTE_EVENT_TIMER_ARMED, + "Improper timer state set expected %d returned %d", + RTE_EVENT_TIMER_ARMED, ev_tim->state); + + for (i = 0; i < TEST_TICKS; i++) { + ret = rte_event_timer_ticks_remaining_get(timdev, ev_tim, + &ticks_remaining); + if (ret < 0) + return TEST_FAILED; + + TEST_ASSERT_EQUAL((int)ticks_remaining, TEST_TICKS - i, + "Expected %d ticks remaining, got %"PRIu64"", + TEST_TICKS - i, ticks_remaining); + + rte_delay_ms(100); + } + + rte_delay_ms(100); + + TEST_ASSERT_EQUAL(rte_event_dequeue_burst(evdev, 0, &ev, 1, 0), 1, + "Armed timer failed to trigger."); + TEST_ASSERT_EQUAL(ev_tim->state, RTE_EVENT_TIMER_NOT_ARMED, + "Improper timer state set expected %d returned %d", + RTE_EVENT_TIMER_NOT_ARMED, ev_tim->state); + + /* Test that timer that fired returns error */ + TEST_ASSERT_FAIL(rte_event_timer_ticks_remaining_get(timdev, ev_tim, + &ticks_remaining), +"Didn't fail to get ticks for unarmed event timer"); + + rte_mempool_put(eventdev_test_mempool, (void *)ev_tim); + +#undef TEST_TICKS + return TEST_SUCCESS; +} + + static struct unit_test_suite event_timer_adptr_functional_testsuite = { .suite_name = "event timer functional test suite", .setup = testsuite_setup, @@ -1982,6 +2048,8 @@ static struct unit_test_suite event_timer_adptr_functional_testsuite = { TEST_CASE_ST(timdev_setup_msec, timdev_teardown, adapter_tick_resolution), TEST_CASE(adapter_create_max), + TEST_CASE_ST(timdev_setup_msec, timdev_teardown, + test_timer_ticks_remaining), TEST_CASES_END() /**< NULL terminate unit test array */ } }; diff --git a/lib/eventdev/event_timer_adapter_pmd.h b/lib/eventdev/event_timer_adapter_pmd.h index 189017b5c1..c19ff3576a 100644 --- a/lib/eventdev/event_timer_adapter_pmd.h +++ b/lib/eventdev/event_timer_adapter_pmd.h @@ -52,6 +52,11 @@ typedef int (*rte_event_timer_adapter_stats_get_t)( typedef int (*rte_event_timer_adapter_stats_reset_t)( const struct rte_event_timer_adapter *adapter); /**< @internal Reset statistics for event timer adapter */ +typedef int (*rte_event_timer_ticks_remaining_get_t)( + const struct rte_event_timer_adapter *adapter, + const struct rte_event_timer *evtim, + uint64_t *ticks_remaining); +/**< @internal Get remaining ticks for event timer */ /** * @intern
RE: [PATCH] net/ice: add devargs for disabling mac filter
> -Original Message- > From: Stephen Hemminger > Sent: Tuesday, December 13, 2022 11:51 AM > To: Zhang, Ke1X > Cc: Zhang, Qi Z ; Zhang, Yuying > ; dev@dpdk.org > Subject: Re: [PATCH] net/ice: add devargs for disabling mac filter > > On Fri, 25 Nov 2022 10:51:24 +0800 > Ke Zhang wrote: > > > diff --git a/drivers/net/ice/ice_ethdev.h > > b/drivers/net/ice/ice_ethdev.h index c8311be179..0350c6584a 100644 > > --- a/drivers/net/ice/ice_ethdev.h > > +++ b/drivers/net/ice/ice_ethdev.h > > @@ -563,6 +563,7 @@ struct ice_devargs { > > int safe_mode_support; > > uint8_t proto_xtr_dflt; > > int pipe_mode_support; > > + int mac_filter_disable; > > Why use 4 bytes for a flag when a single bit would do. After modifying the code like this: struct ice_devargs { int rx_low_latency : 1; int safe_mode_support : 1; int pipe_mode_support : 1; int mac_filter_disable : 1; I met a issue when compiling the code: ../drivers/net/ice/ice_ethdev.c:2076:19: error: cannot take address of bit-field 'safe_mode_support' 2076 | &parse_bool, &ad->devargs.safe_mode_support); | ^ ../drivers/net/ice/ice_ethdev.c:2081:19: error: cannot take address of bit-field 'pipe_mode_support' 2081 | &parse_bool, &ad->devargs.pipe_mode_support); | ^ ../drivers/net/ice/ice_ethdev.c:2086:18: error: cannot take address of bit-field 'mac_filter_disable' 2086 | &parse_bool, &ad->devargs.mac_filter_disable); | ^ ../drivers/net/ice/ice_ethdev.c:2101:19: error: cannot take address of bit-field 'rx_low_latency' 2101 | &parse_bool, &ad->devargs.rx_low_latency); It seems that bitfields members aren't addressable.
Re: [PATCH] net/ice: add devargs for disabling mac filter
On Sat, 17 Dec 2022 15:22:21 + "Zhang, Ke1X" wrote: > > -Original Message- > > From: Stephen Hemminger > > Sent: Tuesday, December 13, 2022 11:51 AM > > To: Zhang, Ke1X > > Cc: Zhang, Qi Z ; Zhang, Yuying > > ; dev@dpdk.org > > Subject: Re: [PATCH] net/ice: add devargs for disabling mac filter > > > > On Fri, 25 Nov 2022 10:51:24 +0800 > > Ke Zhang wrote: > > > > > diff --git a/drivers/net/ice/ice_ethdev.h > > > b/drivers/net/ice/ice_ethdev.h index c8311be179..0350c6584a 100644 > > > --- a/drivers/net/ice/ice_ethdev.h > > > +++ b/drivers/net/ice/ice_ethdev.h > > > @@ -563,6 +563,7 @@ struct ice_devargs { > > > int safe_mode_support; > > > uint8_t proto_xtr_dflt; > > > int pipe_mode_support; > > > + int mac_filter_disable; > > > > Why use 4 bytes for a flag when a single bit would do. > > After modifying the code like this: > struct ice_devargs { > int rx_low_latency : 1; > int safe_mode_support : 1; > int pipe_mode_support : 1; > int mac_filter_disable : 1; > > I met a issue when compiling the code: > ../drivers/net/ice/ice_ethdev.c:2076:19: error: cannot take address of > bit-field 'safe_mode_support' > 2076 | &parse_bool, &ad->devargs.safe_mode_support); > | ^ > ../drivers/net/ice/ice_ethdev.c:2081:19: error: cannot take address of > bit-field 'pipe_mode_support' > 2081 | &parse_bool, &ad->devargs.pipe_mode_support); > | ^ > ../drivers/net/ice/ice_ethdev.c:2086:18: error: cannot take address of > bit-field 'mac_filter_disable' > 2086 | &parse_bool, &ad->devargs.mac_filter_disable); > | ^ > ../drivers/net/ice/ice_ethdev.c:2101:19: error: cannot take address of > bit-field 'rx_low_latency' > 2101 | &parse_bool, &ad->devargs.rx_low_latency); > > It seems that bitfields members aren't addressable. > Would a uint8_t work? Also parse_bool might make assumptions about size.
[PATCH] lib/net: added push MPLS header API
Push MPLS header after ethernet header, updates ethernet type and MPLS bs bit if required. Signed-off-by: Tanzeel Ahmed --- .mailmap | 1 + lib/net/rte_mpls.h | 59 ++ 2 files changed, 60 insertions(+) diff --git a/.mailmap b/.mailmap index 75884b6..5e06669 100644 --- a/.mailmap +++ b/.mailmap @@ -1301,6 +1301,7 @@ Takeshi Yoshimura Takuya Asada Tal Avraham Tal Shnaiderman +Tanzeel Ahmed Tao Y Yang Tao Zhu Taripin Samuel diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h index 3e8cb90..6ae72df 100644 --- a/lib/net/rte_mpls.h +++ b/lib/net/rte_mpls.h @@ -13,6 +13,8 @@ #include #include +#include +#include #ifdef __cplusplus extern "C" { @@ -36,6 +38,63 @@ struct rte_mpls_hdr { uint8_t ttl; /**< Time to live. */ } __rte_packed; +#define RTE_MPLS_HLEN 4 /**< Length of MPLS header. */ + +/** + * Insert MPLS header into the packet. + * + * If it's first MPLS header to be inserted in the packet, + * - Updates the ether type. + * - Sets the MPLS bottom-of-stack bit to 1. + * + * @param m + * The pointer to the mbuf. + * @param mp + * The pointer to the MPLS header. + * @return + * 0 on success, -1 on error (If no ethernet header exists) + */ +static inline int +rte_mpls_push_over_l2(struct rte_mbuf **m, struct rte_mpls_hdr *mp) +{ + struct rte_ether_hdr *oh, *nh; + + /* Can't insert header if mbuf is shared */ + if (!RTE_MBUF_DIRECT(*m) || rte_mbuf_refcnt_read(*m) > 1) + return -EINVAL; + + /*Can't insert header if ethernet frame doesn't exist*/ + if (rte_pktmbuf_data_len(*m) < RTE_ETHER_HDR_LEN) + return -EINVAL; + + oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *); + nh = (struct rte_ether_hdr *)(void *) + rte_pktmbuf_prepend(*m, sizeof(struct rte_mpls_hdr)); + if (nh == NULL) + return -ENOSPC; + + memmove(nh, oh, RTE_ETHER_HDR_LEN); + + mp->tag_msb = rte_cpu_to_be_16(mp->tag_msb); + + /* If first MPLS header, update ether type and bottom-of-stack bit */ + if (nh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) + { + nh->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS); + mp->bs = 1; + } + else + { + mp->bs = 0; + } + + /* Copy the MPLS header after ethernet frame */ + rte_memcpy(rte_pktmbuf_mtod_offset(*m, char*, sizeof(struct rte_ether_hdr)), mp, RTE_MPLS_HLEN); + + (*m)->data_len += RTE_MPLS_HLEN; + return 0; +} + #ifdef __cplusplus } #endif -- 1.8.3.1
Re: [PATCH] lib/net: added push MPLS header API
On Sat, 17 Dec 2022 12:59:57 -0500 Tanzeel-inline wrote: > +/** > + * Insert MPLS header into the packet. > + * > + * If it's first MPLS header to be inserted in the packet, > + * - Updates the ether type. > + * - Sets the MPLS bottom-of-stack bit to 1. > + * > + * @param m > + * The pointer to the mbuf. > + * @param mp > + * The pointer to the MPLS header. > + * @return > + * 0 on success, -1 on error (If no ethernet header exists) > + */ Should be marked experimental. > +static inline int > +rte_mpls_push_over_l2(struct rte_mbuf **m, struct rte_mpls_hdr *mp) trailing blank? can mpls hdr be const? > +{ > + struct rte_ether_hdr *oh, *nh; > + > + /* Can't insert header if mbuf is shared */ > + if (!RTE_MBUF_DIRECT(*m) || rte_mbuf_refcnt_read(*m) > 1) > + return -EINVAL; > + > + /*Can't insert header if ethernet frame doesn't exist*/ add space after /* and before */ > + if (rte_pktmbuf_data_len(*m) < RTE_ETHER_HDR_LEN) > + return -EINVAL; > + > + oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *); > + nh = (struct rte_ether_hdr *)(void *) > + rte_pktmbuf_prepend(*m, sizeof(struct rte_mpls_hdr)); Not your problem, but having to double cast is only an artifact of the poor design choice in DPDK for the return type of rte_pkmtmbuf_prepend() > + if (nh == NULL) > + return -ENOSPC; > + > + memmove(nh, oh, RTE_ETHER_HDR_LEN); > + > + mp->tag_msb = rte_cpu_to_be_16(mp->tag_msb); > + > + /* If first MPLS header, update ether type and bottom-of-stack bit */ > + if (nh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) > + { DPDK like kernel uses bracket "cuddle" style. if (conditon { ... } else { } > + nh->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS); > + mp->bs = 1; > + } > + else > + { > + mp->bs = 0; > + } > + > + /* Copy the MPLS header after ethernet frame */ > + rte_memcpy(rte_pktmbuf_mtod_offset(*m, char*, sizeof(struct > rte_ether_hdr)), mp, RTE_MPLS_HLEN); rte_memcpy is not preferred for small values. Compiler can optimize memcpy() of small const sizes. Might even be better to use structure assignment? > + > + (*m)->data_len += RTE_MPLS_HLEN; > + return 0; > +} > + > #ifdef __cplusplus > } > #endif Side note: Why is DPDK version of checkpatch ignoring things that kernel checkpatch does not? $ ~/kernel/linux//scripts/checkpatch.pl /tmp/mpls.mbox WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #102: Push MPLS header after ethernet header, updates ethernet type and MPLS bs bit if required. ERROR: trailing whitespace #143: FILE: lib/net/rte_mpls.h:45: + * $ ERROR: trailing whitespace #147: FILE: lib/net/rte_mpls.h:49: + * $ ERROR: trailing whitespace #153: FILE: lib/net/rte_mpls.h:55: + * 0 on success, -1 on error (If no ethernet header exists)^I^I$ ERROR: trailing whitespace #156: FILE: lib/net/rte_mpls.h:58: +rte_mpls_push_over_l2(struct rte_mbuf **m, struct rte_mpls_hdr *mp) $ ERROR: trailing whitespace #177: FILE: lib/net/rte_mpls.h:79: +^I$ ERROR: that open brace { should be on the previous line #179: FILE: lib/net/rte_mpls.h:81: + if (nh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) + { ERROR: trailing whitespace #183: FILE: lib/net/rte_mpls.h:85: +^I}^I$ ERROR: that open brace { should be on the previous line #184: FILE: lib/net/rte_mpls.h:86: + else + { ERROR: else should follow close brace '}' #184: FILE: lib/net/rte_mpls.h:86: + } + else WARNING: line length of 104 exceeds 100 columns #190: FILE: lib/net/rte_mpls.h:92: + rte_memcpy(rte_pktmbuf_mtod_offset(*m, char*, sizeof(struct rte_ether_hdr)), mp, RTE_MPLS_HLEN); ERROR: trailing whitespace #191: FILE: lib/net/rte_mpls.h:93: +^I$ ERROR: Missing Signed-off-by: line by nominal patch author 'Tanzeel-inline ' total: 11 errors, 2 warnings, 78 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile /tmp/mpls.mbox has style problems, please review. Also, current DPDK checkpatch has issue with mailmap. This is not your problem. Looks like the change to check for mailmap has chicken/egg problem Tanzeel Ahmed is unknown, please fix the commit message or update .mailmap.
RE: [PATCH] eventdev/timer: add API to get remaining ticks
> -Original Message- > From: Mattias Rönnblom > Sent: Saturday, December 17, 2022 3:22 AM > To: Carrillo, Erik G ; jer...@marvell.com > Cc: Naga Harish K, S V ; Jayatheerthan, Jay > ; pbhagavat...@marvell.com; > sthot...@marvell.com; dev@dpdk.org > Subject: Re: [PATCH] eventdev/timer: add API to get remaining ticks > > On 2022-12-16 22:56, Erik Gabriel Carrillo wrote: > > Introduce an event timer adapter API which allows users to determine > > how many adapter ticks remain until an event timer fires. > > > > Signed-off-by: Erik Gabriel Carrillo > > --- > > app/test/test_event_timer_adapter.c| 68 > ++ > > lib/eventdev/event_timer_adapter_pmd.h | 7 +++ > > lib/eventdev/rte_event_timer_adapter.c | 52 > > lib/eventdev/rte_event_timer_adapter.h | 27 ++ > > lib/eventdev/version.map | 3 ++ > > 5 files changed, 157 insertions(+) > > > > diff --git a/app/test/test_event_timer_adapter.c > > b/app/test/test_event_timer_adapter.c > > index 1a440dfd10..6529b14ff9 100644 > > --- a/app/test/test_event_timer_adapter.c > > +++ b/app/test/test_event_timer_adapter.c > > @@ -1920,6 +1920,72 @@ adapter_create_max(void) > > return TEST_SUCCESS; > > } > > > > +static inline int > > +test_timer_ticks_remaining(void) > > +{ > > + uint64_t ticks_remaining = UINT64_MAX; > > + struct rte_event_timer *ev_tim; > > + struct rte_event ev; > > + int ret, i; > > + const struct rte_event_timer tim = { > > + .ev.op = RTE_EVENT_OP_NEW, > > + .ev.queue_id = 0, > > + .ev.sched_type = RTE_SCHED_TYPE_ATOMIC, > > + .ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL, > > + .ev.event_type = RTE_EVENT_TYPE_TIMER, > > + .state = RTE_EVENT_TIMER_NOT_ARMED, > > + }; > > + > > + rte_mempool_get(eventdev_test_mempool, (void **)&ev_tim); > > + *ev_tim = tim; > > + ev_tim->ev.event_ptr = ev_tim; > > +#define TEST_TICKS 5 > > + ev_tim->timeout_ticks = CALC_TICKS(TEST_TICKS); > > + > > + /* Test that unarmed timer returns error */ > > + TEST_ASSERT_FAIL(rte_event_timer_ticks_remaining_get(timdev, > ev_tim, > > +&ticks_remaining), > > +"Didn't fail to get ticks for unarmed event timer"); > > + > > + TEST_ASSERT_EQUAL(rte_event_timer_arm_burst(timdev, > &ev_tim, 1), 1, > > + "Failed to arm timer with proper timeout."); > > + TEST_ASSERT_EQUAL(ev_tim->state, RTE_EVENT_TIMER_ARMED, > > + "Improper timer state set expected %d returned > %d", > > + RTE_EVENT_TIMER_ARMED, ev_tim->state); > > + > > + for (i = 0; i < TEST_TICKS; i++) { > > + ret = rte_event_timer_ticks_remaining_get(timdev, ev_tim, > > + &ticks_remaining); > > + if (ret < 0) > > + return TEST_FAILED; > > + > > + TEST_ASSERT_EQUAL((int)ticks_remaining, TEST_TICKS - i, > > + "Expected %d ticks remaining, got > %"PRIu64"", > > + TEST_TICKS - i, ticks_remaining); > > + > > + rte_delay_ms(100); > > + } > > + > > + rte_delay_ms(100); > > + > > + TEST_ASSERT_EQUAL(rte_event_dequeue_burst(evdev, 0, &ev, 1, > 0), 1, > > + "Armed timer failed to trigger."); > > + TEST_ASSERT_EQUAL(ev_tim->state, > RTE_EVENT_TIMER_NOT_ARMED, > > + "Improper timer state set expected %d returned > %d", > > + RTE_EVENT_TIMER_NOT_ARMED, ev_tim->state); > > + > > + /* Test that timer that fired returns error */ > > + TEST_ASSERT_FAIL(rte_event_timer_ticks_remaining_get(timdev, > ev_tim, > > + &ticks_remaining), > > +"Didn't fail to get ticks for unarmed event timer"); > > + > > + rte_mempool_put(eventdev_test_mempool, (void *)ev_tim); > > + > > +#undef TEST_TICKS > > + return TEST_SUCCESS; > > +} > > + > > + > > static struct unit_test_suite event_timer_adptr_functional_testsuite = { > > .suite_name = "event timer functional test suite", > > .setup = testsuite_setup, > > @@ -1982,6 +2048,8 @@ static struct unit_test_suite > event_timer_adptr_functional_testsuite = { > > TEST_CASE_ST(timdev_setup_msec, timdev_teardown, > > adapter_tick_resolution), > > TEST_CASE(adapter_create_max), > > + TEST_CASE_ST(timdev_setup_msec, timdev_teardown, > > + test_timer_ticks_remaining), > > TEST_CASES_END() /**< NULL terminate unit test array */ > > } > > }; > > diff --git a/lib/eventdev/event_timer_adapter_pmd.h > > b/lib/eventdev/event_timer_adapter_pmd.h > > index 189017b5c1..c19ff3576a 100644 > > --- a/lib/eventdev/event_timer_adapter_pmd.h > > +++ b/lib/eventdev/event_timer_adapter_pmd.h > > @@ -52,6 +
[PATCH v2 2/2] lib/net: added push MPLS header API
The mpls hdr can't be const because the bs bit is updated by checking ether type. v2: * marked experimental * trailing blanks removed * space after /* and before */ * updated to bracket cuddle style * changed rte_memcpy to memcpy Signed-off-by: Tanzeel Ahmed --- lib/net/rte_mpls.h | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/net/rte_mpls.h b/lib/net/rte_mpls.h index 6ae72df..5248391 100644 --- a/lib/net/rte_mpls.h +++ b/lib/net/rte_mpls.h @@ -41,21 +41,25 @@ struct rte_mpls_hdr { #define RTE_MPLS_HLEN 4 /**< Length of MPLS header. */ /** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice. + * * Insert MPLS header into the packet. - * + * * If it's first MPLS header to be inserted in the packet, * - Updates the ether type. * - Sets the MPLS bottom-of-stack bit to 1. - * + * * @param m * The pointer to the mbuf. * @param mp * The pointer to the MPLS header. * @return - * 0 on success, -1 on error (If no ethernet header exists) + * 0 on success, -1 on error (If no ethernet header exists) */ +__rte_experimental static inline int -rte_mpls_push_over_l2(struct rte_mbuf **m, struct rte_mpls_hdr *mp) +rte_mpls_push_over_l2(struct rte_mbuf **m, struct rte_mpls_hdr *mp) { struct rte_ether_hdr *oh, *nh; @@ -63,7 +67,7 @@ struct rte_mpls_hdr { if (!RTE_MBUF_DIRECT(*m) || rte_mbuf_refcnt_read(*m) > 1) return -EINVAL; - /*Can't insert header if ethernet frame doesn't exist*/ + /* Can't insert header if ethernet frame doesn't exist */ if (rte_pktmbuf_data_len(*m) < RTE_ETHER_HDR_LEN) return -EINVAL; @@ -78,18 +82,16 @@ struct rte_mpls_hdr { mp->tag_msb = rte_cpu_to_be_16(mp->tag_msb); /* If first MPLS header, update ether type and bottom-of-stack bit */ - if (nh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) - { + if (nh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) { nh->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS); mp->bs = 1; - } - else - { + } else { mp->bs = 0; } /* Copy the MPLS header after ethernet frame */ - rte_memcpy(rte_pktmbuf_mtod_offset(*m, char*, sizeof(struct rte_ether_hdr)), mp, RTE_MPLS_HLEN); + memcpy(rte_pktmbuf_mtod_offset(*m, struct rte_mpls_hdr*, + sizeof(struct rte_ether_hdr)), mp, RTE_MPLS_HLEN); (*m)->data_len += RTE_MPLS_HLEN; return 0; -- 1.8.3.1
[Bug 1154] RTE flow: Getting a conflict error even though the rules doesn't have a conflict
https://bugs.dpdk.org/show_bug.cgi?id=1154 Bug ID: 1154 Summary: RTE flow: Getting a conflict error even though the rules doesn't have a conflict Product: DPDK Version: 22.07 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: other Assignee: dev@dpdk.org Reporter: ltham...@usc.edu Target Milestone: --- I am configuring below two flows on i40e through VPP and am seeing errors saying "Failed to create flow" and "i40e_flow_set_fdir_inset(): Conflict with the first rule's input set" although I don't see any conflict between the flows. Other combinations work good say if protocol is not 'any' (wildcard). Let me know if I am doing it wrong or if it's a bug. The 2 flows are: 1. type/pattern: src-ip 1.1.1.1 dst-ip 2.2.2.2 protocol any action: redirect-to-queue 0 2. type/pattern: src-ip 3.3.3.3 dst-ip 4.4.4.4 protocol icmp action: redirect-to-queue 1 Logs: DBGvpp# sh int Name IdxState MTU (L3/IP4/IP6/MPLS) Counter Count TenGigabitEthernetb5/0/3 1 up 9000/0/0/0 local00 down 0/0/0/0 DBGvpp# DBGvpp# DBGvpp# test flow add src-ip 1.1.1.1 dst-ip 2.2.2.2 proto any redirect-to-queue 0 flow 0 added DBGvpp# test flow add src-ip 3.3.3.3 dst-ip 4.4.4.4 proto icmp redirect-to-queue 1 flow 1 added DBGvpp# DBGvpp# sh flow entry flow-index 0 type ipv4 active 0 match: src_addr 1.1.1.1, dst_addr 2.2.2.2, protocol any action: redirect-to-queue redirect-to-queue 0 flow-index 1 type ipv4 active 0 match: src_addr 3.3.3.3, dst_addr 4.4.4.4, protocol ICMP action: redirect-to-queue redirect-to-queue 1 DBGvpp# DBGvpp# clear log DBGvpp# DBGvpp# test flow enable index 0 TenGigabitEthernetb5/0/3 DBGvpp# DBGvpp# show log DBGvpp# DBGvpp# show flow int TenGigabitEthernetb5/0/3 supported flow actions : count mark buffer-advance redirect-to-node redirect-to-queue rss drop last DPDK error type : 0 last DPDK error message : n/a DBGvpp# DBGvpp# test flow enable index 1 TenGigabitEthernetb5/0/3 test flow: flow error: "not supported" DBGvpp# DBGvpp# show flow int TenGigabitEthernetb5/0/3 supported flow actions : count mark buffer-advance redirect-to-node redirect-to-queue rss drop last DPDK error type : 2 last DPDK error message : Failed to create flow. DBGvpp# DBGvpp# show log 2022/12/17 23:13:47:439 notice dpdk i40e_flow_set_fdir_inset(): Conflict with the first rule's input set. DBGvpp# DBGvpp# Thanks, Nikhil -- You are receiving this mail because: You are the assignee for the bug.