Merge branch 'tipc-Confgiuration-of-MTU-for-media-UDP'
GhantaKrishnamurthy MohanKrishna says: ==================== tipc: Confgiuration of MTU for media UDP Systematic measurements have shown that an emulated MTU of 14k for UDP bearers is the optimal value for maximal throughput. Accordingly, the default MTU of UDP bearers is changed to 14k. We also provide users with a fallback option from this value, by providing support to configure MTU for UDP bearers. The following options are introduced which are symmetrical to the design of confguring link tolerance. - Configure media with new MTU value, which will take effect on links going up after the moment it was configured. Alternatively, the bearer has to be disabled and re-enabled, for existing links to reflect the configured value. - Configure bearer with new MTU value, which take effect on running links dynamically. Please note: - User has to change MTU at both endpoints, otherwise the link will fall back to smallest MTU after a reset. - Failover from a link with higher MTU to a link with lower MTU ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
ddf967bb6b
@ -185,6 +185,11 @@
|
||||
#define TIPC_DEF_LINK_WIN 50
|
||||
#define TIPC_MAX_LINK_WIN 8191
|
||||
|
||||
/*
|
||||
* Default MTU for UDP media
|
||||
*/
|
||||
|
||||
#define TIPC_DEF_LINK_UDP_MTU 14000
|
||||
|
||||
struct tipc_node_info {
|
||||
__be32 addr; /* network address of node */
|
||||
|
@ -266,6 +266,7 @@ enum {
|
||||
TIPC_NLA_PROP_PRIO, /* u32 */
|
||||
TIPC_NLA_PROP_TOL, /* u32 */
|
||||
TIPC_NLA_PROP_WIN, /* u32 */
|
||||
TIPC_NLA_PROP_MTU, /* u32 */
|
||||
|
||||
__TIPC_NLA_PROP_MAX,
|
||||
TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1
|
||||
|
@ -697,6 +697,9 @@ static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg,
|
||||
goto prop_msg_full;
|
||||
if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, bearer->window))
|
||||
goto prop_msg_full;
|
||||
if (bearer->media->type_id == TIPC_MEDIA_TYPE_UDP)
|
||||
if (nla_put_u32(msg->skb, TIPC_NLA_PROP_MTU, bearer->mtu))
|
||||
goto prop_msg_full;
|
||||
|
||||
nla_nest_end(msg->skb, prop);
|
||||
|
||||
@ -979,12 +982,23 @@ int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
if (props[TIPC_NLA_PROP_TOL]) {
|
||||
b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]);
|
||||
tipc_node_apply_tolerance(net, b);
|
||||
tipc_node_apply_property(net, b, TIPC_NLA_PROP_TOL);
|
||||
}
|
||||
if (props[TIPC_NLA_PROP_PRIO])
|
||||
b->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]);
|
||||
if (props[TIPC_NLA_PROP_WIN])
|
||||
b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]);
|
||||
if (props[TIPC_NLA_PROP_MTU]) {
|
||||
if (b->media->type_id != TIPC_MEDIA_TYPE_UDP)
|
||||
return -EINVAL;
|
||||
#ifdef CONFIG_TIPC_MEDIA_UDP
|
||||
if (tipc_udp_mtu_bad(nla_get_u32
|
||||
(props[TIPC_NLA_PROP_MTU])))
|
||||
return -EINVAL;
|
||||
b->mtu = nla_get_u32(props[TIPC_NLA_PROP_MTU]);
|
||||
tipc_node_apply_property(net, b, TIPC_NLA_PROP_MTU);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1029,6 +1043,9 @@ static int __tipc_nl_add_media(struct tipc_nl_msg *msg,
|
||||
goto prop_msg_full;
|
||||
if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, media->window))
|
||||
goto prop_msg_full;
|
||||
if (media->type_id == TIPC_MEDIA_TYPE_UDP)
|
||||
if (nla_put_u32(msg->skb, TIPC_NLA_PROP_MTU, media->mtu))
|
||||
goto prop_msg_full;
|
||||
|
||||
nla_nest_end(msg->skb, prop);
|
||||
nla_nest_end(msg->skb, attrs);
|
||||
@ -1158,6 +1175,16 @@ int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)
|
||||
m->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]);
|
||||
if (props[TIPC_NLA_PROP_WIN])
|
||||
m->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]);
|
||||
if (props[TIPC_NLA_PROP_MTU]) {
|
||||
if (m->type_id != TIPC_MEDIA_TYPE_UDP)
|
||||
return -EINVAL;
|
||||
#ifdef CONFIG_TIPC_MEDIA_UDP
|
||||
if (tipc_udp_mtu_bad(nla_get_u32
|
||||
(props[TIPC_NLA_PROP_MTU])))
|
||||
return -EINVAL;
|
||||
m->mtu = nla_get_u32(props[TIPC_NLA_PROP_MTU]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -94,6 +94,8 @@ struct tipc_bearer;
|
||||
* @priority: default link (and bearer) priority
|
||||
* @tolerance: default time (in ms) before declaring link failure
|
||||
* @window: default window (in packets) before declaring link congestion
|
||||
* @mtu: max packet size bearer can support for media type not dependent on
|
||||
* underlying device MTU
|
||||
* @type_id: TIPC media identifier
|
||||
* @hwaddr_len: TIPC media address len
|
||||
* @name: media name
|
||||
@ -118,6 +120,7 @@ struct tipc_media {
|
||||
u32 priority;
|
||||
u32 tolerance;
|
||||
u32 window;
|
||||
u32 mtu;
|
||||
u32 type_id;
|
||||
u32 hwaddr_len;
|
||||
char name[TIPC_MAX_MEDIA_NAME];
|
||||
|
@ -1681,7 +1681,8 @@ discard:
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
||||
void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b)
|
||||
void tipc_node_apply_property(struct net *net, struct tipc_bearer *b,
|
||||
int prop)
|
||||
{
|
||||
struct tipc_net *tn = tipc_net(net);
|
||||
int bearer_id = b->identity;
|
||||
@ -1696,8 +1697,13 @@ void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b)
|
||||
list_for_each_entry_rcu(n, &tn->node_list, list) {
|
||||
tipc_node_write_lock(n);
|
||||
e = &n->links[bearer_id];
|
||||
if (e->link)
|
||||
tipc_link_set_tolerance(e->link, b->tolerance, &xmitq);
|
||||
if (e->link) {
|
||||
if (prop == TIPC_NLA_PROP_TOL)
|
||||
tipc_link_set_tolerance(e->link, b->tolerance,
|
||||
&xmitq);
|
||||
else if (prop == TIPC_NLA_PROP_MTU)
|
||||
tipc_link_set_mtu(e->link, b->mtu);
|
||||
}
|
||||
tipc_node_write_unlock(n);
|
||||
tipc_bearer_xmit(net, bearer_id, &xmitq, &e->maddr);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ void tipc_node_check_dest(struct net *net, u32 onode, u8 *peer_id128,
|
||||
struct tipc_media_addr *maddr,
|
||||
bool *respond, bool *dupl_addr);
|
||||
void tipc_node_delete_links(struct net *net, int bearer_id);
|
||||
void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b);
|
||||
void tipc_node_apply_property(struct net *net, struct tipc_bearer *b, int prop);
|
||||
int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node,
|
||||
char *linkname, size_t len);
|
||||
int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,
|
||||
|
@ -713,8 +713,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
|
||||
err = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
b->mtu = dev->mtu - sizeof(struct iphdr)
|
||||
- sizeof(struct udphdr);
|
||||
b->mtu = b->media->mtu;
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
} else if (local.proto == htons(ETH_P_IPV6)) {
|
||||
udp_conf.family = AF_INET6;
|
||||
@ -803,6 +802,7 @@ struct tipc_media udp_media_info = {
|
||||
.priority = TIPC_DEF_LINK_PRI,
|
||||
.tolerance = TIPC_DEF_LINK_TOL,
|
||||
.window = TIPC_DEF_LINK_WIN,
|
||||
.mtu = TIPC_DEF_LINK_UDP_MTU,
|
||||
.type_id = TIPC_MEDIA_TYPE_UDP,
|
||||
.hwaddr_len = 0,
|
||||
.name = "udp"
|
||||
|
@ -38,9 +38,23 @@
|
||||
#ifndef _TIPC_UDP_MEDIA_H
|
||||
#define _TIPC_UDP_MEDIA_H
|
||||
|
||||
#include <linux/ip.h>
|
||||
#include <linux/udp.h>
|
||||
|
||||
int tipc_udp_nl_bearer_add(struct tipc_bearer *b, struct nlattr *attr);
|
||||
int tipc_udp_nl_add_bearer_data(struct tipc_nl_msg *msg, struct tipc_bearer *b);
|
||||
int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb);
|
||||
|
||||
/* check if configured MTU is too low for tipc headers */
|
||||
static inline bool tipc_udp_mtu_bad(u32 mtu)
|
||||
{
|
||||
if (mtu >= (TIPC_MIN_BEARER_MTU + sizeof(struct iphdr) +
|
||||
sizeof(struct udphdr)))
|
||||
return false;
|
||||
|
||||
pr_warn("MTU too low for tipc bearer\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user