Commit e12f1a59 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-Add-IPv6-host-dpipe-table'

Jiri Pirko says:

====================
mlxsw: Add IPv6 host dpipe table

This patchset adds IPv6 host dpipe table support. This will provide the
ability to observe the hardware offloaded IPv6 neighbors.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 84ccac6e 0fb5fe3c
...@@ -76,6 +76,7 @@ static struct devlink_dpipe_header *mlxsw_dpipe_headers[] = { ...@@ -76,6 +76,7 @@ static struct devlink_dpipe_header *mlxsw_dpipe_headers[] = {
&mlxsw_sp_dpipe_header_metadata, &mlxsw_sp_dpipe_header_metadata,
&devlink_dpipe_header_ethernet, &devlink_dpipe_header_ethernet,
&devlink_dpipe_header_ipv4, &devlink_dpipe_header_ipv4,
&devlink_dpipe_header_ipv6,
}; };
static struct devlink_dpipe_headers mlxsw_sp_dpipe_headers = { static struct devlink_dpipe_headers mlxsw_sp_dpipe_headers = {
...@@ -328,9 +329,21 @@ static int mlxsw_sp_dpipe_table_host_matches_dump(struct sk_buff *skb, int type) ...@@ -328,9 +329,21 @@ static int mlxsw_sp_dpipe_table_host_matches_dump(struct sk_buff *skb, int type)
if (err) if (err)
return err; return err;
switch (type) {
case AF_INET:
match.type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT; match.type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT;
match.header = &devlink_dpipe_header_ipv4; match.header = &devlink_dpipe_header_ipv4;
match.field_id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP; 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);
return -EINVAL;
}
return devlink_dpipe_match_put(skb, &match); return devlink_dpipe_match_put(skb, &match);
} }
...@@ -342,7 +355,7 @@ mlxsw_sp_dpipe_table_host4_matches_dump(void *priv, struct sk_buff *skb) ...@@ -342,7 +355,7 @@ mlxsw_sp_dpipe_table_host4_matches_dump(void *priv, struct sk_buff *skb)
} }
static int static int
mlxsw_sp_dpipe_table_host4_actions_dump(void *priv, struct sk_buff *skb) mlxsw_sp_dpipe_table_host_actions_dump(void *priv, struct sk_buff *skb)
{ {
struct devlink_dpipe_action action = {0}; struct devlink_dpipe_action action = {0};
...@@ -373,8 +386,19 @@ mlxsw_sp_dpipe_table_host_match_action_prepare(struct devlink_dpipe_match *match ...@@ -373,8 +386,19 @@ mlxsw_sp_dpipe_table_host_match_action_prepare(struct devlink_dpipe_match *match
match = &matches[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP]; match = &matches[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP];
match->type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT; match->type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT;
switch (type) {
case AF_INET:
match->header = &devlink_dpipe_header_ipv4; match->header = &devlink_dpipe_header_ipv4;
match->field_id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP; match->field_id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP;
break;
case AF_INET6:
match->header = &devlink_dpipe_header_ipv6;
match->field_id = DEVLINK_DPIPE_FIELD_IPV6_DST_IP;
break;
default:
WARN_ON(1);
return;
}
action->type = DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY; action->type = DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY;
action->header = &devlink_dpipe_header_ethernet; action->header = &devlink_dpipe_header_ethernet;
...@@ -411,7 +435,18 @@ mlxsw_sp_dpipe_table_host_entry_prepare(struct devlink_dpipe_entry *entry, ...@@ -411,7 +435,18 @@ mlxsw_sp_dpipe_table_host_entry_prepare(struct devlink_dpipe_entry *entry,
match_value = &match_values[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP]; match_value = &match_values[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP];
match_value->match = match; match_value->match = match;
switch (type) {
case AF_INET:
match_value->value_size = sizeof(u32); match_value->value_size = sizeof(u32);
break;
case AF_INET6:
match_value->value_size = sizeof(struct in6_addr);
break;
default:
WARN_ON(1);
return -EINVAL;
}
match_value->value = kmalloc(match_value->value_size, GFP_KERNEL); match_value->value = kmalloc(match_value->value_size, GFP_KERNEL);
if (!match_value->value) if (!match_value->value)
return -ENOMEM; return -ENOMEM;
...@@ -426,13 +461,12 @@ mlxsw_sp_dpipe_table_host_entry_prepare(struct devlink_dpipe_entry *entry, ...@@ -426,13 +461,12 @@ mlxsw_sp_dpipe_table_host_entry_prepare(struct devlink_dpipe_entry *entry,
} }
static void static void
__mlxsw_sp_dpipe_table_host4_entry_fill(struct devlink_dpipe_entry *entry, __mlxsw_sp_dpipe_table_host_entry_fill(struct devlink_dpipe_entry *entry,
struct mlxsw_sp_rif *rif, struct mlxsw_sp_rif *rif,
unsigned char *ha, u32 dip) unsigned char *ha, void *dip)
{ {
struct devlink_dpipe_value *value; struct devlink_dpipe_value *value;
u32 *rif_value; u32 *rif_value;
u32 *dip_value;
u8 *ha_value; u8 *ha_value;
/* Set Match RIF index */ /* Set Match RIF index */
...@@ -445,9 +479,7 @@ __mlxsw_sp_dpipe_table_host4_entry_fill(struct devlink_dpipe_entry *entry, ...@@ -445,9 +479,7 @@ __mlxsw_sp_dpipe_table_host4_entry_fill(struct devlink_dpipe_entry *entry,
/* Set Match DIP */ /* Set Match DIP */
value = &entry->match_values[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP]; value = &entry->match_values[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP];
memcpy(value->value, dip, value->value_size);
dip_value = value->value;
*dip_value = dip;
/* Set Action DMAC */ /* Set Action DMAC */
value = entry->action_values; value = entry->action_values;
...@@ -465,7 +497,21 @@ mlxsw_sp_dpipe_table_host4_entry_fill(struct devlink_dpipe_entry *entry, ...@@ -465,7 +497,21 @@ mlxsw_sp_dpipe_table_host4_entry_fill(struct devlink_dpipe_entry *entry,
ha = mlxsw_sp_neigh_entry_ha(neigh_entry); ha = mlxsw_sp_neigh_entry_ha(neigh_entry);
dip = mlxsw_sp_neigh4_entry_dip(neigh_entry); dip = mlxsw_sp_neigh4_entry_dip(neigh_entry);
__mlxsw_sp_dpipe_table_host4_entry_fill(entry, rif, ha, dip); __mlxsw_sp_dpipe_table_host_entry_fill(entry, rif, ha, &dip);
}
static void
mlxsw_sp_dpipe_table_host6_entry_fill(struct devlink_dpipe_entry *entry,
struct mlxsw_sp_neigh_entry *neigh_entry,
struct mlxsw_sp_rif *rif)
{
struct in6_addr *dip;
unsigned char *ha;
ha = mlxsw_sp_neigh_entry_ha(neigh_entry);
dip = mlxsw_sp_neigh6_entry_dip(neigh_entry);
__mlxsw_sp_dpipe_table_host_entry_fill(entry, rif, ha, dip);
} }
static void static void
...@@ -477,7 +523,18 @@ mlxsw_sp_dpipe_table_host_entry_fill(struct mlxsw_sp *mlxsw_sp, ...@@ -477,7 +523,18 @@ mlxsw_sp_dpipe_table_host_entry_fill(struct mlxsw_sp *mlxsw_sp,
{ {
int err; int err;
switch (type) {
case AF_INET:
mlxsw_sp_dpipe_table_host4_entry_fill(entry, neigh_entry, rif); mlxsw_sp_dpipe_table_host4_entry_fill(entry, neigh_entry, rif);
break;
case AF_INET6:
mlxsw_sp_dpipe_table_host6_entry_fill(entry, neigh_entry, rif);
break;
default:
WARN_ON(1);
return;
}
err = mlxsw_sp_neigh_counter_get(mlxsw_sp, neigh_entry, err = mlxsw_sp_neigh_counter_get(mlxsw_sp, neigh_entry,
&entry->counter); &entry->counter);
if (!err) if (!err)
...@@ -516,7 +573,13 @@ mlxsw_sp_dpipe_table_host_entries_get(struct mlxsw_sp *mlxsw_sp, ...@@ -516,7 +573,13 @@ mlxsw_sp_dpipe_table_host_entries_get(struct mlxsw_sp *mlxsw_sp,
rif_neigh_count = 0; rif_neigh_count = 0;
mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) { mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) {
if (mlxsw_sp_neigh_entry_type(neigh_entry) != type) int neigh_type = mlxsw_sp_neigh_entry_type(neigh_entry);
if (neigh_type != type)
continue;
if (neigh_type == AF_INET6 &&
mlxsw_sp_neigh_ipv6_ignore(neigh_entry))
continue; continue;
if (rif_neigh_count < rif_neigh_skip) if (rif_neigh_count < rif_neigh_skip)
...@@ -616,8 +679,15 @@ mlxsw_sp_dpipe_table_host_counters_update(struct mlxsw_sp *mlxsw_sp, ...@@ -616,8 +679,15 @@ mlxsw_sp_dpipe_table_host_counters_update(struct mlxsw_sp *mlxsw_sp,
if (!rif) if (!rif)
continue; continue;
mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) { mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) {
if (mlxsw_sp_neigh_entry_type(neigh_entry) != type) int neigh_type = mlxsw_sp_neigh_entry_type(neigh_entry);
if (neigh_type != type)
continue; continue;
if (neigh_type == AF_INET6 &&
mlxsw_sp_neigh_ipv6_ignore(neigh_entry))
continue;
mlxsw_sp_neigh_entry_counter_update(mlxsw_sp, mlxsw_sp_neigh_entry_counter_update(mlxsw_sp,
neigh_entry, neigh_entry,
enable); enable);
...@@ -648,8 +718,15 @@ mlxsw_sp_dpipe_table_host_size_get(struct mlxsw_sp *mlxsw_sp, int type) ...@@ -648,8 +718,15 @@ mlxsw_sp_dpipe_table_host_size_get(struct mlxsw_sp *mlxsw_sp, int type)
if (!rif) if (!rif)
continue; continue;
mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) { mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) {
if (mlxsw_sp_neigh_entry_type(neigh_entry) != type) int neigh_type = mlxsw_sp_neigh_entry_type(neigh_entry);
if (neigh_type != type)
continue;
if (neigh_type == AF_INET6 &&
mlxsw_sp_neigh_ipv6_ignore(neigh_entry))
continue; continue;
size++; size++;
} }
} }
...@@ -667,7 +744,7 @@ static u64 mlxsw_sp_dpipe_table_host4_size_get(void *priv) ...@@ -667,7 +744,7 @@ static u64 mlxsw_sp_dpipe_table_host4_size_get(void *priv)
static struct devlink_dpipe_table_ops mlxsw_sp_host4_ops = { static struct devlink_dpipe_table_ops mlxsw_sp_host4_ops = {
.matches_dump = mlxsw_sp_dpipe_table_host4_matches_dump, .matches_dump = mlxsw_sp_dpipe_table_host4_matches_dump,
.actions_dump = mlxsw_sp_dpipe_table_host4_actions_dump, .actions_dump = mlxsw_sp_dpipe_table_host_actions_dump,
.entries_dump = mlxsw_sp_dpipe_table_host4_entries_dump, .entries_dump = mlxsw_sp_dpipe_table_host4_entries_dump,
.counters_set_update = mlxsw_sp_dpipe_table_host4_counters_update, .counters_set_update = mlxsw_sp_dpipe_table_host4_counters_update,
.size_get = mlxsw_sp_dpipe_table_host4_size_get, .size_get = mlxsw_sp_dpipe_table_host4_size_get,
...@@ -691,6 +768,64 @@ static void mlxsw_sp_dpipe_host4_table_fini(struct mlxsw_sp *mlxsw_sp) ...@@ -691,6 +768,64 @@ static void mlxsw_sp_dpipe_host4_table_fini(struct mlxsw_sp *mlxsw_sp)
MLXSW_SP_DPIPE_TABLE_NAME_HOST4); MLXSW_SP_DPIPE_TABLE_NAME_HOST4);
} }
static int
mlxsw_sp_dpipe_table_host6_matches_dump(void *priv, struct sk_buff *skb)
{
return mlxsw_sp_dpipe_table_host_matches_dump(skb, AF_INET6);
}
static int
mlxsw_sp_dpipe_table_host6_entries_dump(void *priv, bool counters_enabled,
struct devlink_dpipe_dump_ctx *dump_ctx)
{
struct mlxsw_sp *mlxsw_sp = priv;
return mlxsw_sp_dpipe_table_host_entries_dump(mlxsw_sp,
counters_enabled,
dump_ctx, AF_INET6);
}
static int mlxsw_sp_dpipe_table_host6_counters_update(void *priv, bool enable)
{
struct mlxsw_sp *mlxsw_sp = priv;
mlxsw_sp_dpipe_table_host_counters_update(mlxsw_sp, enable, AF_INET6);
return 0;
}
static u64 mlxsw_sp_dpipe_table_host6_size_get(void *priv)
{
struct mlxsw_sp *mlxsw_sp = priv;
return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET6);
}
static struct devlink_dpipe_table_ops mlxsw_sp_host6_ops = {
.matches_dump = mlxsw_sp_dpipe_table_host6_matches_dump,
.actions_dump = mlxsw_sp_dpipe_table_host_actions_dump,
.entries_dump = mlxsw_sp_dpipe_table_host6_entries_dump,
.counters_set_update = mlxsw_sp_dpipe_table_host6_counters_update,
.size_get = mlxsw_sp_dpipe_table_host6_size_get,
};
static int mlxsw_sp_dpipe_host6_table_init(struct mlxsw_sp *mlxsw_sp)
{
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
return devlink_dpipe_table_register(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST6,
&mlxsw_sp_host6_ops,
mlxsw_sp, false);
}
static void mlxsw_sp_dpipe_host6_table_fini(struct mlxsw_sp *mlxsw_sp)
{
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
devlink_dpipe_table_unregister(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_HOST6);
}
int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp) int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp)
{ {
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
...@@ -707,8 +842,14 @@ int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp) ...@@ -707,8 +842,14 @@ int mlxsw_sp_dpipe_init(struct mlxsw_sp *mlxsw_sp)
err = mlxsw_sp_dpipe_host4_table_init(mlxsw_sp); err = mlxsw_sp_dpipe_host4_table_init(mlxsw_sp);
if (err) if (err)
goto err_host4_table_init; goto err_host4_table_init;
err = mlxsw_sp_dpipe_host6_table_init(mlxsw_sp);
if (err)
goto err_host6_table_init;
return 0; return 0;
err_host6_table_init:
mlxsw_sp_dpipe_host4_table_fini(mlxsw_sp);
err_host4_table_init: err_host4_table_init:
mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp); mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp);
err_erif_table_init: err_erif_table_init:
...@@ -720,6 +861,7 @@ void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp) ...@@ -720,6 +861,7 @@ void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp)
{ {
struct devlink *devlink = priv_to_devlink(mlxsw_sp->core); struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
mlxsw_sp_dpipe_host6_table_fini(mlxsw_sp);
mlxsw_sp_dpipe_host4_table_fini(mlxsw_sp); mlxsw_sp_dpipe_host4_table_fini(mlxsw_sp);
mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp); mlxsw_sp_dpipe_erif_table_fini(mlxsw_sp);
devlink_dpipe_headers_unregister(devlink); devlink_dpipe_headers_unregister(devlink);
......
...@@ -55,5 +55,6 @@ static inline void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp) ...@@ -55,5 +55,6 @@ static inline void mlxsw_sp_dpipe_fini(struct mlxsw_sp *mlxsw_sp)
#define MLXSW_SP_DPIPE_TABLE_NAME_ERIF "mlxsw_erif" #define MLXSW_SP_DPIPE_TABLE_NAME_ERIF "mlxsw_erif"
#define MLXSW_SP_DPIPE_TABLE_NAME_HOST4 "mlxsw_host4" #define MLXSW_SP_DPIPE_TABLE_NAME_HOST4 "mlxsw_host4"
#define MLXSW_SP_DPIPE_TABLE_NAME_HOST6 "mlxsw_host6"
#endif /* _MLXSW_PIPELINE_H_*/ #endif /* _MLXSW_PIPELINE_H_*/
...@@ -947,6 +947,15 @@ u32 mlxsw_sp_neigh4_entry_dip(struct mlxsw_sp_neigh_entry *neigh_entry) ...@@ -947,6 +947,15 @@ u32 mlxsw_sp_neigh4_entry_dip(struct mlxsw_sp_neigh_entry *neigh_entry)
return ntohl(*((__be32 *) n->primary_key)); return ntohl(*((__be32 *) n->primary_key));
} }
struct in6_addr *
mlxsw_sp_neigh6_entry_dip(struct mlxsw_sp_neigh_entry *neigh_entry)
{
struct neighbour *n;
n = neigh_entry->key.n;
return (struct in6_addr *) &n->primary_key;
}
int mlxsw_sp_neigh_counter_get(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_neigh_counter_get(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_neigh_entry *neigh_entry, struct mlxsw_sp_neigh_entry *neigh_entry,
u64 *p_counter) u64 *p_counter)
...@@ -999,21 +1008,33 @@ mlxsw_sp_neigh_entry_remove(struct mlxsw_sp *mlxsw_sp, ...@@ -999,21 +1008,33 @@ mlxsw_sp_neigh_entry_remove(struct mlxsw_sp *mlxsw_sp,
} }
static bool static bool
mlxsw_sp_neigh4_counter_should_alloc(struct mlxsw_sp *mlxsw_sp) mlxsw_sp_neigh_counter_should_alloc(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_neigh_entry *neigh_entry)
{ {
struct devlink *devlink; struct devlink *devlink;
const char *table_name;
switch (mlxsw_sp_neigh_entry_type(neigh_entry)) {
case AF_INET:
table_name = MLXSW_SP_DPIPE_TABLE_NAME_HOST4;
break;
case AF_INET6:
table_name = MLXSW_SP_DPIPE_TABLE_NAME_HOST6;
break;
default:
WARN_ON(1);
return false;
}
devlink = priv_to_devlink(mlxsw_sp->core); devlink = priv_to_devlink(mlxsw_sp->core);
return devlink_dpipe_table_counter_enabled(devlink, return devlink_dpipe_table_counter_enabled(devlink, table_name);
MLXSW_SP_DPIPE_TABLE_NAME_HOST4);
} }
static void static void
mlxsw_sp_neigh_counter_alloc(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_neigh_counter_alloc(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_neigh_entry *neigh_entry) struct mlxsw_sp_neigh_entry *neigh_entry)
{ {
if (mlxsw_sp_neigh_entry_type(neigh_entry) != AF_INET || if (!mlxsw_sp_neigh_counter_should_alloc(mlxsw_sp, neigh_entry))
!mlxsw_sp_neigh4_counter_should_alloc(mlxsw_sp))
return; return;
if (mlxsw_sp_flow_counter_alloc(mlxsw_sp, &neigh_entry->counter_index)) if (mlxsw_sp_flow_counter_alloc(mlxsw_sp, &neigh_entry->counter_index))
...@@ -1396,8 +1417,10 @@ mlxsw_sp_router_neigh_entry_op6(struct mlxsw_sp *mlxsw_sp, ...@@ -1396,8 +1417,10 @@ mlxsw_sp_router_neigh_entry_op6(struct mlxsw_sp *mlxsw_sp,
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rauht), rauht_pl); mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rauht), rauht_pl);
} }
static bool mlxsw_sp_neigh_ipv6_ignore(struct neighbour *n) bool mlxsw_sp_neigh_ipv6_ignore(struct mlxsw_sp_neigh_entry *neigh_entry)
{ {
struct neighbour *n = neigh_entry->key.n;
/* Packets with a link-local destination address are trapped /* Packets with a link-local destination address are trapped
* after LPM lookup and never reach the neighbour table, so * after LPM lookup and never reach the neighbour table, so
* there is no need to program such neighbours to the device. * there is no need to program such neighbours to the device.
...@@ -1420,7 +1443,7 @@ mlxsw_sp_neigh_entry_update(struct mlxsw_sp *mlxsw_sp, ...@@ -1420,7 +1443,7 @@ mlxsw_sp_neigh_entry_update(struct mlxsw_sp *mlxsw_sp,
mlxsw_sp_router_neigh_entry_op4(mlxsw_sp, neigh_entry, mlxsw_sp_router_neigh_entry_op4(mlxsw_sp, neigh_entry,
mlxsw_sp_rauht_op(adding)); mlxsw_sp_rauht_op(adding));
} else if (neigh_entry->key.n->tbl->family == AF_INET6) { } else if (neigh_entry->key.n->tbl->family == AF_INET6) {
if (mlxsw_sp_neigh_ipv6_ignore(neigh_entry->key.n)) if (mlxsw_sp_neigh_ipv6_ignore(neigh_entry))
return; return;
mlxsw_sp_router_neigh_entry_op6(mlxsw_sp, neigh_entry, mlxsw_sp_router_neigh_entry_op6(mlxsw_sp, neigh_entry,
mlxsw_sp_rauht_op(adding)); mlxsw_sp_rauht_op(adding));
......
...@@ -65,6 +65,8 @@ int mlxsw_sp_neigh_entry_type(struct mlxsw_sp_neigh_entry *neigh_entry); ...@@ -65,6 +65,8 @@ int mlxsw_sp_neigh_entry_type(struct mlxsw_sp_neigh_entry *neigh_entry);
unsigned char * unsigned char *
mlxsw_sp_neigh_entry_ha(struct mlxsw_sp_neigh_entry *neigh_entry); mlxsw_sp_neigh_entry_ha(struct mlxsw_sp_neigh_entry *neigh_entry);
u32 mlxsw_sp_neigh4_entry_dip(struct mlxsw_sp_neigh_entry *neigh_entry); u32 mlxsw_sp_neigh4_entry_dip(struct mlxsw_sp_neigh_entry *neigh_entry);
struct in6_addr *
mlxsw_sp_neigh6_entry_dip(struct mlxsw_sp_neigh_entry *neigh_entry);
#define mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) \ #define mlxsw_sp_rif_neigh_for_each(neigh_entry, rif) \
for (neigh_entry = mlxsw_sp_rif_neigh_next(rif, NULL); neigh_entry; \ for (neigh_entry = mlxsw_sp_rif_neigh_next(rif, NULL); neigh_entry; \
...@@ -76,5 +78,6 @@ void ...@@ -76,5 +78,6 @@ void
mlxsw_sp_neigh_entry_counter_update(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_neigh_entry_counter_update(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_neigh_entry *neigh_entry, struct mlxsw_sp_neigh_entry *neigh_entry,
bool adding); bool adding);
bool mlxsw_sp_neigh_ipv6_ignore(struct mlxsw_sp_neigh_entry *neigh_entry);
#endif /* _MLXSW_ROUTER_H_*/ #endif /* _MLXSW_ROUTER_H_*/
...@@ -330,6 +330,7 @@ int devlink_dpipe_match_put(struct sk_buff *skb, ...@@ -330,6 +330,7 @@ int devlink_dpipe_match_put(struct sk_buff *skb,
struct devlink_dpipe_match *match); struct devlink_dpipe_match *match);
extern struct devlink_dpipe_header devlink_dpipe_header_ethernet; extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
extern struct devlink_dpipe_header devlink_dpipe_header_ipv4; extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
#else #else
......
...@@ -234,9 +234,14 @@ enum devlink_dpipe_field_ipv4_id { ...@@ -234,9 +234,14 @@ enum devlink_dpipe_field_ipv4_id {
DEVLINK_DPIPE_FIELD_IPV4_DST_IP, DEVLINK_DPIPE_FIELD_IPV4_DST_IP,
}; };
enum devlink_dpipe_field_ipv6_id {
DEVLINK_DPIPE_FIELD_IPV6_DST_IP,
};
enum devlink_dpipe_header_id { enum devlink_dpipe_header_id {
DEVLINK_DPIPE_HEADER_ETHERNET, DEVLINK_DPIPE_HEADER_ETHERNET,
DEVLINK_DPIPE_HEADER_IPV4, DEVLINK_DPIPE_HEADER_IPV4,
DEVLINK_DPIPE_HEADER_IPV6,
}; };
#endif /* _UAPI_LINUX_DEVLINK_H_ */ #endif /* _UAPI_LINUX_DEVLINK_H_ */
...@@ -63,6 +63,23 @@ struct devlink_dpipe_header devlink_dpipe_header_ipv4 = { ...@@ -63,6 +63,23 @@ struct devlink_dpipe_header devlink_dpipe_header_ipv4 = {
}; };
EXPORT_SYMBOL(devlink_dpipe_header_ipv4); EXPORT_SYMBOL(devlink_dpipe_header_ipv4);
static struct devlink_dpipe_field devlink_dpipe_fields_ipv6[] = {
{
.name = "destination ip",
.id = DEVLINK_DPIPE_FIELD_IPV6_DST_IP,
.bitwidth = 128,
},
};
struct devlink_dpipe_header devlink_dpipe_header_ipv6 = {
.name = "ipv6",
.id = DEVLINK_DPIPE_HEADER_IPV6,
.fields = devlink_dpipe_fields_ipv6,
.fields_count = ARRAY_SIZE(devlink_dpipe_fields_ipv6),
.global = true,
};
EXPORT_SYMBOL(devlink_dpipe_header_ipv6);
EXPORT_TRACEPOINT_SYMBOL_GPL(devlink_hwmsg); EXPORT_TRACEPOINT_SYMBOL_GPL(devlink_hwmsg);
static LIST_HEAD(devlink_list); static LIST_HEAD(devlink_list);
......
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