Wed, Aug 30, 2017 at 07:36:13PM CEST, dsah...@gmail.com wrote: >On 8/30/17 6:03 AM, Jiri Pirko wrote: >> @@ -328,9 +329,21 @@ static int >> mlxsw_sp_dpipe_table_host_matches_dump(struct sk_buff *skb, int type) >> if (err) >> return err; >> >> - match.type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT; >> - match.header = &devlink_dpipe_header_ipv4; >> - match.field_id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP; >> + switch (type) { >> + case AF_INET: >> + match.type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT; >> + match.header = &devlink_dpipe_header_ipv4; >> + match.field_id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP; >> + break; >> + case AF_INET6: >> + match.type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT; >> + match.header = &devlink_dpipe_header_ipv6; >> + match.field_id = DEVLINK_DPIPE_FIELD_IPV6_DST_IP; >> + break; >> + default: >> + WARN_ON(1); > >Why a warn for dump request of an unsupported family?
It's a handling of default case that should not happen unless there is a bug in kernel. > >> + return -EINVAL; >> + } >> >> return devlink_dpipe_match_put(skb, &match); >> } >> @@ -342,7 +355,7 @@ mlxsw_sp_dpipe_table_host4_matches_dump(void *priv, >> struct sk_buff *skb) >