Skip to content

Commit 682cd3c

Browse files
GhantaKrishnamurthy MohanKrishnadavem330
authored andcommitted
tipc: confgiure and apply UDP bearer MTU on running links
Currently, we have option to configure MTU of UDP media. The configured MTU takes effect on the links going up after that moment. I.e, a user has to reset bearer to have new value applied across its links. This is confusing and disturbing on a running cluster. We now introduce the functionality to change the default UDP bearer MTU in struct tipc_bearer. Additionally, the links are updated dynamically, without any need for a reset, when bearer value is changed. We leverage the existing per-link functionality and the design being symetrical to the confguration of link tolerance. Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 901271e commit 682cd3c

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

net/tipc/bearer.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,9 @@ static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg,
697697
goto prop_msg_full;
698698
if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, bearer->window))
699699
goto prop_msg_full;
700+
if (bearer->media->type_id == TIPC_MEDIA_TYPE_UDP)
701+
if (nla_put_u32(msg->skb, TIPC_NLA_PROP_MTU, bearer->mtu))
702+
goto prop_msg_full;
700703

701704
nla_nest_end(msg->skb, prop);
702705

@@ -979,12 +982,23 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
979982

980983
if (props[TIPC_NLA_PROP_TOL]) {
981984
b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]);
982-
tipc_node_apply_tolerance(net, b);
985+
tipc_node_apply_property(net, b, TIPC_NLA_PROP_TOL);
983986
}
984987
if (props[TIPC_NLA_PROP_PRIO])
985988
b->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]);
986989
if (props[TIPC_NLA_PROP_WIN])
987990
b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]);
991+
if (props[TIPC_NLA_PROP_MTU]) {
992+
if (b->media->type_id != TIPC_MEDIA_TYPE_UDP)
993+
return -EINVAL;
994+
#ifdef CONFIG_TIPC_MEDIA_UDP
995+
if (tipc_udp_mtu_bad(nla_get_u32
996+
(props[TIPC_NLA_PROP_MTU])))
997+
return -EINVAL;
998+
b->mtu = nla_get_u32(props[TIPC_NLA_PROP_MTU]);
999+
tipc_node_apply_property(net, b, TIPC_NLA_PROP_MTU);
1000+
#endif
1001+
}
9881002
}
9891003

9901004
return 0;

net/tipc/node.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,8 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
16811681
kfree_skb(skb);
16821682
}
16831683

1684-
void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b)
1684+
void tipc_node_apply_property(struct net *net, struct tipc_bearer *b,
1685+
int prop)
16851686
{
16861687
struct tipc_net *tn = tipc_net(net);
16871688
int bearer_id = b->identity;
@@ -1696,8 +1697,13 @@ void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b)
16961697
list_for_each_entry_rcu(n, &tn->node_list, list) {
16971698
tipc_node_write_lock(n);
16981699
e = &n->links[bearer_id];
1699-
if (e->link)
1700-
tipc_link_set_tolerance(e->link, b->tolerance, &xmitq);
1700+
if (e->link) {
1701+
if (prop == TIPC_NLA_PROP_TOL)
1702+
tipc_link_set_tolerance(e->link, b->tolerance,
1703+
&xmitq);
1704+
else if (prop == TIPC_NLA_PROP_MTU)
1705+
tipc_link_set_mtu(e->link, b->mtu);
1706+
}
17011707
tipc_node_write_unlock(n);
17021708
tipc_bearer_xmit(net, bearer_id, &xmitq, &e->maddr);
17031709
}

net/tipc/node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void tipc_node_check_dest(struct net *net, u32 onode, u8 *peer_id128,
6767
struct tipc_media_addr *maddr,
6868
bool *respond, bool *dupl_addr);
6969
void tipc_node_delete_links(struct net *net, int bearer_id);
70-
void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b);
70+
void tipc_node_apply_property(struct net *net, struct tipc_bearer *b, int prop);
7171
int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node,
7272
char *linkname, size_t len);
7373
int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,

0 commit comments

Comments
 (0)