[Click] patches to build linuxmodule on 2.6.12
Eddie Kohler
kohler at cs.ucla.edu
Wed Feb 14 11:42:02 EST 2007
Hi Beyers,
This is a configuration problem. Those lines are protected by #if
HAVE_NETIF_TX_LOCK, which should be false for 2.6.16. Can you send me your
config.log?
Eddie
Beyers Cronje wrote:
> Hi Eddie,
>
> Just a note, the recent patch applied to todevice.cc broke compilation
> on kernel 2.6.16.13 <http://2.6.16.13> :
>
> line 236 - int ok = spin_trylock_bh(&_dev->_xmit_lock); - The
> 2.6.16.13 <http://2.6.16.13> net_device structure still uses xmit_lock
> and not _xmit_lock.
>
> line 249 - netif_tx_unlock_bh(_dev); - netif_tx_unlock_bh is not
> defined in 2.6.16.13 <http://2.6.16.13>
>
> Sorry for the lack of patch, I'm stuck in Windows atm.
>
> Cheers
>
> Beyers
>
>
> On 2/14/07, *Eddie Kohler* <kohler at cs.ucla.edu
> <mailto:kohler at cs.ucla.edu>> wrote:
>
> Hi David, long time since you posted this!
>
> I've added a version of this patch to our repository. In particular, I
> changed atomic.hh ot use local_save_irq/local_restore_irq directoy.
>
> The preprocessor changes confuse me. "#if
> HAVE_INDIFFERENT_ALIGNMENT" should
> be exactly equivalent to "#ifdef HAVE_INDIFFERENT_ALIGNMENT"; the
> preprocessor
> is requried to change undefined symbols to 0. So...?
>
> The __BUILTIN_CLZ, et al., changes are a different kettle of fish. We
> probably should only define those symbols in the kernel for certain
> architectures, but they ARE available in x86 kernels, or seem to
> be. I don't
> know how to find out if a builtin is easily kernel accessible.
>
> Thanks for posting the patch!
> Eddie
>
>
> David Claffey wrote:
> > I also have some minor patches I didn't post. I made the changes to
> > build the linuxmodule on a 2.6.12 kernel running on a different
> > architecture (LinkGear-100 SH4 platform). I didn't post them
> because I
> > haven't had time to comfirm my changes are correct or if there were a
> > better solution. But maybe they are useful.
> >
> > For example, the SH4 is sensitive to alignment and I needed to change
> > some #ifs to #ifdefs for the build to work. Now maybe I needed to
> > change how and if the macro HAVE_INDIFFERENT_ALIGNMENT is
> defined. Not
> > sure.
> >
> > I also have a 2.6.12 kernel patch generated from the 2.6.11.6
> <http://2.6.11.6> that was
> > in CVS, if anyone needs it.
> >
> > - David
> >
> >
> > diff -Naur --exclude '*.orig' --exclude '*~' --exclude '#*'
> --exclude
> > CVS --exclude '.#*' click/config.h.in click-sh4/config.h.in
> > --- click/config.h.in 2006-03-28 10:16:58.000000000 -0500
> > +++ click-sh4/config.h.in 2006-04-06 13:40:42.000000000 -0400
> > @@ -17,6 +17,7 @@
> > /* Define if PollDevice should run fast to get good benchmark
> numbers */
> > #undef CLICK_WARP9
> >
> > +#ifndef __KERNEL__
> > /* Define if you have the __builtin_clz function. */
> > #undef HAVE___BUILTIN_CLZ
> >
> > @@ -34,6 +35,7 @@
> >
> > /* Define if you have the __builtin_ffsll function. */
> > #undef HAVE___BUILTIN_FFSLL
> > +#endif /* __KERNEL__ */
> >
> > /* Define if the va_list type is addressable. */
> > #undef HAVE_ADDRESSABLE_VA_LIST
> > @@ -150,8 +152,10 @@
> > #endif
> >
> > /* Define stuff under tools or a user-level driver. */
> > -#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL)
> > -# include <click/config-userlevel.h>
> > +#ifndef __KERNEL__
> > +# if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL)
> > +# include <click/config-userlevel.h>
> > +# endif
> > #endif
> >
> > #endif /* CLICK_CONFIG_H */
> > diff -Naur --exclude '*.orig' --exclude '*~' --exclude '#*' --exclude
> > CVS --exclude '.#*' click/elements/tcpudp/tcprewriter.cc
> > click-sh4/elements/tcpudp/tcprewriter.cc
> > --- click/elements/tcpudp/tcprewriter.cc 2006-02-22
> > 02:50:07.000000000 -0500
> > +++ click-sh4/elements/tcpudp/tcprewriter.cc 2006-04-06
> > 13:40: 42.000000000 -0400
> > @@ -77,7 +77,7 @@
> > csum_delta += ~*csum & 0xFFFF;
> >
> > for (opt += 2; opt < end_sack; opt += 8) {
> > -#if HAVE_INDIFFERENT_ALIGNMENT
> > +#ifdef HAVE_INDIFFERENT_ALIGNMENT
> > uint32_t *uopt = reinterpret_cast<uint32_t *>(opt);
> > uopt[0] = htonl(new_ack(ntohl(uopt[0])));
> > uopt[1] = htonl(new_ack(ntohl(uopt[1])));
> > diff -Naur --exclude '*.orig' --exclude '*~' --exclude '#*'
> --exclude
> > CVS --exclude '.#*' click/elements/userlevel/fakepcap.cc
> > click-sh4/elements/userlevel/fakepcap.cc
> > --- click/elements/userlevel/fakepcap.cc 2005-03-14
> > 11:55:33.000000000 -0500
> > +++ click-sh4/elements/userlevel/fakepcap.cc 2006-04-06
> > 13:40:42.000000000 -0400
> > @@ -98,7 +98,7 @@
> > return dlt;
> > }
> >
> > -#if HAVE_INDIFFERENT_ALIGNMENT
> > +#ifdef HAVE_INDIFFERENT_ALIGNMENT
> > #define unaligned_net_short(v) (ntohs(*reinterpret_cast<const
> > uint16_t*>(v)))
> > #define UNALIGNED_NET_SHORT_EQ(x, y) ((x) == htons((y)))
> > #else
> > @@ -286,7 +286,7 @@
> > if (!iph)
> > return false;
> >
> > -#if !HAVE_INDIFFERENT_ALIGNMENT
> > +#ifndef HAVE_INDIFFERENT_ALIGNMENT
> > // Machine may crash if we try to access 'iph'. Align it on
> a word
> > // boundary.
> > uintptr_t header_ptr = reinterpret_cast<uintptr_t>(iph);
> > diff -Naur --exclude '*.orig' --exclude '*~' --exclude '#*' --exclude
> > CVS --exclude '.#*' click/elements/userlevel/fromfile.cc
> > click-sh4/elements/userlevel/fromfile.cc
> > --- click/elements/userlevel/fromfile.cc 2006-01-09
> > 14:03:47.000000000 -0500
> > +++ click-sh4/elements/userlevel/fromfile.cc 2006-04-06
> > 13:40: 42.000000000 -0400
> > @@ -435,7 +435,7 @@
> > if (_pos + size <= _len) {
> > const uint8_t *chunk = _buffer + _pos;
> > _pos += size;
> > -#if HAVE_INDIFFERENT_ALIGNMENT
> > +#ifdef HAVE_INDIFFERENT_ALIGNMENT
> > return reinterpret_cast<const uint8_t *>(chunk);
> > #else
> > // make a copy if required for alignment
> > diff -Naur --exclude '*.orig' --exclude '*~' --exclude '#*'
> --exclude
> > CVS --exclude '.#*' click/include/click/atomic.hh
> > click-sh4/include/click/atomic.hh
> > --- click/include/click/atomic.hh 2006-01-05
> 13:33:54.000000000 -0500
> > +++ click-sh4/include/click/atomic.hh 2006-04-06 13:40:
> 42.000000000
> > -0400
> > @@ -8,6 +8,10 @@
> > # else
> > # define CLICK_ATOMIC_VAL __atomic_fool_gcc(&_val)
> > # endif
> > +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
> > +# define __save_flags_cli(x) local_irq_save(x)
> > +# define __restore_flags(x) local_irq_restore(x)
> > +# endif
> > # ifdef __SMP__
> > # define CLICK_ATOMIC_LOCK "lock ; "
> > # else
> > diff -Naur --exclude '*.orig' --exclude '*~' --exclude '#*'
> --exclude
> > CVS --exclude '.#*' click/linuxmodule/Makefile.in
> > click-sh4/linuxmodule/Makefile.in
> > --- click/linuxmodule/Makefile.in 2006-03-22
> 15:13:54.000000000 -0500
> > +++ click-sh4/linuxmodule/Makefile.in 2006-04-06 13:40:
> 42.000000000
> > -0400
> > @@ -79,7 +79,7 @@
> > LINUXCFLAGS = $(shell echo "$(CFLAGS)" | sed -e
> s,-fno-unit-at-a-time,, \
> > -e s,-Wstrict-prototypes,, -e
> s,-Wdeclaration-after-statement,, \
> > -e s,-Wno-pointer-sign,, -e s,-fno-common,,)
> > -CLICKCPPFLAGS = @CPPFLAGS@ -DCLICK_LINUXMODULE
> > +CLICKCPPFLAGS = @CPPFLAGS@ $(CPPFLAGS) -DCLICK_LINUXMODULE
> > CLICKCFLAGS = @CFLAGS_NDEBUG@
> > CLICKCXXFLAGS = @CXXFLAGS_NDEBUG@
> > CLICKDEPCFLAGS = -Wp,-MD,$(depfile)
> > @@ -106,7 +106,7 @@
> >
> > obj-m += $(INSTALLOBJS)
> >
> > -click-objs := $(LIB_C_OBJS) $(LIB_CXX_OBJS) $(STD_ELEMENT_OBJS) \
> > +click-objs = $(LIB_C_OBJS) $(LIB_CXX_OBJS) $(STD_ELEMENT_OBJS) \
> > $(ELEMENT_OBJS) $(LINUXMODULE_C_OBJS) $(LINUXMODULE_CXX_OBJS) \
> > elements.o
> > proclikefs-objs := proclikefs_.o
> >
> >
> >
> > Eddie Kohler wrote:
> >> And thanks, also, for this!
> >>
> >> Eddie
> >>
> >>
> >> David Claffey wrote:
> >>> I have the click linuxmodule and the madwifi-ng driver running on
> >>> linux-2.6.12. I'm using todevice() to send packets out the ath
> >>> device in monitor mode. But this only works after adding the
> >>> following patch:
> >>> --- click/elements/linuxmodule/todevice.cc
> >>> +++ tmp/elements/linuxmodule/todevice.cc
> >>> @@ -383,6 +383,12 @@
> >>> skb_put(skb1, 60 - skb1->len);
> >>> }
> >>>
> >>> + skb1->dev = _dev;
> >>> +
> >>> int ret;
> >>> #if HAVE_LINUX_POLLING
> >>> if (_dev->polling > 0)
> >>> ret = _dev->tx_queue(_dev, skb1);
> >>> else
> >>> #endif
> >>> {
> >>> ret = _dev->hard_start_xmit(skb1, _dev);
> >>> _hard_start++;
> >>> }
> >>>
> >>> Todevice() passes the skb to ieee80211_hardstart(struct sk_buff
> *skb,
> >>> struct net_device *dev) which then calls
> >>> ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff
> >>> *skb). The problem arises when ieee80211_monitor_encap()
> references
> >>> skb->dev->type with skb->dev NULL. Can anyone suggest which
> function
> >>> should set skb->dev, todevice or ieee80211_hardstart?
> >>>
> >>> - David
> >>> _______________________________________________
> >>> click mailing list
> >>> click at amsterdam.lcs.mit.edu <mailto:click at amsterdam.lcs.mit.edu>
> >>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> <https://amsterdam.lcs.mit.edu/mailman/listinfo/click>
> >>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu <mailto:click at amsterdam.lcs.mit.edu>
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
>
More information about the click
mailing list