mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Fwd: [PATCH 1 of 3] move destructor to struct neigh_parms
       [not found] <OFB2D358DB.F7A4CFB5-ON872570FA.007138E4-882570FA.00714019@us.ibm.com>
@ 2006-01-18 21:27 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2006-01-18 21:27 UTC (permalink / raw)
  To: Shirley Ma; +Cc: LKML, netdev, openib-general, openib-general-bounces

Quoting Shirley Ma <xma@us.ibm.com>:
> Subject: Re: Fwd: [PATCH 1 of 3] move destructor to struct neigh_parms
> 
> 
> >+                 if (neigh->parms->neigh_destructor)
> >+                                  (neigh->parms->neigh_destructor)(neigh); 
> 
> Is that safe without checking neigh->parms here?

Yes, we have neigh_parms_put(neigh->parms); a couple of lines below.

-- 
MST

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

* Fwd: [PATCH 1 of 3] move destructor to struct neigh_parms
@ 2006-01-18 16:10 Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2006-01-18 16:10 UTC (permalink / raw)
  To: openib-general, LKML, netdev; +Cc: Roland Dreier

Hi!
struct neigh_ops currently has a destructor field, unused by in-kernel
drivers outside the infiniband subtree.
infiniband ipoib in-tree driver currently uses this field, and we've
run into problems: since the destructor is shared between neighbours
that belong to different net devices, there's no way to set/clear it
safely.

It would be good to know what the design was
behind putting the destructor method there in the first place.

The following patch moves this field to neigh_parms where it can
be safely set, together with its twin neigh_setup.
Two additional patches in the patch series
update ipoib to use this new interface.

---

Move destructor from neigh_ops (which is shared between devices)
to neigh_parms which is not, so that multiple drivers can set
it safely.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>

Index: linux-2.6.15/net/core/neighbour.c
===================================================================
--- linux-2.6.15.orig/net/core/neighbour.c	2006-01-12 11:58:15.000000000 +0200
+++ linux-2.6.15/net/core/neighbour.c	2006-01-12 20:10:00.000000000 +0200
@@ -586,8 +586,8 @@ void neigh_destroy(struct neighbour *nei
 			kfree(hh);
 	}
 
-	if (neigh->ops && neigh->ops->destructor)
-		(neigh->ops->destructor)(neigh);
+	if (neigh->parms->neigh_destructor)
+		(neigh->parms->neigh_destructor)(neigh);
 
 	skb_queue_purge(&neigh->arp_queue);
 
Index: linux-2.6.15/include/net/neighbour.h
===================================================================
--- linux-2.6.15.orig/include/net/neighbour.h	2006-01-03 05:21:10.000000000 +0200
+++ linux-2.6.15/include/net/neighbour.h	2006-01-12 20:09:27.000000000 +0200
@@ -68,6 +68,7 @@ struct neigh_parms
 	struct net_device *dev;
 	struct neigh_parms *next;
 	int	(*neigh_setup)(struct neighbour *);
+	void	(*neigh_destructor)(struct neighbour *);
 	struct neigh_table *tbl;
 
 	void	*sysctl_table;
@@ -145,7 +146,6 @@ struct neighbour
 struct neigh_ops
 {
 	int			family;
-	void			(*destructor)(struct neighbour *);
 	void			(*solicit)(struct neighbour *, struct sk_buff*);
 	void			(*error_report)(struct neighbour *, struct sk_buff*);
 	int			(*output)(struct sk_buff*);

-- 
MST

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

end of thread, other threads:[~2006-01-18 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <OFB2D358DB.F7A4CFB5-ON872570FA.007138E4-882570FA.00714019@us.ibm.com>
2006-01-18 21:27 ` Fwd: [PATCH 1 of 3] move destructor to struct neigh_parms Michael S. Tsirkin
2006-01-18 16:10 Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®