net/mlx5/hws: fix return value of send queue action
PATCH 1/1 net/mlx5/hws: fix return value of send queue action
The rte_errno should be set to a positive error value while the ret of the function should return a negative value this aligns code to other mlx5dr API functions.
--- drivers/net/mlx5/hws/mlx5dr_send.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/hws/mlx5dr_send.c +2 -2
@@ -1007,8 +1007,8 @@ int mlx5dr_send_queue_action(struct mlx5dr_context *ctx,break ;default : - rte_errno = -EINVAL ; -return rte_errno; + rte_errno =EINVAL ; +return -rte_errno; }return 0 ;
Signature · 1 line
2.18.1
PATCH 1/1 net/mlx5/hws: fix send sync drain empty queue check
The function that checks if the queue is empty used on queue action for SYNC and ASYNC drain didn't function correctly since cur_post is a free running value and not cyclic. The fix is bitwise AND cur_post to get the real value.
--- drivers/net/mlx5/hws/mlx5dr_send.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_send.h +4 -1
@@ -255,7 +255,10 @@ void mlx5dr_send_engine_flush_queue(struct mlx5dr_send_engine *queue);static inline bool mlx5dr_send_engine_empty (struct mlx5dr_send_engine *queue) { -return (queue->send_ring->send_sq.cur_post == queue->send_ring->send_cq.poll_wqe); +struct mlx5dr_send_ring_sq *send_sq = &queue->send_ring->send_sq; +struct mlx5dr_send_ring_cq *send_cq = &queue->send_ring->send_cq; + +return ((send_sq->cur_post & send_sq->buf_mask) == send_cq->poll_wqe); }static inline bool mlx5dr_send_engine_full (struct mlx5dr_send_engine *queue)
Signature · 1 line
2.18.1
RE: [PATCH] net/mlx5/hws: fix send sync drain empty queue check
Hi,
Quoted 15 lines
-----Original Message-----
From: Alex Vesker <[email protected]>
Sent: Thursday, March 23, 2023 2:34 PM
To: Alex Vesker <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>
Subject: [PATCH]net/mlx5/hws: fix send sync drain empty queue checkThe function that checks if the queue is empty used on queue action for SYNC and ASYNC drain didn't function correctly since
cur_postis a free running value and not cyclic.
The fix is bitwise ANDcur_postto get the real value.
Quoted 4 lines
Fixes 90488887ee33 ("net/mlx5/hws: support synchronous drain")Signed-off-by Alex Vesker <[email protected]>Reviewed-by Erez Shitrit <[email protected]>Acked-by Matan Azrad [email protected]
Fixed Acked-by tag,
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
PATCH 1/1 net/mlx5/hws: fix IPv4 frag matching
In reply to Alex VeskerFrom: Hamdan Igbaria <[email protected]>
Fix IPv4 frag matching in case fragment_offset field is set to non zero value in the mask.fragment_offset value is converted using the following logic:
-In case fragment_offset value was set to 0x3fff, then we will
match only on ip_fragmented bit.
-Otherwise we will match fragment_offset based on spec and last
same as any other field.
--- drivers/net/mlx5/hws/mlx5dr_definer.c | 11 +++++++++-- drivers/net/mlx5/hws/mlx5dr_definer.h | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/mlx5/hws/mlx5dr_definer.c +9 -2
@@ -127,6 +127,7 @@ struct mlx5dr_definer_conv_data { X(SET, ipv4_version, STE_IPV4, rte_ipv4_hdr) \ X(SET_BE16, ipv4_frag, v->fragment_offset, rte_ipv4_hdr) \ X(SET_BE16, ipv4_len, v->total_length, rte_ipv4_hdr) \ + X(SET, ip_fragmented, !!v->fragment_offset, rte_ipv4_hdr) \ X(SET_BE16, ipv6_payload_len, v->hdr.payload_len, rte_flow_item_ipv6) \ X(SET, ipv6_proto, v->hdr.proto, rte_flow_item_ipv6) \X (SET , ipv6_routing_hdr,IPPROTO_ROUTING , rte_flow_item_ipv6) \
@@ -735,8 +736,14 @@ mlx5dr_definer_conv_item_ipv4(struct mlx5dr_definer_conv_data *cd,if (m->fragment_offset) { fc = &cd->fc[DR_CALC_FNAME (IP_FRAG , inner)]; fc->item_idx = item_idx; - fc->tag_set = &mlx5dr_definer_ipv4_frag_set; -DR_CALC_SET (fc, eth_l3, fragment_offset, inner); +if (rte_be_to_cpu_16 (m->fragment_offset) ==0x3fff ) { + fc->tag_set = &mlx5dr_definer_ip_fragmented_set; +DR_CALC_SET (fc, eth_l2, ip_fragmented, inner); + }else { + fc->is_range = l && l->fragment_offset; + fc->tag_set = &mlx5dr_definer_ipv4_frag_set; +DR_CALC_SET (fc, eth_l3, ipv4_frag, inner); + } }if (m->next_proto_id) {
drivers/net/mlx5/hws/mlx5dr_definer.h +7 -2
@@ -226,8 +226,13 @@ struct mlx5_ifc_definer_hl_eth_l3_bits {u8 time_to_live_hop_limit[0x8 ];u8 protocol_next_header[0x8 ];u8 identification[0x10 ]; -u8 flags[0x3 ]; -u8 fragment_offset[0xd ]; +union { +u8 ipv4_frag[0x10 ]; +struct { +u8 flags[0x3 ]; +u8 fragment_offset[0xd ]; + }; + };u8 ipv4_total_length[0x10 ];u8 checksum[0x10 ];u8 reserved_at_60[0xc ];
Signature · 1 line
2.18.1
RE: [PATCH] net/mlx5/hws: fix IPv4 frag matching
Hi,
Quoted 21 lines
-----Original Message-----
From: Alex Vesker <[email protected]>
Sent: Thursday, March 23, 2023 2:34 PM
To: Alex Vesker <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>; Hamdan Igbaria <[email protected]>; [email protected]
Subject: [PATCH]net/mlx5/hws: fix IPv4 frag matchingFrom: Hamdan Igbaria <[email protected]>
Fix IPv4 frag matching in case
fragment_offsetfield is set to non zero value in the mask.fragment_offsetvalue is converted using the following logic:
-In casefragment_offsetvalue was set to0x3fff, then we will match only onip_fragmentedbit.
-Otherwise we will matchfragment_offsetbased on spec and last same as any other field.
Quoted 6 lines
Fixes c55c2bf35333 ("net/mlx5/hws: add definer layer")Signed-off-by Hamdan Igbaria <[email protected]>Reviewed-by Alex Vesker <[email protected]>Acked-by Matan Azrad [email protected]
Fixed Acked-by tag,
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
Hi,
Quoted 14 lines
-----Original Message-----
From: Alex Vesker <[email protected]>
Sent: Thursday, March 23, 2023 2:34 PM
To: Alex Vesker <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>; [email protected]
Subject: [PATCH]net/mlx5/hws: fix return value of send queue actionThe
rte_errnoshould be set to a positive error value while the ret of the function should return a negative value this aligns code to other mlx5dr API functions.
Quoted 5 lines
Fixes 3eb748869d2d ("net/mlx5/hws: add send layer")Signed-off-by Alex Vesker <[email protected]>Reviewed-by Erez Shitrit <[email protected]>Acked-by Matan Azrad [email protected]
Fixed Acked-by tag,
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh