Hi,
This is the first series of my gtp kernel updates.
It contains mostly the removal of Linux version ifdefs. After this the module builds only on 4.3+. The goal here is the preparation for main line inclusion.
The other small change is a update to the Makefile for simpler out-of-tree build
Andreas
--
Andreas Schultz (6): build: update Makefile for simpler out of tree builds gtp: remove genl_ops compat ifdef for Linux < 3.13 gtp: remove per cpu stats compat ifdef for Linux < 3.13 gtp: update for Linux > 4.1+, __ip_select_ident arguments have changed gtp: update for Linux > 4.1+, genlmsg_end return should be ignored gtp: update for Linux > 4.2+, set NO_QUEUE flag on gtp device
Makefile | 17 ++++++++++++----- gtp.c | 11 +++++------ gtp.h | 4 ---- 3 files changed, 17 insertions(+), 15 deletions(-)
Signed-off-by: Andreas Schultz aschultz@tpip.net --- Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index 9081679..2b3b4f5 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,16 @@ -CC=gcc -KDIR := /lib/modules/$(shell uname -r)/build +KERNEL_SRC := /lib/modules/$(shell uname -r)/build
obj-m += gtp.o
-default: - $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules +SRC := $(shell pwd) + +all: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install + clean: - rm -rf *.o *.mod.* modules.order Module.symvers *.ko .tmp_versions .*.cmd + rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c + rm -f Module.markers Module.symvers modules.order + rm -rf .tmp_versions Modules.symvers
Signed-off-by: Andreas Schultz aschultz@tpip.net --- gtp.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/gtp.c b/gtp.c index 61db1c3..6eb1178 100644 --- a/gtp.c +++ b/gtp.c @@ -1291,11 +1291,7 @@ static struct nla_policy gtp_genl_policy[GTPA_MAX + 1] = { [GTPA_FLOW] = { .type = NLA_U16, }, };
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) static const struct genl_ops gtp_genl_ops[] = { -#else -static struct genl_ops gtp_genl_ops[] = { -#endif { .cmd = GTP_CMD_TUNNEL_NEW, .doit = gtp_genl_tunnel_new,
Signed-off-by: Andreas Schultz aschultz@tpip.net --- gtp.h | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/gtp.h b/gtp.h index 8422875..5f8d8a2 100644 --- a/gtp.h +++ b/gtp.h @@ -10,10 +10,6 @@ #define UDP_ENCAP_GTP1U 5 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) -#define pcpu_sw_netstats pcpu_tstats -#endif - /* general GTP protocol related definitions */
#define GTP0_PORT 3386
Signed-off-by: Andreas Schultz aschultz@tpip.net --- gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gtp.c b/gtp.c index 6eb1178..0d1b5ee 100644 --- a/gtp.c +++ b/gtp.c @@ -616,7 +616,7 @@ gtp_push_ip4hdr(struct sk_buff *skb, struct gtp_pktinfo *pktinfo) iph->daddr = pktinfo->fl4.daddr; iph->saddr = pktinfo->fl4.saddr; iph->ttl = ip4_dst_hoplimit(&pktinfo->rt->dst); - __ip_select_ident(iph, &pktinfo->rt->dst, + __ip_select_ident(dev_net(pktinfo->rt->dst.dev), iph, (skb_shinfo(skb)->gso_segs ?: 1) - 1);
netdev_dbg(pktinfo->dev, "gtp -> IP src: %pI4 dst: %pI4\n",
Signed-off-by: Andreas Schultz aschultz@tpip.net --- gtp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gtp.c b/gtp.c index 0d1b5ee..7fa9c38 100644 --- a/gtp.c +++ b/gtp.c @@ -1153,7 +1153,8 @@ gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq, nla_put_u16(skb, GTPA_FLOW, pctx->flow))) goto nla_put_failure;
- return genlmsg_end(skb, genlh); + genlmsg_end(skb, genlh); + return 0;
nlmsg_failure: nla_put_failure:
Signed-off-by: Andreas Schultz aschultz@tpip.net --- gtp.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/gtp.c b/gtp.c index 7fa9c38..7c72eb0 100644 --- a/gtp.c +++ b/gtp.c @@ -718,6 +718,8 @@ static const struct net_device_ops gtp_netdev_ops = {
static void gtp_link_setup(struct net_device *dev) { + dev->priv_flags |= IFF_NO_QUEUE; + dev->netdev_ops = >p_netdev_ops; dev->destructor = free_netdev; }
On Thu, Oct 29, 2015 at 12:38:56PM +0100, Andreas Schultz wrote:
Hi,
This is the first series of my gtp kernel updates.
It contains mostly the removal of Linux version ifdefs. After this the module builds only on 4.3+. The goal here is the preparation for main line inclusion.
The other small change is a update to the Makefile for simpler out-of-tree build
Series applied, thanks Andreas.