[dpdk-dev] net/mlx4: fix restriction on TCP/UDP flow rules
Checks
Commit Message
The code as currently written requires TCP/UDP source and destination ports
to be always specified.
No such restriction is enforced by hardware; all TCP and UDP traffic can be
matched by providing an empty mask for these fields.
Fixes: 680d5280c20b ("net/mlx4: refactor flow item validation code")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx4/mlx4_flow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Fri, Oct 20, 2017 at 02:39:58PM +0200, Adrien Mazarguil wrote:
> The code as currently written requires TCP/UDP source and destination ports
> to be always specified.
>
> No such restriction is enforced by hardware; all TCP and UDP traffic can be
> matched by providing an empty mask for these fields.
>
> Fixes: 680d5280c20b ("net/mlx4: refactor flow item validation code")
>
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
On 10/20/2017 5:45 AM, Nélio Laranjeiro wrote:
> On Fri, Oct 20, 2017 at 02:39:58PM +0200, Adrien Mazarguil wrote:
>> The code as currently written requires TCP/UDP source and destination ports
>> to be always specified.
>>
>> No such restriction is enforced by hardware; all TCP and UDP traffic can be
>> matched by providing an empty mask for these fields.
>>
>> Fixes: 680d5280c20b ("net/mlx4: refactor flow item validation code")
>>
>> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Applied to dpdk-next-net/master, thanks.
@@ -404,7 +404,7 @@ mlx4_flow_merge_udp(struct rte_flow *flow,
struct ibv_flow_spec_tcp_udp *udp;
const char *msg;
- if (!mask ||
+ if (mask &&
((uint16_t)(mask->hdr.src_port + 1) > UINT16_C(1) ||
(uint16_t)(mask->hdr.dst_port + 1) > UINT16_C(1))) {
msg = "mlx4 does not support matching partial UDP fields";
@@ -464,7 +464,7 @@ mlx4_flow_merge_tcp(struct rte_flow *flow,
struct ibv_flow_spec_tcp_udp *tcp;
const char *msg;
- if (!mask ||
+ if (mask &&
((uint16_t)(mask->hdr.src_port + 1) > UINT16_C(1) ||
(uint16_t)(mask->hdr.dst_port + 1) > UINT16_C(1))) {
msg = "mlx4 does not support matching partial TCP fields";