diff mbox

[ovs-dev] dpif-netdev: Remove useless port checking.

Message ID 1497945205-18211-1-git-send-email-i.maximets@samsung.com
State Accepted
Headers show

Commit Message

Ilya Maximets June 20, 2017, 7:53 a.m. UTC
Since commit ff073a71f9bb ("dpif-netdev: Use hmap instead of
list+array for tracking ports."), 'is_valid_port_number()' is
equal to 'port_no != ODPP_NONE', and the expression below will
never be true.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/dpif-netdev.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Gregory Rose June 23, 2017, 4:43 p.m. UTC | #1
On 06/20/2017 12:53 AM, Ilya Maximets wrote:
> Since commit ff073a71f9bb ("dpif-netdev: Use hmap instead of
> list+array for tracking ports."), 'is_valid_port_number()' is
> equal to 'port_no != ODPP_NONE', and the expression below will
> never be true.
>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---
>   lib/dpif-netdev.c | 7 -------
>   1 file changed, 7 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index f83b632..fca277a 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -2257,8 +2257,6 @@ static int
>   dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
>                                 struct flow *flow, bool probe)
>   {
> -    odp_port_t in_port;
> -
>       if (odp_flow_key_to_flow(key, key_len, flow)) {
>           if (!probe) {
>               /* This should not happen: it indicates that
> @@ -2280,11 +2278,6 @@ dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
>           return EINVAL;
>       }
>
> -    in_port = flow->in_port.odp_port;
> -    if (!is_valid_port_number(in_port) && in_port != ODPP_NONE) {
> -        return EINVAL;
> -    }
> -
>       if (flow->ct_state & DP_NETDEV_CS_UNSUPPORTED_MASK) {
>           return EINVAL;
>       }
>
LGTM

Acked-by: Greg Rose <gvrose8192@gmail.com>
Ben Pfaff July 11, 2017, 8:09 p.m. UTC | #2
On Fri, Jun 23, 2017 at 09:43:45AM -0700, Greg Rose wrote:
> On 06/20/2017 12:53 AM, Ilya Maximets wrote:
> >Since commit ff073a71f9bb ("dpif-netdev: Use hmap instead of
> >list+array for tracking ports."), 'is_valid_port_number()' is
> >equal to 'port_no != ODPP_NONE', and the expression below will
> >never be true.
> >
> >Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> >---
> >  lib/dpif-netdev.c | 7 -------
> >  1 file changed, 7 deletions(-)
> >
> >diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> >index f83b632..fca277a 100644
> >--- a/lib/dpif-netdev.c
> >+++ b/lib/dpif-netdev.c
> >@@ -2257,8 +2257,6 @@ static int
> >  dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
> >                                struct flow *flow, bool probe)
> >  {
> >-    odp_port_t in_port;
> >-
> >      if (odp_flow_key_to_flow(key, key_len, flow)) {
> >          if (!probe) {
> >              /* This should not happen: it indicates that
> >@@ -2280,11 +2278,6 @@ dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
> >          return EINVAL;
> >      }
> >
> >-    in_port = flow->in_port.odp_port;
> >-    if (!is_valid_port_number(in_port) && in_port != ODPP_NONE) {
> >-        return EINVAL;
> >-    }
> >-
> >      if (flow->ct_state & DP_NETDEV_CS_UNSUPPORTED_MASK) {
> >          return EINVAL;
> >      }
> >
> LGTM
> 
> Acked-by: Greg Rose <gvrose8192@gmail.com>

Thanks Ilya and Greg, I applied this to master.
diff mbox

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index f83b632..fca277a 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2257,8 +2257,6 @@  static int
 dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
                               struct flow *flow, bool probe)
 {
-    odp_port_t in_port;
-
     if (odp_flow_key_to_flow(key, key_len, flow)) {
         if (!probe) {
             /* This should not happen: it indicates that
@@ -2280,11 +2278,6 @@  dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
         return EINVAL;
     }
 
-    in_port = flow->in_port.odp_port;
-    if (!is_valid_port_number(in_port) && in_port != ODPP_NONE) {
-        return EINVAL;
-    }
-
     if (flow->ct_state & DP_NETDEV_CS_UNSUPPORTED_MASK) {
         return EINVAL;
     }