On Fri, Dec 11, 2020 at 4:29 AM Jonas Bonn <jo...@norrbonn.se> wrote: > > All GTP traffic is currently sent from the same source port. This makes > everything look like one big flow which is difficult to balance across > network resources. > > From 3GPP TS 29.281: > "...the UDP Source Port or the Flow Label field... should be set dynamically > by the sending GTP-U entity to help balancing the load in the transport > network." > > Signed-off-by: Jonas Bonn <jo...@norrbonn.se> > --- > drivers/net/gtp.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c > index 4a3a52970856..236ebbcb37bf 100644 > --- a/drivers/net/gtp.c > +++ b/drivers/net/gtp.c > @@ -477,7 +477,7 @@ static int gtp_xmit_ip4(struct sk_buff *skb, struct > net_device *dev) > __be32 saddr; > struct iphdr *iph; > int headroom; > - __be16 port; > + __be16 sport, port; > int r; > > /* Read the IP destination address and resolve the PDP context. > @@ -527,6 +527,10 @@ static int gtp_xmit_ip4(struct sk_buff *skb, struct > net_device *dev) > return -EMSGSIZE; > } > > + sport = udp_flow_src_port(sock_net(pctx->sk), skb, > + 0, USHRT_MAX, > + true); > + why use_eth is true for this is L3 GTP devices, Am missing something?
> /* Ensure there is sufficient headroom. */ > r = skb_cow_head(skb, headroom); > if (unlikely(r)) > @@ -545,7 +549,7 @@ static int gtp_xmit_ip4(struct sk_buff *skb, struct > net_device *dev) > iph->tos, > ip4_dst_hoplimit(&rt->dst), > 0, > - port, port, > + sport, port, > !net_eq(sock_net(pctx->sk), > dev_net(pctx->dev)), > false); > -- > 2.27.0 >