Commit 64ee24c7 authored by David S. Miller's avatar David S. Miller

Merge branch 'bridge-mrp-Add-support-for-interconnect-ring'

Horatiu Vultur says:

====================
bridge: mrp: Add support for interconnect ring

This patch series extends existing MRP to add support for interconnect ring.  An
interconnect ring is a ring that connects 2 rings. In this way is possible to
connect multiple rings. Each interconnect ring is form of 4 nodes, in which 3
have the role MIC(Media Redundancy Interconnect Client) and one has the role
MIM(Media Redundancy Interconnect Manager). All these nodes need to have the
same ID and the ID needs to be unique between multiple interconnect rings. And 2
nodes needs to be part of one ring and the other 2 nodes needs to be part of the
other ring that is connected.

                 +---------+
                 |         |
      +----------|   MRM   |---------------+
      |          |         |               |
      |          +---------+               |
      |                                    |
      |                                    |
      |                                    |
+--------------+                  +-----------------+
|              |                  |                 |
|  MRC/MIC     |------------------|    MRC/MIM      |
|              |                  |                 |
+--------------+                  +-----------------+
      |                                     |
      |Interconnect port                    |Interconnect port
      |                                     |
      |                                     |
+--------------+                  +-----------------+
|              |                  |                 |
|  MRC/MIC     |----------------- |   MRC/MIC       |
|              |                  |                 |
+--------------+                  +-----------------+
      |                                     |
      |                                     |
      |          +---------+                |
      |          |         |                |
      +----------|  MRM    |----------------+
                 |         |
                 +---------+

Each node in a ring needs to have one of the following ring roles, MRM or MRC.
And it can also have an interconnect role like MIM or MIC if it is part of an
interconnect ring. In the figure above the MRM doesn't have any interconnect
role but the MRC from the top ring have the interconnect roles MIC respectively
MIM. Therefore it is not possible for a node to have only an interconnect role.

There are 2 ways for interconnect ring to detect when is open or closed:
1. To use CCM frames on the interconnect port to detect when the interconnect
   link goes down/up. This mode is called LC-mode.
2. To send InTest frames on all 3 ports(2 ring ports and 1 interconnect port)
   and detect when these frames are received back. This mode is called RC-mode.

This patch series adds support only for RC-mode. Where MIM sends InTest frames
on all 3 ports and detects when it receives back the InTest. When it receives
the InTest it means that the ring is closed so it would set the interconnect
port in blocking state. If it stops receiving the InTest frames then it would
set the port in forwarding state and it would send InTopo frames. These InTopo
frames will be received by MRM nodes and process them. And then the MRM will
send Topo frames in the rings so each client will clear its FDB.

v4:
  - always cancel delay work if the MRP instance is deleted or interconnect role
    is disabled but allow only to start to send InTest frames only if the role
    is MIM.

v3:
  - update 'br_mrp_set_in_role' to stop sending test if the role is disabled
    and don't allow to set a different interconnect port if there is already
    one.

v2:
  - rearrange structures not to contain holes
  - stop sending MRP_InTest frames when the MRP instance is deleted
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 07dd1b7e ffb3adba
......@@ -49,6 +49,7 @@ struct br_ip_list {
#define BR_ISOLATED BIT(16)
#define BR_MRP_AWARE BIT(17)
#define BR_MRP_LOST_CONT BIT(18)
#define BR_MRP_LOST_IN_CONT BIT(19)
#define BR_DEFAULT_AGEING_TIME (300 * HZ)
......
......@@ -76,6 +76,10 @@ enum switchdev_obj_id {
SWITCHDEV_OBJ_ID_RING_TEST_MRP,
SWITCHDEV_OBJ_ID_RING_ROLE_MRP,
SWITCHDEV_OBJ_ID_RING_STATE_MRP,
SWITCHDEV_OBJ_ID_IN_TEST_MRP,
SWITCHDEV_OBJ_ID_IN_ROLE_MRP,
SWITCHDEV_OBJ_ID_IN_STATE_MRP,
#endif
};
......@@ -155,6 +159,40 @@ struct switchdev_obj_ring_state_mrp {
#define SWITCHDEV_OBJ_RING_STATE_MRP(OBJ) \
container_of((OBJ), struct switchdev_obj_ring_state_mrp, obj)
/* SWITCHDEV_OBJ_ID_IN_TEST_MRP */
struct switchdev_obj_in_test_mrp {
struct switchdev_obj obj;
/* The value is in us and a value of 0 represents to stop */
u32 interval;
u32 in_id;
u32 period;
u8 max_miss;
};
#define SWITCHDEV_OBJ_IN_TEST_MRP(OBJ) \
container_of((OBJ), struct switchdev_obj_in_test_mrp, obj)
/* SWICHDEV_OBJ_ID_IN_ROLE_MRP */
struct switchdev_obj_in_role_mrp {
struct switchdev_obj obj;
struct net_device *i_port;
u32 ring_id;
u16 in_id;
u8 in_role;
};
#define SWITCHDEV_OBJ_IN_ROLE_MRP(OBJ) \
container_of((OBJ), struct switchdev_obj_in_role_mrp, obj)
struct switchdev_obj_in_state_mrp {
struct switchdev_obj obj;
u32 in_id;
u8 in_state;
};
#define SWITCHDEV_OBJ_IN_STATE_MRP(OBJ) \
container_of((OBJ), struct switchdev_obj_in_state_mrp, obj)
#endif
typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj);
......
......@@ -167,6 +167,9 @@ enum {
IFLA_BRIDGE_MRP_RING_ROLE,
IFLA_BRIDGE_MRP_START_TEST,
IFLA_BRIDGE_MRP_INFO,
IFLA_BRIDGE_MRP_IN_ROLE,
IFLA_BRIDGE_MRP_IN_STATE,
IFLA_BRIDGE_MRP_START_IN_TEST,
__IFLA_BRIDGE_MRP_MAX,
};
......@@ -240,11 +243,47 @@ enum {
IFLA_BRIDGE_MRP_INFO_TEST_INTERVAL,
IFLA_BRIDGE_MRP_INFO_TEST_MAX_MISS,
IFLA_BRIDGE_MRP_INFO_TEST_MONITOR,
IFLA_BRIDGE_MRP_INFO_I_IFINDEX,
IFLA_BRIDGE_MRP_INFO_IN_STATE,
IFLA_BRIDGE_MRP_INFO_IN_ROLE,
IFLA_BRIDGE_MRP_INFO_IN_TEST_INTERVAL,
IFLA_BRIDGE_MRP_INFO_IN_TEST_MAX_MISS,
__IFLA_BRIDGE_MRP_INFO_MAX,
};
#define IFLA_BRIDGE_MRP_INFO_MAX (__IFLA_BRIDGE_MRP_INFO_MAX - 1)
enum {
IFLA_BRIDGE_MRP_IN_STATE_UNSPEC,
IFLA_BRIDGE_MRP_IN_STATE_IN_ID,
IFLA_BRIDGE_MRP_IN_STATE_STATE,
__IFLA_BRIDGE_MRP_IN_STATE_MAX,
};
#define IFLA_BRIDGE_MRP_IN_STATE_MAX (__IFLA_BRIDGE_MRP_IN_STATE_MAX - 1)
enum {
IFLA_BRIDGE_MRP_IN_ROLE_UNSPEC,
IFLA_BRIDGE_MRP_IN_ROLE_RING_ID,
IFLA_BRIDGE_MRP_IN_ROLE_IN_ID,
IFLA_BRIDGE_MRP_IN_ROLE_ROLE,
IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX,
__IFLA_BRIDGE_MRP_IN_ROLE_MAX,
};
#define IFLA_BRIDGE_MRP_IN_ROLE_MAX (__IFLA_BRIDGE_MRP_IN_ROLE_MAX - 1)
enum {
IFLA_BRIDGE_MRP_START_IN_TEST_UNSPEC,
IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID,
IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL,
IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS,
IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD,
__IFLA_BRIDGE_MRP_START_IN_TEST_MAX,
};
#define IFLA_BRIDGE_MRP_START_IN_TEST_MAX (__IFLA_BRIDGE_MRP_START_IN_TEST_MAX - 1)
struct br_mrp_instance {
__u32 ring_id;
__u32 p_ifindex;
......@@ -270,6 +309,25 @@ struct br_mrp_start_test {
__u32 monitor;
};
struct br_mrp_in_state {
__u32 in_state;
__u16 in_id;
};
struct br_mrp_in_role {
__u32 ring_id;
__u32 in_role;
__u32 i_ifindex;
__u16 in_id;
};
struct br_mrp_start_in_test {
__u32 interval;
__u32 max_miss;
__u32 period;
__u16 in_id;
};
struct bridge_stp_xstats {
__u64 transition_blk;
__u64 transition_fwd;
......
......@@ -344,6 +344,7 @@ enum {
IFLA_BRPORT_ISOLATED,
IFLA_BRPORT_BACKUP_PORT,
IFLA_BRPORT_MRP_RING_OPEN,
IFLA_BRPORT_MRP_IN_OPEN,
__IFLA_BRPORT_MAX
};
#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
......
......@@ -21,11 +21,22 @@ enum br_mrp_ring_role_type {
BR_MRP_RING_ROLE_MRA,
};
enum br_mrp_in_role_type {
BR_MRP_IN_ROLE_DISABLED,
BR_MRP_IN_ROLE_MIC,
BR_MRP_IN_ROLE_MIM,
};
enum br_mrp_ring_state_type {
BR_MRP_RING_STATE_OPEN,
BR_MRP_RING_STATE_CLOSED,
};
enum br_mrp_in_state_type {
BR_MRP_IN_STATE_OPEN,
BR_MRP_IN_STATE_CLOSED,
};
enum br_mrp_port_state_type {
BR_MRP_PORT_STATE_DISABLED,
BR_MRP_PORT_STATE_BLOCKED,
......@@ -36,6 +47,7 @@ enum br_mrp_port_state_type {
enum br_mrp_port_role_type {
BR_MRP_PORT_ROLE_PRIMARY,
BR_MRP_PORT_ROLE_SECONDARY,
BR_MRP_PORT_ROLE_INTER,
};
enum br_mrp_tlv_header_type {
......@@ -45,6 +57,10 @@ enum br_mrp_tlv_header_type {
BR_MRP_TLV_HEADER_RING_TOPO = 0x3,
BR_MRP_TLV_HEADER_RING_LINK_DOWN = 0x4,
BR_MRP_TLV_HEADER_RING_LINK_UP = 0x5,
BR_MRP_TLV_HEADER_IN_TEST = 0x6,
BR_MRP_TLV_HEADER_IN_TOPO = 0x7,
BR_MRP_TLV_HEADER_IN_LINK_DOWN = 0x8,
BR_MRP_TLV_HEADER_IN_LINK_UP = 0x9,
BR_MRP_TLV_HEADER_OPTION = 0x7f,
};
......@@ -118,4 +134,26 @@ struct br_mrp_oui_hdr {
__u8 oui[MRP_OUI_LENGTH];
};
struct br_mrp_in_test_hdr {
__be16 id;
__u8 sa[ETH_ALEN];
__be16 port_role;
__be16 state;
__be16 transitions;
__be32 timestamp;
};
struct br_mrp_in_topo_hdr {
__u8 sa[ETH_ALEN];
__be16 id;
__be16 interval;
};
struct br_mrp_in_link_hdr {
__u8 sa[ETH_ALEN];
__be16 port_role;
__be16 id;
__be16 interval;
};
#endif
This diff is collapsed.
......@@ -14,6 +14,9 @@ static const struct nla_policy br_mrp_policy[IFLA_BRIDGE_MRP_MAX + 1] = {
[IFLA_BRIDGE_MRP_RING_STATE] = { .type = NLA_NESTED },
[IFLA_BRIDGE_MRP_RING_ROLE] = { .type = NLA_NESTED },
[IFLA_BRIDGE_MRP_START_TEST] = { .type = NLA_NESTED },
[IFLA_BRIDGE_MRP_IN_ROLE] = { .type = NLA_NESTED },
[IFLA_BRIDGE_MRP_IN_STATE] = { .type = NLA_NESTED },
[IFLA_BRIDGE_MRP_START_IN_TEST] = { .type = NLA_NESTED },
};
static const struct nla_policy
......@@ -235,6 +238,121 @@ static int br_mrp_start_test_parse(struct net_bridge *br, struct nlattr *attr,
return br_mrp_start_test(br, &test);
}
static const struct nla_policy
br_mrp_in_state_policy[IFLA_BRIDGE_MRP_IN_STATE_MAX + 1] = {
[IFLA_BRIDGE_MRP_IN_STATE_UNSPEC] = { .type = NLA_REJECT },
[IFLA_BRIDGE_MRP_IN_STATE_IN_ID] = { .type = NLA_U32 },
[IFLA_BRIDGE_MRP_IN_STATE_STATE] = { .type = NLA_U32 },
};
static int br_mrp_in_state_parse(struct net_bridge *br, struct nlattr *attr,
struct netlink_ext_ack *extack)
{
struct nlattr *tb[IFLA_BRIDGE_MRP_IN_STATE_MAX + 1];
struct br_mrp_in_state state;
int err;
err = nla_parse_nested(tb, IFLA_BRIDGE_MRP_IN_STATE_MAX, attr,
br_mrp_in_state_policy, extack);
if (err)
return err;
if (!tb[IFLA_BRIDGE_MRP_IN_STATE_IN_ID] ||
!tb[IFLA_BRIDGE_MRP_IN_STATE_STATE]) {
NL_SET_ERR_MSG_MOD(extack,
"Missing attribute: IN_ID or STATE");
return -EINVAL;
}
memset(&state, 0x0, sizeof(state));
state.in_id = nla_get_u32(tb[IFLA_BRIDGE_MRP_IN_STATE_IN_ID]);
state.in_state = nla_get_u32(tb[IFLA_BRIDGE_MRP_IN_STATE_STATE]);
return br_mrp_set_in_state(br, &state);
}
static const struct nla_policy
br_mrp_in_role_policy[IFLA_BRIDGE_MRP_IN_ROLE_MAX + 1] = {
[IFLA_BRIDGE_MRP_IN_ROLE_UNSPEC] = { .type = NLA_REJECT },
[IFLA_BRIDGE_MRP_IN_ROLE_RING_ID] = { .type = NLA_U32 },
[IFLA_BRIDGE_MRP_IN_ROLE_IN_ID] = { .type = NLA_U16 },
[IFLA_BRIDGE_MRP_IN_ROLE_ROLE] = { .type = NLA_U32 },
[IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX] = { .type = NLA_U32 },
};
static int br_mrp_in_role_parse(struct net_bridge *br, struct nlattr *attr,
struct netlink_ext_ack *extack)
{
struct nlattr *tb[IFLA_BRIDGE_MRP_IN_ROLE_MAX + 1];
struct br_mrp_in_role role;
int err;
err = nla_parse_nested(tb, IFLA_BRIDGE_MRP_IN_ROLE_MAX, attr,
br_mrp_in_role_policy, extack);
if (err)
return err;
if (!tb[IFLA_BRIDGE_MRP_IN_ROLE_RING_ID] ||
!tb[IFLA_BRIDGE_MRP_IN_ROLE_IN_ID] ||
!tb[IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX] ||
!tb[IFLA_BRIDGE_MRP_IN_ROLE_ROLE]) {
NL_SET_ERR_MSG_MOD(extack,
"Missing attribute: RING_ID or ROLE or IN_ID or I_IFINDEX");
return -EINVAL;
}
memset(&role, 0x0, sizeof(role));
role.ring_id = nla_get_u32(tb[IFLA_BRIDGE_MRP_IN_ROLE_RING_ID]);
role.in_id = nla_get_u16(tb[IFLA_BRIDGE_MRP_IN_ROLE_IN_ID]);
role.i_ifindex = nla_get_u32(tb[IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX]);
role.in_role = nla_get_u32(tb[IFLA_BRIDGE_MRP_IN_ROLE_ROLE]);
return br_mrp_set_in_role(br, &role);
}
static const struct nla_policy
br_mrp_start_in_test_policy[IFLA_BRIDGE_MRP_START_IN_TEST_MAX + 1] = {
[IFLA_BRIDGE_MRP_START_IN_TEST_UNSPEC] = { .type = NLA_REJECT },
[IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID] = { .type = NLA_U32 },
[IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL] = { .type = NLA_U32 },
[IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS] = { .type = NLA_U32 },
[IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD] = { .type = NLA_U32 },
};
static int br_mrp_start_in_test_parse(struct net_bridge *br,
struct nlattr *attr,
struct netlink_ext_ack *extack)
{
struct nlattr *tb[IFLA_BRIDGE_MRP_START_IN_TEST_MAX + 1];
struct br_mrp_start_in_test test;
int err;
err = nla_parse_nested(tb, IFLA_BRIDGE_MRP_START_IN_TEST_MAX, attr,
br_mrp_start_in_test_policy, extack);
if (err)
return err;
if (!tb[IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID] ||
!tb[IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL] ||
!tb[IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS] ||
!tb[IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD]) {
NL_SET_ERR_MSG_MOD(extack,
"Missing attribute: RING_ID or INTERVAL or MAX_MISS or PERIOD");
return -EINVAL;
}
memset(&test, 0x0, sizeof(test));
test.in_id = nla_get_u32(tb[IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID]);
test.interval = nla_get_u32(tb[IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL]);
test.max_miss = nla_get_u32(tb[IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS]);
test.period = nla_get_u32(tb[IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD]);
return br_mrp_start_in_test(br, &test);
}
int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p,
struct nlattr *attr, int cmd, struct netlink_ext_ack *extack)
{
......@@ -301,6 +419,28 @@ int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p,
return err;
}
if (tb[IFLA_BRIDGE_MRP_IN_STATE]) {
err = br_mrp_in_state_parse(br, tb[IFLA_BRIDGE_MRP_IN_STATE],
extack);
if (err)
return err;
}
if (tb[IFLA_BRIDGE_MRP_IN_ROLE]) {
err = br_mrp_in_role_parse(br, tb[IFLA_BRIDGE_MRP_IN_ROLE],
extack);
if (err)
return err;
}
if (tb[IFLA_BRIDGE_MRP_START_IN_TEST]) {
err = br_mrp_start_in_test_parse(br,
tb[IFLA_BRIDGE_MRP_START_IN_TEST],
extack);
if (err)
return err;
}
return 0;
}
......@@ -334,6 +474,11 @@ int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br)
p->dev->ifindex))
goto nla_put_failure;
p = rcu_dereference(mrp->i_port);
if (p && nla_put_u32(skb, IFLA_BRIDGE_MRP_INFO_I_IFINDEX,
p->dev->ifindex))
goto nla_put_failure;
if (nla_put_u16(skb, IFLA_BRIDGE_MRP_INFO_PRIO,
mrp->prio))
goto nla_put_failure;
......@@ -353,6 +498,19 @@ int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br)
mrp->test_monitor))
goto nla_put_failure;
if (nla_put_u32(skb, IFLA_BRIDGE_MRP_INFO_IN_STATE,
mrp->in_state))
goto nla_put_failure;
if (nla_put_u32(skb, IFLA_BRIDGE_MRP_INFO_IN_ROLE,
mrp->in_role))
goto nla_put_failure;
if (nla_put_u32(skb, IFLA_BRIDGE_MRP_INFO_IN_TEST_INTERVAL,
mrp->in_test_interval))
goto nla_put_failure;
if (nla_put_u32(skb, IFLA_BRIDGE_MRP_INFO_IN_TEST_MAX_MISS,
mrp->in_test_max_miss))
goto nla_put_failure;
nla_nest_end(skb, tb);
}
nla_nest_end(skb, mrp_tb);
......@@ -368,7 +526,7 @@ int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br)
return -EMSGSIZE;
}
int br_mrp_port_open(struct net_device *dev, u8 loc)
int br_mrp_ring_port_open(struct net_device *dev, u8 loc)
{
struct net_bridge_port *p;
int err = 0;
......@@ -389,3 +547,25 @@ int br_mrp_port_open(struct net_device *dev, u8 loc)
out:
return err;
}
int br_mrp_in_port_open(struct net_device *dev, u8 loc)
{
struct net_bridge_port *p;
int err = 0;
p = br_port_get_rcu(dev);
if (!p) {
err = -EINVAL;
goto out;
}
if (loc)
p->flags |= BR_MRP_LOST_IN_CONT;
else
p->flags &= ~BR_MRP_LOST_IN_CONT;
br_ifinfo_notify(RTM_NEWLINK, NULL, p);
out:
return err;
}
......@@ -107,6 +107,68 @@ int br_mrp_switchdev_set_ring_state(struct net_bridge *br,
return 0;
}
int br_mrp_switchdev_set_in_role(struct net_bridge *br, struct br_mrp *mrp,
u16 in_id, u32 ring_id,
enum br_mrp_in_role_type role)
{
struct switchdev_obj_in_role_mrp mrp_role = {
.obj.orig_dev = br->dev,
.obj.id = SWITCHDEV_OBJ_ID_IN_ROLE_MRP,
.in_role = role,
.in_id = mrp->in_id,
.ring_id = mrp->ring_id,
.i_port = rtnl_dereference(mrp->i_port)->dev,
};
int err;
if (role == BR_MRP_IN_ROLE_DISABLED)
err = switchdev_port_obj_del(br->dev, &mrp_role.obj);
else
err = switchdev_port_obj_add(br->dev, &mrp_role.obj, NULL);
return err;
}
int br_mrp_switchdev_set_in_state(struct net_bridge *br, struct br_mrp *mrp,
enum br_mrp_in_state_type state)
{
struct switchdev_obj_in_state_mrp mrp_state = {
.obj.orig_dev = br->dev,
.obj.id = SWITCHDEV_OBJ_ID_IN_STATE_MRP,
.in_state = state,
.in_id = mrp->in_id,
};
int err;
err = switchdev_port_obj_add(br->dev, &mrp_state.obj, NULL);
if (err && err != -EOPNOTSUPP)
return err;
return 0;
}
int br_mrp_switchdev_send_in_test(struct net_bridge *br, struct br_mrp *mrp,
u32 interval, u8 max_miss, u32 period)
{
struct switchdev_obj_in_test_mrp test = {
.obj.orig_dev = br->dev,
.obj.id = SWITCHDEV_OBJ_ID_IN_TEST_MRP,
.interval = interval,
.max_miss = max_miss,
.in_id = mrp->in_id,
.period = period,
};
int err;
if (interval == 0)
err = switchdev_port_obj_del(br->dev, &test.obj);
else
err = switchdev_port_obj_add(br->dev, &test.obj, NULL);
return err;
}
int br_mrp_port_switchdev_set_state(struct net_bridge_port *p,
enum br_mrp_port_state_type state)
{
......
......@@ -152,6 +152,7 @@ static inline size_t br_port_info_size(void)
#endif
+ nla_total_size(sizeof(u16)) /* IFLA_BRPORT_GROUP_FWD_MASK */
+ nla_total_size(sizeof(u8)) /* IFLA_BRPORT_MRP_RING_OPEN */
+ nla_total_size(sizeof(u8)) /* IFLA_BRPORT_MRP_IN_OPEN */
+ 0;
}
......@@ -216,6 +217,8 @@ static int br_port_fill_attrs(struct sk_buff *skb,
!!(p->flags & BR_NEIGH_SUPPRESS)) ||
nla_put_u8(skb, IFLA_BRPORT_MRP_RING_OPEN, !!(p->flags &
BR_MRP_LOST_CONT)) ||
nla_put_u8(skb, IFLA_BRPORT_MRP_IN_OPEN,
!!(p->flags & BR_MRP_LOST_IN_CONT)) ||
nla_put_u8(skb, IFLA_BRPORT_ISOLATED, !!(p->flags & BR_ISOLATED)))
return -EMSGSIZE;
......
......@@ -12,8 +12,10 @@ struct br_mrp {
struct net_bridge_port __rcu *p_port;
struct net_bridge_port __rcu *s_port;
struct net_bridge_port __rcu *i_port;
u32 ring_id;
u16 in_id;
u16 prio;
enum br_mrp_ring_role_type ring_role;
......@@ -21,6 +23,11 @@ struct br_mrp {
enum br_mrp_ring_state_type ring_state;
u32 ring_transitions;
enum br_mrp_in_role_type in_role;
u8 in_role_offloaded;
enum br_mrp_in_state_type in_state;
u32 in_transitions;
struct delayed_work test_work;
u32 test_interval;
unsigned long test_end;
......@@ -28,6 +35,12 @@ struct br_mrp {
u32 test_max_miss;
bool test_monitor;
struct delayed_work in_test_work;
u32 in_test_interval;
unsigned long in_test_end;
u32 in_test_count_miss;
u32 in_test_max_miss;
u32 seq_id;
struct rcu_head rcu;
......@@ -44,6 +57,10 @@ int br_mrp_set_ring_state(struct net_bridge *br,
struct br_mrp_ring_state *state);
int br_mrp_set_ring_role(struct net_bridge *br, struct br_mrp_ring_role *role);
int br_mrp_start_test(struct net_bridge *br, struct br_mrp_start_test *test);
int br_mrp_set_in_state(struct net_bridge *br, struct br_mrp_in_state *state);
int br_mrp_set_in_role(struct net_bridge *br, struct br_mrp_in_role *role);
int br_mrp_start_in_test(struct net_bridge *br,
struct br_mrp_start_in_test *test);
/* br_mrp_switchdev.c */
int br_mrp_switchdev_add(struct net_bridge *br, struct br_mrp *mrp);
......@@ -59,8 +76,16 @@ int br_mrp_port_switchdev_set_state(struct net_bridge_port *p,
enum br_mrp_port_state_type state);
int br_mrp_port_switchdev_set_role(struct net_bridge_port *p,
enum br_mrp_port_role_type role);
int br_mrp_switchdev_set_in_role(struct net_bridge *br, struct br_mrp *mrp,
u16 in_id, u32 ring_id,
enum br_mrp_in_role_type role);
int br_mrp_switchdev_set_in_state(struct net_bridge *br, struct br_mrp *mrp,
enum br_mrp_in_state_type state);
int br_mrp_switchdev_send_in_test(struct net_bridge *br, struct br_mrp *mrp,
u32 interval, u8 max_miss, u32 period);
/* br_mrp_netlink.c */
int br_mrp_port_open(struct net_device *dev, u8 loc);
int br_mrp_ring_port_open(struct net_device *dev, u8 loc);
int br_mrp_in_port_open(struct net_device *dev, u8 loc);
#endif /* _BR_PRIVATE_MRP_H */
......@@ -344,6 +344,7 @@ enum {
IFLA_BRPORT_ISOLATED,
IFLA_BRPORT_BACKUP_PORT,
IFLA_BRPORT_MRP_RING_OPEN,
IFLA_BRPORT_MRP_IN_OPEN,
__IFLA_BRPORT_MAX
};
#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
......
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