Commit 61004d1d authored by Louis Peens's avatar Louis Peens Committed by Jakub Kicinski

nfp: flower: fix 'variable 'flow6' set but not used'

Kernel test robot reported an issue after a recent patch about an
unused variable when CONFIG_IPV6 is disabled. Move the variable
declaration to be inside the #ifdef, and do a bit more cleanup. There
is no need to use a temporary ipv6 bool value, it is just checked once,
remove the extra variable and just do the check directly.

Fixes: 9d5447ed ("nfp: flower: fixup ipv6/ipv4 route lookup for neigh events")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20220510074845.41457-1-simon.horman@corigine.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ecd17a87
...@@ -563,12 +563,9 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, ...@@ -563,12 +563,9 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
{ {
struct nfp_flower_priv *app_priv; struct nfp_flower_priv *app_priv;
struct netevent_redirect *redir; struct netevent_redirect *redir;
struct flowi4 flow4 = {};
struct flowi6 flow6 = {};
struct neighbour *n; struct neighbour *n;
struct nfp_app *app; struct nfp_app *app;
bool neigh_invalid; bool neigh_invalid;
bool ipv6 = false;
int err; int err;
switch (event) { switch (event) {
...@@ -583,16 +580,8 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, ...@@ -583,16 +580,8 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
return NOTIFY_DONE; return NOTIFY_DONE;
} }
if (n->tbl->family == AF_INET6)
ipv6 = true;
neigh_invalid = !(n->nud_state & NUD_VALID) || n->dead; neigh_invalid = !(n->nud_state & NUD_VALID) || n->dead;
if (ipv6)
flow6.daddr = *(struct in6_addr *)n->primary_key;
else
flow4.daddr = *(__be32 *)n->primary_key;
app_priv = container_of(nb, struct nfp_flower_priv, tun.neigh_nb); app_priv = container_of(nb, struct nfp_flower_priv, tun.neigh_nb);
app = app_priv->app; app = app_priv->app;
...@@ -601,8 +590,11 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, ...@@ -601,8 +590,11 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
return NOTIFY_DONE; return NOTIFY_DONE;
#if IS_ENABLED(CONFIG_INET) #if IS_ENABLED(CONFIG_INET)
if (ipv6) { if (n->tbl->family == AF_INET6) {
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
struct flowi6 flow6 = {};
flow6.daddr = *(struct in6_addr *)n->primary_key;
if (!neigh_invalid) { if (!neigh_invalid) {
struct dst_entry *dst; struct dst_entry *dst;
/* Use ipv6_dst_lookup_flow to populate flow6->saddr /* Use ipv6_dst_lookup_flow to populate flow6->saddr
...@@ -623,6 +615,9 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, ...@@ -623,6 +615,9 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
return NOTIFY_DONE; return NOTIFY_DONE;
#endif /* CONFIG_IPV6 */ #endif /* CONFIG_IPV6 */
} else { } else {
struct flowi4 flow4 = {};
flow4.daddr = *(__be32 *)n->primary_key;
if (!neigh_invalid) { if (!neigh_invalid) {
struct rtable *rt; struct rtable *rt;
/* Use ip_route_output_key to populate flow4->saddr and /* Use ip_route_output_key to populate flow4->saddr and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment