Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jun 2012 10:10:22 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Matthias Apitz <guru@unixarea.de>
Cc:        swills@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: 10-CURRENT r235646 && open-vm-tools-8.6.0-425873
Message-ID:  <201206051010.22321.jhb@freebsd.org>
In-Reply-To: <20120605132750.GA2122@tiny>
References:  <20120526142229.GA3893@tinyCurrent> <201205311134.55258.jhb@freebsd.org> <20120605132750.GA2122@tiny>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, June 05, 2012 9:27:51 am Matthias Apitz wrote:
> El d=EDa Thursday, May 31, 2012 a las 11:34:55AM -0400, John Baldwin escr=
ibi=F3:
>=20
> > > cc1: warnings being treated as errors
> > > if_vxn.c: In function 'vxn_load_multicast':
> > > if_vxn.c:719: warning: implicit declaration of function 'IF_ADDR_LOCK'
> > > if_vxn.c:719: warning: nested extern declaration of 'IF_ADDR_LOCK'
> > > [-Wnested-ext erns]
> > > if_vxn.c:746: warning: implicit declaration of function 'IF_ADDR_UNLO=
CK'
> > > if_vxn.c:746: warning: nested extern declaration of 'IF_ADDR_UNLOCK'
> > > [-Wnested-e xterns]
> > > *** [if_vxn.o] Error code 1
> > >=20
>=20
> > It should be using if_mcast_rlock() and if_mcast_runlock() instead of=20
using=20
> > those macros directly.  This works all the way back to 8.0.
> >=20
>=20
> Thanks for your patch proposal; but using this it can't find the
> if_mcast_rlock() and if_mcast_runlock() functions declaration (and I
> don't see them in /usr/src/... );

Sorry, they are if_maddr_rlock() and if_maddr_runlock().  They are in if_va=
r.h=20
right below the macro you looked at. :)

<quote>
/*
 * Locks for address lists on the network interface.
 */
#define IF_ADDR_LOCK_INIT(if)   rw_init(&(if)->if_addr_lock, "if_addr_lock")
#define IF_ADDR_LOCK_DESTROY(if)        rw_destroy(&(if)->if_addr_lock)
#define IF_ADDR_WLOCK(if)       rw_wlock(&(if)->if_addr_lock)
#define IF_ADDR_WUNLOCK(if)     rw_wunlock(&(if)->if_addr_lock)
#define IF_ADDR_RLOCK(if)       rw_rlock(&(if)->if_addr_lock)
#define IF_ADDR_RUNLOCK(if)     rw_runlock(&(if)->if_addr_lock)
#define IF_ADDR_LOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_LOCKED)
#define IF_ADDR_WLOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_WLOCKED)

/*
 * Function variations on locking macros intended to be used by loadable
 * kernel modules in order to divorce them from the internals of address li=
st
 * locking.
 */
void    if_addr_rlock(struct ifnet *ifp);       /* if_addrhead */
void    if_addr_runlock(struct ifnet *ifp);     /* if_addrhead */
void    if_maddr_rlock(struct ifnet *ifp);      /* if_multiaddrs */
void    if_maddr_runlock(struct ifnet *ifp);    /* if_multiaddrs */
</quote>

> based on the SVN diff of the kernel:
>=20
>=20
http://svnweb.freebsd.org/base/head/sys/net/if_var.h?r1=3D231229&r2=3D23320=
2&pathrev=3D233202
>=20
> I came up with another proposal:
>=20
> *** modules/freebsd/vmxnet/net_compat.h.orig    Wed Sep 21 20:25:15 2011
> --- modules/freebsd/vmxnet/net_compat.h Tue Jun  5 15:13:55 2012
> ***************
> *** 170,178 ****
>   #if __FreeBSD_version < 505000
>   #   define VXN_IF_ADDR_LOCK(_ifp)
>   #   define VXN_IF_ADDR_UNLOCK(_ifp)
>   #else
> ! #   define VXN_IF_ADDR_LOCK(_ifp)       IF_ADDR_LOCK((_ifp))
> ! #   define VXN_IF_ADDR_UNLOCK(_ifp)     IF_ADDR_UNLOCK((_ifp))
>   #endif
>=20
>   #endif /* _VXN_NET_COMPAT_H_ */
> --- 170,181 ----
>   #if __FreeBSD_version < 505000
>   #   define VXN_IF_ADDR_LOCK(_ifp)
>   #   define VXN_IF_ADDR_UNLOCK(_ifp)
> + #elif __FreeBSD_version < 800000
> + #  define VXN_IF_ADDR_LOCK(_ifp)           IF_ADDR_LOCK((_ifp))
> + #  define VXN_IF_ADDR_UNLOCK(_ifp)         IF_ADDR_UNLOCK((_ifp))
>   #else
> ! #  define VXN_IF_ADDR_LOCK(_ifp)           IF_ADDR_WLOCK((_ifp))
> ! #  define VXN_IF_ADDR_UNLOCK(_ifp)         IF_ADDR_WUNLOCK((_ifp))
>   #endif
>=20
>   #endif /* _VXN_NET_COMPAT_H_ */
>=20
> and using this it compiles fine; but later on it has another problem:

No, we do not wish to expose those to drivers as we do not want the locks
part of the ABI.  Plus, you should be using read-locks for this anyway.

=2D-=20
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206051010.22321.jhb>