[ovs-dev,V2] ip_gre: Remove even more unused code
diff mbox series

Message ID 1572900227-15764-1-git-send-email-gvrose8192@gmail.com
State New
Headers show
Series
  • [ovs-dev,V2] ip_gre: Remove even more unused code
Related show

Commit Message

Gregory Rose Nov. 4, 2019, 8:43 p.m. UTC
There is a confusing mix of ipgre and gretap functions with some
needed for gretap still having ipgre_ prefixes.  This time though
I think I got the rest of the unused ipgre code.

Passes Travis here and this time I made sure the patch passing
Travis is the same one I'm mailing.
https://travis-ci.org/gvrose8192/ovs-experimental/builds/607296133

Fixes: d5822f428814 ("gre: Remove dead ipgre code")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>

---
V2 - Send the right patch this time
---
 datapath/linux/compat/ip_gre.c | 102 -----------------------------------------
 1 file changed, 102 deletions(-)

Comments

Ben Pfaff Nov. 5, 2019, 9:14 p.m. UTC | #1
On Mon, Nov 04, 2019 at 12:43:47PM -0800, Greg Rose wrote:
> There is a confusing mix of ipgre and gretap functions with some
> needed for gretap still having ipgre_ prefixes.  This time though
> I think I got the rest of the unused ipgre code.
> 
> Passes Travis here and this time I made sure the patch passing
> Travis is the same one I'm mailing.
> https://travis-ci.org/gvrose8192/ovs-experimental/builds/607296133
> 
> Fixes: d5822f428814 ("gre: Remove dead ipgre code")
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> 
> ---
> V2 - Send the right patch this time

Great.  Thanks, I applied this to master.
Gregory Rose Nov. 5, 2019, 9:27 p.m. UTC | #2
On 11/5/2019 1:14 PM, Ben Pfaff wrote:
> On Mon, Nov 04, 2019 at 12:43:47PM -0800, Greg Rose wrote:
>> There is a confusing mix of ipgre and gretap functions with some
>> needed for gretap still having ipgre_ prefixes.  This time though
>> I think I got the rest of the unused ipgre code.
>>
>> Passes Travis here and this time I made sure the patch passing
>> Travis is the same one I'm mailing.
>> https://travis-ci.org/gvrose8192/ovs-experimental/builds/607296133
>>
>> Fixes: d5822f428814 ("gre: Remove dead ipgre code")
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
>>
>> ---
>> V2 - Send the right patch this time
> Great.  Thanks, I applied this to master.

Thanks Ben!

Patch
diff mbox series

diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index 3b7e607..04f994f 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -922,108 +922,6 @@  static int erspan_tunnel_init(struct net_device *dev)
 	return ip_tunnel_init(dev);
 }
 
-static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
-			unsigned short type,
-			const void *daddr, const void *saddr, unsigned int len)
-{
-	struct ip_tunnel *t = netdev_priv(dev);
-	struct iphdr *iph;
-	struct gre_base_hdr *greh;
-
-	iph = (struct iphdr *)__skb_push(skb, t->hlen + sizeof(*iph));
-	greh = (struct gre_base_hdr *)(iph+1);
-	greh->flags = gre_tnl_flags_to_gre_flags(t->parms.o_flags);
-	greh->protocol = htons(type);
-
-	memcpy(iph, &t->parms.iph, sizeof(struct iphdr));
-
-	/* Set the source hardware address. */
-	if (saddr)
-		memcpy(&iph->saddr, saddr, 4);
-	if (daddr)
-		memcpy(&iph->daddr, daddr, 4);
-	if (iph->daddr)
-		return t->hlen + sizeof(*iph);
-
-	return -(t->hlen + sizeof(*iph));
-}
-
-static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr)
-{
-	const struct iphdr *iph = (const struct iphdr *) skb_mac_header(skb);
-	memcpy(haddr, &iph->saddr, 4);
-	return 4;
-}
-
-static const struct header_ops ipgre_header_ops = {
-	.create	= ipgre_header,
-	.parse	= ipgre_header_parse,
-};
-
-static int ipgre_tunnel_init(struct net_device *dev)
-{
-	struct ip_tunnel *tunnel = netdev_priv(dev);
-	struct iphdr *iph = &tunnel->parms.iph;
-
-	__gre_tunnel_init(dev);
-
-	memcpy(dev->dev_addr, &iph->saddr, 4);
-	memcpy(dev->broadcast, &iph->daddr, 4);
-
-	dev->flags		= IFF_NOARP;
-	netif_keep_dst(dev);
-	dev->addr_len		= 4;
-
-	if (!tunnel->collect_md) {
-		dev->header_ops = &ipgre_header_ops;
-	}
-
-	return ip_tunnel_init(dev);
-}
-
-static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
-			      struct net_device *dev)
-{
-	struct ip_tunnel *tunnel = netdev_priv(dev);
-	const struct iphdr *tnl_params;
-
-	if (tunnel->collect_md) {
-		gre_fb_xmit(skb);
-		return NETDEV_TX_OK;
-	}
-
-	if (dev->header_ops) {
-		/* Need space for new headers */
-		if (skb_cow_head(skb, dev->needed_headroom -
-				      (tunnel->hlen + sizeof(struct iphdr))))
-			goto free_skb;
-
-		tnl_params = (const struct iphdr *)skb->data;
-
-		/* Pull skb since ip_tunnel_xmit() needs skb->data pointing
-		 * to gre header.
-		 */
-		skb_pull(skb, tunnel->hlen + sizeof(struct iphdr));
-		skb_reset_mac_header(skb);
-	} else {
-		if (skb_cow_head(skb, dev->needed_headroom))
-			goto free_skb;
-
-		tnl_params = &tunnel->parms.iph;
-	}
-
-	if (gre_handle_offloads(skb, !!(tunnel->parms.o_flags & TUNNEL_CSUM)))
-		goto free_skb;
-
-	__gre_xmit(skb, dev, tnl_params, skb->protocol);
-	return NETDEV_TX_OK;
-
-free_skb:
-	kfree_skb(skb);
-	dev->stats.tx_dropped++;
-	return NETDEV_TX_OK;
-}
-
 static const struct net_device_ops gre_tap_netdev_ops = {
 	.ndo_init		= gre_tap_init,
 	.ndo_uninit		= rpl_ip_tunnel_uninit,