* [PATCH net] geneve: Refine MTU limit
@ 2016-02-16 12:33 David Wragg
[not found] ` <1455625999-9781-1-git-send-email-david-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: David Wragg @ 2016-02-16 12:33 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, dev-yBygre7rU0TnMu66kgdUjQ
Cc: David Wragg, Tom Herbert
While GENEVE allows variable length options, the maximum length of the
options is 63 * 4 bytes. So we can reasonably set an MTU limit other
than IP_MAX_MTU, as the other tunnel devices do.
Signed-off-by: David Wragg <david@weave.works>
---
drivers/net/geneve.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 028e387..f57f9bc 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -37,6 +37,9 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
#define GENEVE_VER 0
#define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr))
+#define GENEVE_MAX_OPTIONS_LEN (63 * 4)
+#define GENEVE_MAX_MTU (IP_MAX_MTU - sizeof(struct iphdr) - GENEVE_BASE_HLEN \
+ - GENEVE_MAX_OPTIONS_LEN)
/* per-network namespace private data for this module */
struct geneve_net {
@@ -1041,11 +1044,9 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
static int geneve_change_mtu(struct net_device *dev, int new_mtu)
{
- /* GENEVE overhead is not fixed, so we can't enforce a more
- * precise max MTU.
- */
- if (new_mtu < 68 || new_mtu > IP_MAX_MTU)
+ if (new_mtu < 68 || new_mtu > GENEVE_MAX_MTU)
return -EINVAL;
+
dev->mtu = new_mtu;
return 0;
}
@@ -1459,7 +1460,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
/* openvswitch users expect packet sizes to be unrestricted,
* so set the largest MTU we can.
*/
- err = geneve_change_mtu(dev, IP_MAX_MTU);
+ err = geneve_change_mtu(dev, GENEVE_MAX_MTU);
if (err)
goto err;
--
2.5.0
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] geneve: Refine MTU limit
[not found] ` <1455625999-9781-1-git-send-email-david-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>
@ 2016-02-16 18:32 ` Jesse Gross
2016-02-18 16:41 ` David Wragg
0 siblings, 1 reply; 3+ messages in thread
From: Jesse Gross @ 2016-02-16 18:32 UTC (permalink / raw)
To: David Wragg; +Cc: ovs dev, Linux Kernel Network Developers, Tom Herbert
On Tue, Feb 16, 2016 at 4:33 AM, David Wragg <david@weave.works> wrote:
> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> index 028e387..f57f9bc 100644
> --- a/drivers/net/geneve.c
> +++ b/drivers/net/geneve.c
> @@ -37,6 +37,9 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
>
> #define GENEVE_VER 0
> #define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr))
> +#define GENEVE_MAX_OPTIONS_LEN (63 * 4)
> +#define GENEVE_MAX_MTU (IP_MAX_MTU - sizeof(struct iphdr) - GENEVE_BASE_HLEN \
> + - GENEVE_MAX_OPTIONS_LEN)
In addition to Tom's comment about taking into account
dev->hard_header_len, can you please not include
GENEVE_MAX_OPTIONS_LEN in the MTU calculation based on the discussion
on the other thread? Otherwise, you are excluding some potentially
valid configurations.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] geneve: Refine MTU limit
2016-02-16 18:32 ` Jesse Gross
@ 2016-02-18 16:41 ` David Wragg
0 siblings, 0 replies; 3+ messages in thread
From: David Wragg @ 2016-02-18 16:41 UTC (permalink / raw)
To: Jesse Gross
Cc: David Wragg, Linux Kernel Network Developers, ovs dev,
Tom Herbert
Jesse Gross <jesse@kernel.org> writes:
> In addition to Tom's comment about taking into account
> dev->hard_header_len, can you please not include
> GENEVE_MAX_OPTIONS_LEN in the MTU calculation based on the discussion
> on the other thread? Otherwise, you are excluding some potentially
> valid configurations.
Addressed in v2.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-18 16:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 12:33 [PATCH net] geneve: Refine MTU limit David Wragg
[not found] ` <1455625999-9781-1-git-send-email-david-1SEAoVOfG6VEzL6FDj/jAg@public.gmane.org>
2016-02-16 18:32 ` Jesse Gross
2016-02-18 16:41 ` David Wragg
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).