Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jun 2012 17:14:59 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        swills@freebsd.org, Matthias Apitz <guru@unixarea.de>, freebsd-current@freebsd.org
Subject:   Re: 10-CURRENT r235646 && open-vm-tools-8.6.0-425873
Message-ID:  <5C1A97F3-F392-44B5-B197-3E8C68CED7FE@gmail.com>
In-Reply-To: <201206051010.22321.jhb@freebsd.org>
References:  <20120526142229.GA3893@tinyCurrent> <201205311134.55258.jhb@freebsd.org> <20120605132750.GA2122@tiny> <201206051010.22321.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Jun 5, 2012, at 7:10 AM, John Baldwin wrote:

> 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 =
escribi=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_UNLOCK'
>>>> 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/... );
>=20
> Sorry, they are if_maddr_rlock() and if_maddr_runlock().  They are in =
if_var.h=20
> right below the macro you looked at. :)
>=20
> <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)
>=20
> /*
> * Function variations on locking macros intended to be used by =
loadable
> * kernel modules in order to divorce them from the internals of =
address list
> * 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>
>=20
>> based on the SVN diff of the kernel:
>>=20
>>=20
> =
http://svnweb.freebsd.org/base/head/sys/net/if_var.h?r1=3D231229&r2=3D2332=
02&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:
>=20
> 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.

	I wish I read this part before I submitted =
http://www.freebsd.org/cgi/query-pr.cgi?pr=3D168904 :/.
Thanks!
-Garrett=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5C1A97F3-F392-44B5-B197-3E8C68CED7FE>