netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next  0/3] tipc: Confgiuration of MTU for media UDP
@ 2018-04-19  9:06 GhantaKrishnamurthy MohanKrishna
  2018-04-19  9:06 ` [net-next 1/3] tipc: set default MTU for UDP media GhantaKrishnamurthy MohanKrishna
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: GhantaKrishnamurthy MohanKrishna @ 2018-04-19  9:06 UTC (permalink / raw)
  To: tipc-discussion, jon.maloy, maloy, ying.xue,
	mohan.krishna.ghanta.krishnamurthy, netdev, davem

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

GhantaKrishnamurthy MohanKrishna (3):
  tipc: set default MTU for UDP media
  tipc: implement configuration of UDP media MTU
  tipc: confgiure and apply UDP bearer MTU on running links

 include/uapi/linux/tipc_config.h  |  5 +++++
 include/uapi/linux/tipc_netlink.h |  1 +
 net/tipc/bearer.c                 | 29 ++++++++++++++++++++++++++++-
 net/tipc/bearer.h                 |  3 +++
 net/tipc/node.c                   | 12 +++++++++---
 net/tipc/node.h                   |  2 +-
 net/tipc/udp_media.c              |  4 ++--
 net/tipc/udp_media.h              | 14 ++++++++++++++
 8 files changed, 63 insertions(+), 7 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [net-next  1/3] tipc: set default MTU for UDP media
  2018-04-19  9:06 [net-next 0/3] tipc: Confgiuration of MTU for media UDP GhantaKrishnamurthy MohanKrishna
@ 2018-04-19  9:06 ` GhantaKrishnamurthy MohanKrishna
  2018-04-20 15:22   ` kbuild test robot
  2018-04-20 16:06   ` kbuild test robot
  2018-04-19  9:06 ` [net-next 2/3] tipc: implement configuration of UDP media MTU GhantaKrishnamurthy MohanKrishna
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: GhantaKrishnamurthy MohanKrishna @ 2018-04-19  9:06 UTC (permalink / raw)
  To: tipc-discussion, jon.maloy, maloy, ying.xue,
	mohan.krishna.ghanta.krishnamurthy, netdev, davem

Currently, all bearers are configured with MTU value same as the
underlying L2 device. However, in case of bearers with media type
UDP, higher throughput is possible with a fixed and higher emulated
MTU value than adapting to the underlying L2 MTU.

In this commit, we introduce a parameter mtu in struct tipc_media
and a default value is set for UDP. A default value of 14k
was determined by experimentation and found to have a higher throughput
than 16k. MTU for UDP bearers are assigned the above set value of
media MTU.

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
---
 include/uapi/linux/tipc_config.h | 5 +++++
 net/tipc/udp_media.c             | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 3f29e3c8ed06..4b2c93b1934c 100644
--- a/include/uapi/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
@@ -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 */
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index e7d91f5d5cae..9783101bc4a9 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -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"
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [net-next  2/3] tipc: implement configuration of UDP media MTU
  2018-04-19  9:06 [net-next 0/3] tipc: Confgiuration of MTU for media UDP GhantaKrishnamurthy MohanKrishna
  2018-04-19  9:06 ` [net-next 1/3] tipc: set default MTU for UDP media GhantaKrishnamurthy MohanKrishna
@ 2018-04-19  9:06 ` GhantaKrishnamurthy MohanKrishna
  2018-04-19  9:06 ` [net-next 3/3] tipc: confgiure and apply UDP bearer MTU on running links GhantaKrishnamurthy MohanKrishna
  2018-04-20 15:04 ` [net-next 0/3] tipc: Confgiuration of MTU for media UDP David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: GhantaKrishnamurthy MohanKrishna @ 2018-04-19  9:06 UTC (permalink / raw)
  To: tipc-discussion, jon.maloy, maloy, ying.xue,
	mohan.krishna.ghanta.krishnamurthy, netdev, davem

In previous commit, we changed the default emulated MTU for UDP bearers
to 14k.

This commit adds the functionality to set/change the default value
by configuring new MTU for UDP media. UDP bearer(s) have to be disabled
and enabled back for the new MTU to take effect.

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
---
 include/uapi/linux/tipc_netlink.h |  1 +
 net/tipc/bearer.c                 | 13 +++++++++++++
 net/tipc/bearer.h                 |  3 +++
 net/tipc/udp_media.h              | 14 ++++++++++++++
 4 files changed, 31 insertions(+)

diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h
index 0affb682e5e3..85c11982c89b 100644
--- a/include/uapi/linux/tipc_netlink.h
+++ b/include/uapi/linux/tipc_netlink.h
@@ -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
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index f7d47c89d658..a22caf9e5a18 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -1029,6 +1029,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 +1161,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;
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 6efcee63a381..394290cbbb1d 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -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];
diff --git a/net/tipc/udp_media.h b/net/tipc/udp_media.h
index 281bbae87726..e7455cc73e16 100644
--- a/net/tipc/udp_media.h
+++ b/net/tipc/udp_media.h
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [net-next  3/3] tipc: confgiure and apply UDP bearer MTU on running links
  2018-04-19  9:06 [net-next 0/3] tipc: Confgiuration of MTU for media UDP GhantaKrishnamurthy MohanKrishna
  2018-04-19  9:06 ` [net-next 1/3] tipc: set default MTU for UDP media GhantaKrishnamurthy MohanKrishna
  2018-04-19  9:06 ` [net-next 2/3] tipc: implement configuration of UDP media MTU GhantaKrishnamurthy MohanKrishna
@ 2018-04-19  9:06 ` GhantaKrishnamurthy MohanKrishna
  2018-04-20 15:04 ` [net-next 0/3] tipc: Confgiuration of MTU for media UDP David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: GhantaKrishnamurthy MohanKrishna @ 2018-04-19  9:06 UTC (permalink / raw)
  To: tipc-discussion, jon.maloy, maloy, ying.xue,
	mohan.krishna.ghanta.krishnamurthy, netdev, davem

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>
---
 net/tipc/bearer.c | 16 +++++++++++++++-
 net/tipc/node.c   | 12 +++++++++---
 net/tipc/node.h   |  2 +-
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index a22caf9e5a18..2dfb492a7c94 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -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;
diff --git a/net/tipc/node.c b/net/tipc/node.c
index c77dd2f3c589..b71e4e376bb9 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1681,7 +1681,8 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
 	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);
 	}
diff --git a/net/tipc/node.h b/net/tipc/node.h
index f24b83500df1..bb271a37c93f 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -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,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [net-next 0/3] tipc: Confgiuration of MTU for media UDP
  2018-04-19  9:06 [net-next 0/3] tipc: Confgiuration of MTU for media UDP GhantaKrishnamurthy MohanKrishna
                   ` (2 preceding siblings ...)
  2018-04-19  9:06 ` [net-next 3/3] tipc: confgiure and apply UDP bearer MTU on running links GhantaKrishnamurthy MohanKrishna
@ 2018-04-20 15:04 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-04-20 15:04 UTC (permalink / raw)
  To: mohan.krishna.ghanta.krishnamurthy
  Cc: tipc-discussion, jon.maloy, maloy, ying.xue, netdev

From: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
Date: Thu, 19 Apr 2018 11:06:17 +0200

> 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

There are many negatives to using UDP in a way which causes
fragmentation, like this code now does.

But whatever, you guys can do whatever you want and get to keep the
pieces I guess :-)

Series applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [net-next 1/3] tipc: set default MTU for UDP media
  2018-04-19  9:06 ` [net-next 1/3] tipc: set default MTU for UDP media GhantaKrishnamurthy MohanKrishna
@ 2018-04-20 15:22   ` kbuild test robot
  2018-04-20 16:06   ` kbuild test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-04-20 15:22 UTC (permalink / raw)
  To: GhantaKrishnamurthy MohanKrishna
  Cc: kbuild-all, tipc-discussion, jon.maloy, maloy, ying.xue,
	mohan.krishna.ghanta.krishnamurthy, netdev, davem

[-- Attachment #1: Type: text/plain, Size: 5389 bytes --]

Hi GhantaKrishnamurthy,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/GhantaKrishnamurthy-MohanKrishna/tipc-Confgiuration-of-MTU-for-media-UDP/20180420-224412
config: x86_64-randconfig-x018-201815 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: the linux-review/GhantaKrishnamurthy-MohanKrishna/tipc-Confgiuration-of-MTU-for-media-UDP/20180420-224412 HEAD 5757244a45c9114ee8a7ed60e9b074107605f6eb builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   net//tipc/udp_media.c: In function 'tipc_udp_enable':
>> net//tipc/udp_media.c:716:20: error: 'struct tipc_media' has no member named 'mtu'
      b->mtu = b->media->mtu;
                       ^~
   net//tipc/udp_media.c: At top level:
   net//tipc/udp_media.c:805:3: error: 'struct tipc_media' has no member named 'mtu'
     .mtu  = TIPC_DEF_LINK_UDP_MTU,
      ^~~

vim +716 net//tipc/udp_media.c

   632	
   633	/**
   634	 * tipc_udp_enable - callback to create a new udp bearer instance
   635	 * @net:	network namespace
   636	 * @b:		pointer to generic tipc_bearer
   637	 * @attrs:	netlink bearer configuration
   638	 *
   639	 * validate the bearer parameters and initialize the udp bearer
   640	 * rtnl_lock should be held
   641	 */
   642	static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
   643				   struct nlattr *attrs[])
   644	{
   645		int err = -EINVAL;
   646		struct udp_bearer *ub;
   647		struct udp_media_addr remote = {0};
   648		struct udp_media_addr local = {0};
   649		struct udp_port_cfg udp_conf = {0};
   650		struct udp_tunnel_sock_cfg tuncfg = {NULL};
   651		struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
   652		u8 node_id[NODE_ID_LEN] = {0,};
   653	
   654		ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
   655		if (!ub)
   656			return -ENOMEM;
   657	
   658		INIT_LIST_HEAD(&ub->rcast.list);
   659	
   660		if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
   661			goto err;
   662	
   663		if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX,
   664				     attrs[TIPC_NLA_BEARER_UDP_OPTS],
   665				     tipc_nl_udp_policy, NULL))
   666			goto err;
   667	
   668		if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
   669			pr_err("Invalid UDP bearer configuration");
   670			err = -EINVAL;
   671			goto err;
   672		}
   673	
   674		err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
   675					  &ub->ifindex);
   676		if (err)
   677			goto err;
   678	
   679		err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_REMOTE], &remote, NULL);
   680		if (err)
   681			goto err;
   682	
   683		/* Autoconfigure own node identity if needed */
   684		if (!tipc_own_id(net)) {
   685			memcpy(node_id, local.ipv6.in6_u.u6_addr8, 16);
   686			tipc_net_init(net, node_id, 0);
   687		}
   688		if (!tipc_own_id(net)) {
   689			pr_warn("Failed to set node id, please configure manually\n");
   690			err = -EINVAL;
   691			goto err;
   692		}
   693	
   694		b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP;
   695		b->bcast_addr.broadcast = TIPC_BROADCAST_SUPPORT;
   696		rcu_assign_pointer(b->media_ptr, ub);
   697		rcu_assign_pointer(ub->bearer, b);
   698		tipc_udp_media_addr_set(&b->addr, &local);
   699		if (local.proto == htons(ETH_P_IP)) {
   700			struct net_device *dev;
   701	
   702			dev = __ip_dev_find(net, local.ipv4.s_addr, false);
   703			if (!dev) {
   704				err = -ENODEV;
   705				goto err;
   706			}
   707			udp_conf.family = AF_INET;
   708			udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
   709			udp_conf.use_udp_checksums = false;
   710			ub->ifindex = dev->ifindex;
   711			if (tipc_mtu_bad(dev, sizeof(struct iphdr) +
   712					      sizeof(struct udphdr))) {
   713				err = -EINVAL;
   714				goto err;
   715			}
 > 716			b->mtu = b->media->mtu;
   717	#if IS_ENABLED(CONFIG_IPV6)
   718		} else if (local.proto == htons(ETH_P_IPV6)) {
   719			udp_conf.family = AF_INET6;
   720			udp_conf.use_udp6_tx_checksums = true;
   721			udp_conf.use_udp6_rx_checksums = true;
   722			udp_conf.local_ip6 = in6addr_any;
   723			b->mtu = 1280;
   724	#endif
   725		} else {
   726			err = -EAFNOSUPPORT;
   727			goto err;
   728		}
   729		udp_conf.local_udp_port = local.port;
   730		err = udp_sock_create(net, &udp_conf, &ub->ubsock);
   731		if (err)
   732			goto err;
   733		tuncfg.sk_user_data = ub;
   734		tuncfg.encap_type = 1;
   735		tuncfg.encap_rcv = tipc_udp_recv;
   736		tuncfg.encap_destroy = NULL;
   737		setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
   738	
   739		/**
   740		 * The bcast media address port is used for all peers and the ip
   741		 * is used if it's a multicast address.
   742		 */
   743		memcpy(&b->bcast_addr.value, &remote, sizeof(remote));
   744		if (tipc_udp_is_mcast_addr(&remote))
   745			err = enable_mcast(ub, &remote);
   746		else
   747			err = tipc_udp_rcast_add(b, &remote);
   748		if (err)
   749			goto err;
   750	
   751		return 0;
   752	err:
   753		if (ub->ubsock)
   754			udp_tunnel_sock_release(ub->ubsock);
   755		kfree(ub);
   756		return err;
   757	}
   758	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27623 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [net-next 1/3] tipc: set default MTU for UDP media
  2018-04-19  9:06 ` [net-next 1/3] tipc: set default MTU for UDP media GhantaKrishnamurthy MohanKrishna
  2018-04-20 15:22   ` kbuild test robot
@ 2018-04-20 16:06   ` kbuild test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-04-20 16:06 UTC (permalink / raw)
  To: GhantaKrishnamurthy MohanKrishna
  Cc: kbuild-all, tipc-discussion, jon.maloy, maloy, ying.xue,
	mohan.krishna.ghanta.krishnamurthy, netdev, davem

[-- Attachment #1: Type: text/plain, Size: 6973 bytes --]

Hi GhantaKrishnamurthy,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/GhantaKrishnamurthy-MohanKrishna/tipc-Confgiuration-of-MTU-for-media-UDP/20180420-224412
config: i386-randconfig-a0-201815 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: the linux-review/GhantaKrishnamurthy-MohanKrishna/tipc-Confgiuration-of-MTU-for-media-UDP/20180420-224412 HEAD 5757244a45c9114ee8a7ed60e9b074107605f6eb builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   net/tipc/udp_media.c: In function 'tipc_udp_enable':
   net/tipc/udp_media.c:716:20: error: 'struct tipc_media' has no member named 'mtu'
      b->mtu = b->media->mtu;
                       ^
   net/tipc/udp_media.c: At top level:
>> net/tipc/udp_media.c:805:2: error: unknown field 'mtu' specified in initializer
     .mtu  = TIPC_DEF_LINK_UDP_MTU,
     ^

vim +/mtu +805 net/tipc/udp_media.c

   632	
   633	/**
   634	 * tipc_udp_enable - callback to create a new udp bearer instance
   635	 * @net:	network namespace
   636	 * @b:		pointer to generic tipc_bearer
   637	 * @attrs:	netlink bearer configuration
   638	 *
   639	 * validate the bearer parameters and initialize the udp bearer
   640	 * rtnl_lock should be held
   641	 */
   642	static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
   643				   struct nlattr *attrs[])
   644	{
   645		int err = -EINVAL;
   646		struct udp_bearer *ub;
   647		struct udp_media_addr remote = {0};
   648		struct udp_media_addr local = {0};
   649		struct udp_port_cfg udp_conf = {0};
   650		struct udp_tunnel_sock_cfg tuncfg = {NULL};
   651		struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
   652		u8 node_id[NODE_ID_LEN] = {0,};
   653	
   654		ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
   655		if (!ub)
   656			return -ENOMEM;
   657	
   658		INIT_LIST_HEAD(&ub->rcast.list);
   659	
   660		if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
   661			goto err;
   662	
   663		if (nla_parse_nested(opts, TIPC_NLA_UDP_MAX,
   664				     attrs[TIPC_NLA_BEARER_UDP_OPTS],
   665				     tipc_nl_udp_policy, NULL))
   666			goto err;
   667	
   668		if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
   669			pr_err("Invalid UDP bearer configuration");
   670			err = -EINVAL;
   671			goto err;
   672		}
   673	
   674		err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
   675					  &ub->ifindex);
   676		if (err)
   677			goto err;
   678	
   679		err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_REMOTE], &remote, NULL);
   680		if (err)
   681			goto err;
   682	
   683		/* Autoconfigure own node identity if needed */
   684		if (!tipc_own_id(net)) {
   685			memcpy(node_id, local.ipv6.in6_u.u6_addr8, 16);
   686			tipc_net_init(net, node_id, 0);
   687		}
   688		if (!tipc_own_id(net)) {
   689			pr_warn("Failed to set node id, please configure manually\n");
   690			err = -EINVAL;
   691			goto err;
   692		}
   693	
   694		b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP;
   695		b->bcast_addr.broadcast = TIPC_BROADCAST_SUPPORT;
   696		rcu_assign_pointer(b->media_ptr, ub);
   697		rcu_assign_pointer(ub->bearer, b);
   698		tipc_udp_media_addr_set(&b->addr, &local);
   699		if (local.proto == htons(ETH_P_IP)) {
   700			struct net_device *dev;
   701	
   702			dev = __ip_dev_find(net, local.ipv4.s_addr, false);
   703			if (!dev) {
   704				err = -ENODEV;
   705				goto err;
   706			}
   707			udp_conf.family = AF_INET;
   708			udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
   709			udp_conf.use_udp_checksums = false;
   710			ub->ifindex = dev->ifindex;
   711			if (tipc_mtu_bad(dev, sizeof(struct iphdr) +
   712					      sizeof(struct udphdr))) {
   713				err = -EINVAL;
   714				goto err;
   715			}
 > 716			b->mtu = b->media->mtu;
   717	#if IS_ENABLED(CONFIG_IPV6)
   718		} else if (local.proto == htons(ETH_P_IPV6)) {
   719			udp_conf.family = AF_INET6;
   720			udp_conf.use_udp6_tx_checksums = true;
   721			udp_conf.use_udp6_rx_checksums = true;
   722			udp_conf.local_ip6 = in6addr_any;
   723			b->mtu = 1280;
   724	#endif
   725		} else {
   726			err = -EAFNOSUPPORT;
   727			goto err;
   728		}
   729		udp_conf.local_udp_port = local.port;
   730		err = udp_sock_create(net, &udp_conf, &ub->ubsock);
   731		if (err)
   732			goto err;
   733		tuncfg.sk_user_data = ub;
   734		tuncfg.encap_type = 1;
   735		tuncfg.encap_rcv = tipc_udp_recv;
   736		tuncfg.encap_destroy = NULL;
   737		setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
   738	
   739		/**
   740		 * The bcast media address port is used for all peers and the ip
   741		 * is used if it's a multicast address.
   742		 */
   743		memcpy(&b->bcast_addr.value, &remote, sizeof(remote));
   744		if (tipc_udp_is_mcast_addr(&remote))
   745			err = enable_mcast(ub, &remote);
   746		else
   747			err = tipc_udp_rcast_add(b, &remote);
   748		if (err)
   749			goto err;
   750	
   751		return 0;
   752	err:
   753		if (ub->ubsock)
   754			udp_tunnel_sock_release(ub->ubsock);
   755		kfree(ub);
   756		return err;
   757	}
   758	
   759	/* cleanup_bearer - break the socket/bearer association */
   760	static void cleanup_bearer(struct work_struct *work)
   761	{
   762		struct udp_bearer *ub = container_of(work, struct udp_bearer, work);
   763		struct udp_replicast *rcast, *tmp;
   764	
   765		list_for_each_entry_safe(rcast, tmp, &ub->rcast.list, list) {
   766			list_del_rcu(&rcast->list);
   767			kfree_rcu(rcast, rcu);
   768		}
   769	
   770		if (ub->ubsock)
   771			udp_tunnel_sock_release(ub->ubsock);
   772		synchronize_net();
   773		kfree(ub);
   774	}
   775	
   776	/* tipc_udp_disable - detach bearer from socket */
   777	static void tipc_udp_disable(struct tipc_bearer *b)
   778	{
   779		struct udp_bearer *ub;
   780	
   781		ub = rcu_dereference_rtnl(b->media_ptr);
   782		if (!ub) {
   783			pr_err("UDP bearer instance not found\n");
   784			return;
   785		}
   786		if (ub->ubsock)
   787			sock_set_flag(ub->ubsock->sk, SOCK_DEAD);
   788		RCU_INIT_POINTER(ub->bearer, NULL);
   789	
   790		/* sock_release need to be done outside of rtnl lock */
   791		INIT_WORK(&ub->work, cleanup_bearer);
   792		schedule_work(&ub->work);
   793	}
   794	
   795	struct tipc_media udp_media_info = {
   796		.send_msg	= tipc_udp_send_msg,
   797		.enable_media	= tipc_udp_enable,
   798		.disable_media	= tipc_udp_disable,
   799		.addr2str	= tipc_udp_addr2str,
   800		.addr2msg	= tipc_udp_addr2msg,
   801		.msg2addr	= tipc_udp_msg2addr,
   802		.priority	= TIPC_DEF_LINK_PRI,
   803		.tolerance	= TIPC_DEF_LINK_TOL,
   804		.window		= TIPC_DEF_LINK_WIN,
 > 805		.mtu		= TIPC_DEF_LINK_UDP_MTU,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31332 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-20 16:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19  9:06 [net-next 0/3] tipc: Confgiuration of MTU for media UDP GhantaKrishnamurthy MohanKrishna
2018-04-19  9:06 ` [net-next 1/3] tipc: set default MTU for UDP media GhantaKrishnamurthy MohanKrishna
2018-04-20 15:22   ` kbuild test robot
2018-04-20 16:06   ` kbuild test robot
2018-04-19  9:06 ` [net-next 2/3] tipc: implement configuration of UDP media MTU GhantaKrishnamurthy MohanKrishna
2018-04-19  9:06 ` [net-next 3/3] tipc: confgiure and apply UDP bearer MTU on running links GhantaKrishnamurthy MohanKrishna
2018-04-20 15:04 ` [net-next 0/3] tipc: Confgiuration of MTU for media UDP David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).