[openib-general] [PATCH 1 of 3] move destructor to struct neigh_parms

Michael S. Tsirkin mst at mellanox.co.il
Tue Jan 17 14:20:21 PST 2006


Quoting Michael S. Tsirkin <mst at mellanox.co.il>:
> Subject: [PATCH 1 of 3] move destructor to struct neigh_parms
> 
> This is an alternative approach to the one presented in
> ipoib_all_neigh_issues_2.patch.
> 
> ---
> 
> 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 at 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*);
> 

Roland, what do you say to this approach?
We still could try this for 2.6.16, couldnt we?
Its small and the interface is unused in kernel except by us.

Otherwise for 2.6.16 and earlier we'll have to maintain the global list of
neighbours along the lines of ipoib_all_neigh_issues_2.patch.

-- 
MST



More information about the general mailing list