Skip to content

Commit

Permalink
linuxmodule: correctly zero out packet txflags in linux 2.6.32
Browse files Browse the repository at this point in the history
Signed-off-by: Cliff Frey <[email protected]>
  • Loading branch information
Cliff Frey committed Feb 20, 2013
1 parent 2b714ac commit 88f1516
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config-linuxmodule.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
/* Define if 'struct skb_shared_info' has an 'ip6_frag_id' member. */
#undef HAVE_LINUX_SKB_SHINFO_IP6_FRAG_ID

/* Define if 'struct skb_shared_info' has an 'tx_flags.flags' member. */
#undef HAVE_LINUX_SKB_SHINFO_TX_FLAGS_UNION

/* Define if 'struct skb_shared_info' has an 'tx_flags' member defining 'SKBTX_DEV_ZEROCOPY'. */
#undef HAVE_LINUX_SKB_SHINFO_TX_FLAGS_SKBTX_DEV_ZEROCOPY

Expand Down
57 changes: 57 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -11522,6 +11522,63 @@ $as_echo "#define HAVE_LINUX_SKB_SHINFO_TX_FLAGS_SKBTX_DEV_ZEROCOPY 1" >>confdef

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether skb_shinfo has tx_flags.flags" >&5
$as_echo_n "checking whether skb_shinfo has tx_flags.flags... " >&6; }
if ${ac_cv_linuxmodule_skb_shinfo_tx_flags_union+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if HAVE_LINUXMODULE_2_6
# define KBUILD_STR(s) #s
# define KBUILD_BASENAME KBUILD_STR(click)
# define KBUILD_MODNAME KBUILD_STR(click)
#endif
#define new linux_new
#define this linux_this
#define delete linux_delete
#define class linux_class
#define virtual linux_virtual
#define typename linux_typename
#define private linux_private
#define protected linux_protected
#define public linux_public
#define namespace linux_namespace
#define false linux_false
#define true linux_true
#define CLICK_CXX_PROTECTED 1
$linux_autoconf_include
#include <asm/types.h>
#include <linux/skbuff.h>
int
main ()
{
extern struct sk_buff *s; skb_shinfo(s)->tx_flags.flags = 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_linuxmodule_skb_shinfo_tx_flags_union=yes
else
ac_cv_linuxmodule_skb_shinfo_tx_flags_union=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_linuxmodule_skb_shinfo_tx_flags_union" >&5
$as_echo "$ac_cv_linuxmodule_skb_shinfo_tx_flags_union" >&6; }
if test $ac_cv_linuxmodule_skb_shinfo_tx_flags_union = yes; then

$as_echo "#define HAVE_LINUX_SKB_SHINFO_TX_FLAGS_UNION 1" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for device polling kernel extension" >&5
$as_echo_n "checking for device polling kernel extension... " >&6; }
if ${ac_cv_linuxmodule_net_device_polling+:} false; then :
Expand Down
10 changes: 10 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,16 @@ void f1(int64_t) { // will fail if long long and int64_t are the same type
AC_DEFINE([HAVE_LINUX_SKB_SHINFO_TX_FLAGS_SKBTX_DEV_ZEROCOPY], [1], [Define if 'struct skb_shared_info' has an 'tx_flags' member defining 'SKBTX_DEV_ZEROCOPY'.])
fi

AC_CACHE_CHECK([whether skb_shinfo has tx_flags.flags], [ac_cv_linuxmodule_skb_shinfo_tx_flags_union],
[AC_LANG_C
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([CLICK_LINUXMODULE_PROLOGUE()[
#include <linux/skbuff.h>]],
[[extern struct sk_buff *s; skb_shinfo(s)->tx_flags.flags = 0;]])],
[ac_cv_linuxmodule_skb_shinfo_tx_flags_union=yes], [ac_cv_linuxmodule_skb_shinfo_tx_flags_union=no])])
if test $ac_cv_linuxmodule_skb_shinfo_tx_flags_union = yes; then
AC_DEFINE([HAVE_LINUX_SKB_SHINFO_TX_FLAGS_UNION], [1], [Define if 'struct skb_shared_info' has a 'tx_flags.flags' member.])
fi

AC_CACHE_CHECK([for device polling kernel extension], [ac_cv_linuxmodule_net_device_polling],
[AC_LANG_C
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([CLICK_LINUXMODULE_PROLOGUE()[
Expand Down
3 changes: 3 additions & 0 deletions lib/packet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ Packet::expensive_uniqueify(int32_t extra_headroom, int32_t extra_tailroom,
# if HAVE_LINUX_SKB_SHINFO_IP6_FRAG_ID
nskb_shinfo->ip6_frag_id = 0;
# endif
# if HAVE_LINUX_SKB_SHINFO_TX_FLAGS_UNION
nskb_shinfo->tx_flags.flags = 0;
# endif
# if HAVE_LINUX_SKB_SHINFO_TX_FLAGS_SKBTX_DEV_ZEROCOPY
nskb_shinfo->tx_flags = 0;
# endif
Expand Down

0 comments on commit 88f1516

Please sign in to comment.