[wtp-kmod] replace some printk based tracing with ftrace events
This commit is contained in:
parent
57bcb0e183
commit
ecf7a24eac
24
README.md
24
README.md
@ -68,3 +68,27 @@ SmartCAPWAP:
|
||||
./configure --disable-ac
|
||||
make
|
||||
make install
|
||||
|
||||
### Debugging / Traceing
|
||||
|
||||
The smartcapwap kernel module defines a number of static ftrace events. For a detailed
|
||||
guide on how to use those, see: https://www.kernel.org/doc/Documentation/trace/ftrace.txt
|
||||
|
||||
A sample trace session might lock like this:
|
||||
|
||||
# echo 1 > /sys/kernel/debug/tracing/events/capwap/enable
|
||||
# echo 1 > /sys/kernel/debug/tracing/tracing_on
|
||||
# cat /sys/kernel/debug/tracing/trace_pipe
|
||||
<...>-890 [000] ...1 12030.725012: sc_capwap_create: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
<...>-890 [000] ...1 12030.725048: sc_capwap_sendkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
<...>-890 [000] ...1 12030.725052: sc_capwap_createkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
<...>-890 [000] ...1 12030.725053: sc_capwap_send: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
ksoftirqd/0-3 [000] ..s1 12030.727270: sc_capwap_parsingpacket: session:9e04b10c75b3c6537da18d38da5bc70d skb:ffff8802306c8900
|
||||
wtp-890 [001] ...1 12060.764008: sc_capwap_sendkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
wtp-890 [001] ...1 12060.764530: sc_capwap_createkeepalive: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
wtp-890 [001] ...1 12060.764637: sc_capwap_send: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
<idle>-0 [000] ..s2 12060.787527: sc_capwap_parsingpacket: session:9e04b10c75b3c6537da18d38da5bc70d skb:ffff8800b8a85900
|
||||
wtp-890 [001] ...1 12082.953847: sc_capwap_resetsession: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
wtp-890 [001] ...1 12082.954005: sc_capwap_close: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
wtp-890 [001] ...1 12082.954130: sc_capwap_freesession: session:9e04b10c75b3c6537da18d38da5bc70d
|
||||
# echo 0 > /sys/kernel/debug/tracing/tracing_on
|
||||
|
@ -5,3 +5,5 @@ smartcapwap-y := \
|
||||
netlinkapp.o \
|
||||
capwap.o \
|
||||
capwap_private.o
|
||||
|
||||
CFLAGS_capwap.o = -I$(src)
|
||||
|
486
src/wtp/kmod/capwap-trace.h
Normal file
486
src/wtp/kmod/capwap-trace.h
Normal file
@ -0,0 +1,486 @@
|
||||
#if !defined(__CAPWAP_DRIVER_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define __CAPWAP_DRIVER_TRACE_H
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
#include <net/mac80211.h>
|
||||
#include "capwap.h"
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM capwap
|
||||
|
||||
#define SESSION_ENTRY __array(char, sessionid, 16)
|
||||
#define SESSION_ASSIGN ((session) ? memcpy(__entry->sessionid, &session->sessionid, 16) : memset(__entry->sessionid, 0, 16))
|
||||
#define SESSION_PR_FMT " session:%16phN"
|
||||
#define SESSION_PR_ARG __entry->sessionid
|
||||
|
||||
#define SESSIONID_ENTRY __array(char, sessionid, 16)
|
||||
#define SESSIONID_ASSIGN ((sessionid) ? memcpy(__entry->sessionid, sessionid, 16) : memset(__entry->sessionid, 0, 16))
|
||||
#define SESSIONID_PR_FMT " session:%16phN"
|
||||
#define SESSIONID_PR_ARG __entry->sessionid
|
||||
|
||||
#define SKB_ENTRY __field(struct sk_buff *, skb)
|
||||
#define SKB_ASSIGN __entry->skb = skb
|
||||
#define SKB_PR_FMT " skb:%p"
|
||||
#define SKB_PR_ARG __entry->skb
|
||||
|
||||
#define FRAGMENT_ENTRY __field(struct sc_capwap_fragment *, fragment)
|
||||
#define FRAGMENT_ASSIGN __entry->fragment = fragment
|
||||
#define FRAGMENT_PR_FMT " frag:%p"
|
||||
#define FRAGMENT_PR_ARG __entry->fragment
|
||||
|
||||
#define BSSID_ENTRY __array(char, bssid, ETH_ALEN)
|
||||
#define BSSID_ASSIGN (bssid ? memcpy(__entry->bssid, bssid, ETH_ALEN) : memset(__entry->bssid, 0, ETH_ALEN))
|
||||
#define BSSID_PR_FMT " BSS:%pM"
|
||||
#define BSSID_PR_ARG __entry->bssid
|
||||
|
||||
/* capwap.c */
|
||||
|
||||
TRACE_EVENT(sc_capwap_fragment_free,
|
||||
TP_PROTO(struct sc_capwap_fragment *fragment),
|
||||
|
||||
TP_ARGS(fragment),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
FRAGMENT_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
FRAGMENT_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(FRAGMENT_PR_FMT, FRAGMENT_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_freesession,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_defrag_evictor,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_defrag_evictor_fragment_expired,
|
||||
TP_PROTO(struct sc_capwap_session *session,
|
||||
struct sc_capwap_fragment *fragment,
|
||||
ktime_t now),
|
||||
|
||||
TP_ARGS(session,
|
||||
fragment,
|
||||
now),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
FRAGMENT_ENTRY
|
||||
__field(u64, now)
|
||||
__field(u64, tstamp)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
FRAGMENT_ASSIGN;
|
||||
__entry->now = now.tv64;
|
||||
__entry->tstamp = fragment->tstamp.tv64;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT FRAGMENT_PR_FMT " (%llu %llu)",
|
||||
SESSION_PR_ARG, FRAGMENT_PR_ARG,
|
||||
__entry->now,
|
||||
__entry->tstamp
|
||||
)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_reasm,
|
||||
TP_PROTO(struct sc_capwap_fragment *fragment),
|
||||
|
||||
TP_ARGS(fragment),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
FRAGMENT_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
FRAGMENT_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(FRAGMENT_PR_FMT, FRAGMENT_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_defrag,
|
||||
TP_PROTO(struct sc_capwap_session *session,
|
||||
uint16_t id,
|
||||
uint16_t offset,
|
||||
uint16_t length),
|
||||
|
||||
TP_ARGS(session, id, offset, length),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
__field(u16, id)
|
||||
__field(u16, offset)
|
||||
__field(u16, length)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
__entry->id = id;
|
||||
__entry->offset = offset;
|
||||
__entry->length = length;
|
||||
),
|
||||
|
||||
TP_printk(
|
||||
SESSION_PR_FMT " fragment id:%hu offset:%hu length:%hu",
|
||||
SESSION_PR_ARG, __entry->id, __entry->offset, __entry->length
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// TRACEKMOD("** *Fragment info: id %hu offset %hu length %hu\n", frag_id, cb->frag_offset, cb->frag_length);
|
||||
|
||||
TRACE_EVENT(sc_capwap_8023_to_80211,
|
||||
TP_PROTO(struct sk_buff *skb, const uint8_t *bssid),
|
||||
|
||||
TP_ARGS(skb, bssid),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SKB_ENTRY
|
||||
BSSID_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SKB_ASSIGN;
|
||||
BSSID_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(
|
||||
SKB_PR_FMT BSSID_PR_FMT,
|
||||
SKB_PR_ARG, BSSID_PR_ARG
|
||||
)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_80211_to_8023,
|
||||
TP_PROTO(struct sk_buff *skb),
|
||||
|
||||
TP_ARGS(skb),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SKB_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SKB_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SKB_PR_FMT, SKB_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_create,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_close,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_newfragmentid,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_createkeepalive,
|
||||
TP_PROTO(struct sc_capwap_sessionid_element *sessionid),
|
||||
|
||||
TP_ARGS(sessionid),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSIONID_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSIONID_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSIONID_PR_FMT, SESSIONID_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_parsingpacket,
|
||||
TP_PROTO(struct sc_capwap_session *session,
|
||||
struct sk_buff *skb),
|
||||
|
||||
TP_ARGS(session, skb),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
SKB_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
SKB_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(
|
||||
SESSION_PR_FMT SKB_PR_FMT,
|
||||
SESSION_PR_ARG, SKB_PR_ARG
|
||||
)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_forwarddata,
|
||||
TP_PROTO(struct sc_capwap_session *session,
|
||||
uint8_t radioid,
|
||||
uint8_t binding,
|
||||
struct sk_buff *skb,
|
||||
uint32_t flags,
|
||||
struct sc_capwap_radio_addr *radioaddr,
|
||||
int radioaddrlength,
|
||||
struct sc_capwap_wireless_information *winfo),
|
||||
|
||||
TP_ARGS(session, radioid, binding, skb, flags, radioaddr, radioaddrlength, winfo),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
__field(u8, radioid)
|
||||
__field(u8, binding)
|
||||
SKB_ENTRY
|
||||
__field(u32, flags)
|
||||
__field(int, radioaddrlength)
|
||||
__array(char, radioaddr, 8)
|
||||
__field(u8, rssi)
|
||||
__field(u8, snr)
|
||||
__field(u16, rate)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
__entry->radioid = radioid;
|
||||
__entry->binding = binding;
|
||||
SKB_ASSIGN;
|
||||
__entry->binding = flags;
|
||||
__entry->radioaddrlength = radioaddrlength;
|
||||
((radioaddrlength != 0 && radioaddr) ? memcpy(__entry->radioaddr, radioaddr, min(radioaddrlength, 8)) : memset(__entry->radioaddr, 0, 8));
|
||||
|
||||
__entry->rssi = (winfo) ? ((struct sc_capwap_ieee80211_frame_info *)(winfo))->rssi : 0;
|
||||
__entry->snr = (winfo) ? ((struct sc_capwap_ieee80211_frame_info *)(winfo))->snr : 0;
|
||||
__entry->rate = (winfo) ? ((struct sc_capwap_ieee80211_frame_info *)(winfo))->rate : 0;
|
||||
),
|
||||
|
||||
TP_printk(
|
||||
SESSION_PR_FMT " radio:%d binding:%d" SKB_PR_FMT
|
||||
"radioaddr:%*phC rssid:%d snr:%d rate:%d",
|
||||
SESSION_PR_ARG, __entry->radioid, __entry->binding, SKB_PR_ARG,
|
||||
min(__entry->radioaddrlength, 8), __entry->radioaddr,
|
||||
__entry->rssi, __entry->snr, __entry->rate
|
||||
)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_setradiomacaddress,
|
||||
TP_PROTO(uint8_t *bssid),
|
||||
|
||||
TP_ARGS(bssid),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
BSSID_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
BSSID_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(BSSID_PR_FMT, BSSID_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_setwinfo_frameinfo,
|
||||
TP_PROTO(uint8_t rssi,
|
||||
uint8_t snr,
|
||||
uint16_t rate),
|
||||
|
||||
TP_ARGS(rssi, snr, rate),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(u8, rssi)
|
||||
__field(u8, snr)
|
||||
__field(u16, rate)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->rssi = rssi;
|
||||
__entry->snr = snr;
|
||||
__entry->rate = rate;
|
||||
),
|
||||
|
||||
TP_printk(
|
||||
" rssid:%d snr:%d rate:%d",
|
||||
__entry->rssi, __entry->snr, __entry->rate
|
||||
)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_setwinfo_destwlans,
|
||||
TP_PROTO(uint16_t wlanidbitmap),
|
||||
|
||||
TP_ARGS(wlanidbitmap),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(u16, wlanidbitmap)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__entry->wlanidbitmap = wlanidbitmap;
|
||||
),
|
||||
|
||||
TP_printk(" id:%04x", __entry->wlanidbitmap)
|
||||
);
|
||||
|
||||
/* capwap_private.c */
|
||||
|
||||
TRACE_EVENT(sc_capwap_resetsession,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_sendkeepalive,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_send,
|
||||
TP_PROTO(struct sc_capwap_session *session),
|
||||
|
||||
TP_ARGS(session),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(SESSION_PR_FMT, SESSION_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_send_80211,
|
||||
TP_PROTO(struct sk_buff *skb, struct net_device *dev),
|
||||
|
||||
TP_ARGS(skb, dev),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SKB_ENTRY
|
||||
__array(char, dev_name, 32)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SKB_ASSIGN;
|
||||
strlcpy(__entry->dev_name, dev->name, 32);
|
||||
),
|
||||
|
||||
TP_printk(" %s" SKB_PR_FMT, __entry->dev_name, SKB_PR_ARG)
|
||||
);
|
||||
|
||||
TRACE_EVENT(sc_capwap_parsingdatapacket,
|
||||
TP_PROTO(struct sc_capwap_session *session,
|
||||
struct sk_buff *skb),
|
||||
|
||||
TP_ARGS(session, skb),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SESSION_ENTRY
|
||||
SKB_ENTRY
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SESSION_ASSIGN;
|
||||
SKB_ASSIGN;
|
||||
),
|
||||
|
||||
TP_printk(
|
||||
SESSION_PR_FMT SKB_PR_FMT,
|
||||
SESSION_PR_ARG, SKB_PR_ARG
|
||||
)
|
||||
);
|
||||
|
||||
#endif /* !__CAPWAP_DRIVER_TRACE_H || TRACE_HEADER_MULTI_READ */
|
||||
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
#undef TRACE_INCLUDE_FILE
|
||||
#define TRACE_INCLUDE_FILE capwap-trace
|
||||
#include <trace/define_trace.h>
|
@ -10,6 +10,9 @@
|
||||
#include "nlsmartcapwap.h"
|
||||
#include "netlinkapp.h"
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "capwap-trace.h"
|
||||
|
||||
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
|
||||
static const unsigned char sc_rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
|
||||
|
||||
@ -19,7 +22,7 @@ static const unsigned char sc_bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03, 0x00,
|
||||
/* */
|
||||
static void sc_capwap_fragment_free(struct sc_capwap_fragment* fragment)
|
||||
{
|
||||
TRACEKMOD("### sc_capwap_fragment_free\n");
|
||||
trace_sc_capwap_fragment_free(fragment);
|
||||
|
||||
/* */
|
||||
list_del(&fragment->lru_list);
|
||||
@ -42,7 +45,7 @@ static void sc_capwap_freesession(struct sc_capwap_session* session)
|
||||
struct sc_capwap_fragment* fragment;
|
||||
struct sc_station *sta;
|
||||
|
||||
TRACEKMOD("### sc_capwap_freesession\n");
|
||||
trace_sc_capwap_freesession(session);
|
||||
|
||||
/* Free socket buffers */
|
||||
list_for_each_entry_safe(fragment, temp, &session->fragments.lru_list, lru_list) {
|
||||
@ -63,7 +66,7 @@ static void sc_capwap_defrag_evictor(struct sc_capwap_session* session, ktime_t
|
||||
struct sc_capwap_fragment* fragment;
|
||||
struct list_head* list = &session->fragments.lru_list;
|
||||
|
||||
TRACEKMOD("### sc_capwap_defrag_evictor\n");
|
||||
trace_sc_capwap_defrag_evictor(session);
|
||||
|
||||
/* Light check without lock */
|
||||
if (!list_empty(list)) {
|
||||
@ -74,7 +77,7 @@ static void sc_capwap_defrag_evictor(struct sc_capwap_session* session, ktime_t
|
||||
fragment = list_first_entry(list, struct sc_capwap_fragment, lru_list);
|
||||
delta = ktime_sub(now, fragment->tstamp);
|
||||
if ((delta.tv64 < -NSEC_PER_SEC) || (delta.tv64 > NSEC_PER_SEC)) {
|
||||
TRACEKMOD("*** Expired fragment %hu (%llu %llu)\n", fragment->fragmentid, now.tv64, fragment->tstamp.tv64);
|
||||
trace_sc_capwap_defrag_evictor_fragment_expired(session, fragment, now);
|
||||
sc_capwap_fragment_free(fragment);
|
||||
}
|
||||
}
|
||||
@ -91,7 +94,7 @@ static struct sk_buff* sc_capwap_reasm(struct sc_capwap_fragment* fragment) {
|
||||
struct sk_buff* skbfrag;
|
||||
struct sc_capwap_header* header;
|
||||
|
||||
TRACEKMOD("### sc_capwap_reasm\n");
|
||||
trace_sc_capwap_reasm(fragment);
|
||||
|
||||
/* */
|
||||
skbfrag = fragment->fragments;
|
||||
@ -140,8 +143,6 @@ static struct sk_buff* sc_capwap_defrag(struct sc_capwap_session* session, struc
|
||||
struct sk_buff* skb_defrag = NULL;
|
||||
struct sc_capwap_header* header = (struct sc_capwap_header*)skb->data;
|
||||
|
||||
TRACEKMOD("### sc_capwap_defrag\n");
|
||||
|
||||
/* */
|
||||
headersize = GET_HLEN_HEADER(header) * 4;
|
||||
if (skb->len < headersize) {
|
||||
@ -157,9 +158,10 @@ static struct sk_buff* sc_capwap_defrag(struct sc_capwap_session* session, struc
|
||||
cb->frag_offset = be16_to_cpu(header->frag_off);
|
||||
cb->frag_length = skb->len - headersize;
|
||||
|
||||
trace_sc_capwap_defrag(session, frag_id, cb->frag_offset, cb->frag_length);
|
||||
|
||||
/* */
|
||||
spin_lock(&session->fragments.lock);
|
||||
TRACEKMOD("*** Fragment info: id %hu offset %hu length %hu\n", frag_id, cb->frag_offset, cb->frag_length);
|
||||
|
||||
/* Get fragment */
|
||||
fragment = &session->fragments.queues[frag_id % CAPWAP_FRAGMENT_QUEUE];
|
||||
@ -266,8 +268,6 @@ error:
|
||||
static unsigned int sc_capwap_80211_hdrlen(__le16 fc) {
|
||||
unsigned int hdrlen = 24;
|
||||
|
||||
TRACEKMOD("### sc_capwap_80211_hdrlen\n");
|
||||
|
||||
if (ieee80211_is_data(fc)) {
|
||||
if (ieee80211_has_a4(fc)) {
|
||||
hdrlen = 30;
|
||||
@ -301,7 +301,7 @@ int sc_capwap_8023_to_80211(struct sk_buff* skb, const uint8_t* bssid) {
|
||||
struct ethhdr* eh = (struct ethhdr*)skb->data;
|
||||
uint16_t ethertype = ntohs(eh->h_proto);
|
||||
|
||||
TRACEKMOD("### sc_capwap_8023_to_80211\n");
|
||||
trace_sc_capwap_8023_to_80211(skb, bssid);
|
||||
|
||||
/* IEEE 802.11 header */
|
||||
hdrlen = 24;
|
||||
@ -367,7 +367,7 @@ int sc_capwap_80211_to_8023(struct sk_buff* skb) {
|
||||
uint8_t dst[ETH_ALEN];
|
||||
uint8_t src[ETH_ALEN] __aligned(2);
|
||||
|
||||
TRACEKMOD("### sc_capwap_80211_to_8023\n");
|
||||
trace_sc_capwap_80211_to_8023(skb);
|
||||
|
||||
/* */
|
||||
hdrlen = sc_capwap_80211_hdrlen(hdr->frame_control);
|
||||
@ -411,7 +411,7 @@ int sc_capwap_create(struct sc_capwap_session *session)
|
||||
.encap_rcv = sc_capwap_recvpacket
|
||||
};
|
||||
|
||||
TRACEKMOD("### sc_capwap_bind\n");
|
||||
trace_sc_capwap_create(session);
|
||||
|
||||
if (session->socket)
|
||||
return -EBUSY;
|
||||
@ -441,7 +441,7 @@ error:
|
||||
|
||||
void sc_capwap_close(struct sc_capwap_session *session)
|
||||
{
|
||||
TRACEKMOD("### sc_capwap_close\n");
|
||||
trace_sc_capwap_close(session);
|
||||
|
||||
if (session->socket)
|
||||
udp_tunnel_sock_release(session->socket);
|
||||
@ -453,7 +453,7 @@ void sc_capwap_close(struct sc_capwap_session *session)
|
||||
/* */
|
||||
static uint16_t sc_capwap_newfragmentid(struct sc_capwap_session* session)
|
||||
{
|
||||
TRACEKMOD("### sc_capwap_newfragmentid\n");
|
||||
trace_sc_capwap_newfragmentid(session);
|
||||
|
||||
return atomic_inc_return(&session->fragmentid) & 0xFFFF;
|
||||
}
|
||||
@ -465,7 +465,7 @@ int sc_capwap_createkeepalive(struct sc_capwap_sessionid_element* sessionid, uin
|
||||
struct sc_capwap_data_message* dataheader;
|
||||
struct sc_capwap_message_element* msgelement;
|
||||
|
||||
TRACEKMOD("### sc_capwap_createkeepalive\n");
|
||||
trace_sc_capwap_createkeepalive(sessionid);
|
||||
|
||||
/* */
|
||||
if (size < CAPWAP_KEEP_ALIVE_MAX_SIZE) {
|
||||
@ -515,7 +515,7 @@ int sc_capwap_parsingpacket(struct sc_capwap_session* session,
|
||||
struct sc_capwap_message_element* message;
|
||||
struct sc_capwap_header* header = (struct sc_capwap_header*)skb->data;
|
||||
|
||||
TRACEKMOD("### sc_capwap_parsingpacket\n");
|
||||
trace_sc_capwap_parsingpacket(session, skb);
|
||||
|
||||
/* Linearize socket buffer */
|
||||
if (skb_linearize(skb)) {
|
||||
@ -659,7 +659,7 @@ int sc_capwap_forwarddata(struct sc_capwap_session* session,
|
||||
struct sk_buff* clone = NULL;
|
||||
int packetlength = skb->len;
|
||||
|
||||
TRACEKMOD("### sc_capwap_forwarddata\n");
|
||||
trace_sc_capwap_forwarddata(session, radioid, binding, skb, flags, radioaddr, radioaddrlength, winfo);
|
||||
|
||||
/* Check headroom */
|
||||
headroom = skb_headroom(skb);
|
||||
@ -754,25 +754,12 @@ int sc_capwap_forwarddata(struct sc_capwap_session* session,
|
||||
return (!packetlength ? 0 : -EIO);
|
||||
}
|
||||
|
||||
/* */
|
||||
void sc_capwap_sessionid_printf(const struct sc_capwap_sessionid_element* sessionid, char* string) {
|
||||
int i;
|
||||
char* pos = string;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
snprintf(pos, 3, "%02x", sessionid->id[i]);
|
||||
pos += 2;
|
||||
}
|
||||
|
||||
*pos = 0;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct sc_capwap_radio_addr* sc_capwap_setradiomacaddress(uint8_t* buffer, int size, uint8_t* bssid) {
|
||||
struct sc_capwap_radio_addr* radioaddr;
|
||||
struct sc_capwap_macaddress_eui48* addr;
|
||||
|
||||
TRACEKMOD("### sc_capwap_setwirelessinformation\n");
|
||||
trace_sc_capwap_setradiomacaddress(bssid);
|
||||
|
||||
memset(buffer, 0, size);
|
||||
|
||||
@ -790,7 +777,7 @@ struct sc_capwap_wireless_information* sc_capwap_setwinfo_frameinfo(uint8_t* buf
|
||||
struct sc_capwap_wireless_information* winfo;
|
||||
struct sc_capwap_ieee80211_frame_info* frameinfo;
|
||||
|
||||
TRACEKMOD("### sc_capwap_setwinfo_frameinfo\n");
|
||||
trace_sc_capwap_setwinfo_frameinfo(rssi, snr, rate);
|
||||
|
||||
memset(buffer, 0, size);
|
||||
|
||||
@ -810,7 +797,7 @@ struct sc_capwap_wireless_information* sc_capwap_setwinfo_destwlans(uint8_t* buf
|
||||
struct sc_capwap_wireless_information* winfo;
|
||||
struct sc_capwap_destination_wlans* destwlans;
|
||||
|
||||
TRACEKMOD("### sc_capwap_setwinfo_destwlans\n");
|
||||
trace_sc_capwap_setwinfo_destwlans(wlanidbitmap);
|
||||
|
||||
memset(buffer, 0, size);
|
||||
|
||||
|
@ -139,8 +139,6 @@ void sc_capwap_close(struct sc_capwap_session *session);
|
||||
int sc_capwap_8023_to_80211(struct sk_buff* skb, const uint8_t* bssid);
|
||||
int sc_capwap_80211_to_8023(struct sk_buff* skb);
|
||||
|
||||
void sc_capwap_sessionid_printf(const struct sc_capwap_sessionid_element* sessionid, char* string);
|
||||
|
||||
int sc_capwap_createkeepalive(struct sc_capwap_sessionid_element* sessionid, uint8_t* buffer, int size);
|
||||
int sc_capwap_parsingpacket(struct sc_capwap_session* session, struct sk_buff* skb);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "capwap.h"
|
||||
#include "nlsmartcapwap.h"
|
||||
#include "netlinkapp.h"
|
||||
#include "capwap-trace.h"
|
||||
|
||||
/* */
|
||||
int sc_capwap_init(struct sc_capwap_session *session, struct net *net)
|
||||
@ -42,7 +43,7 @@ int sc_capwap_init(struct sc_capwap_session *session, struct net *net)
|
||||
/* */
|
||||
void sc_capwap_resetsession(struct sc_capwap_session *session)
|
||||
{
|
||||
TRACEKMOD("### sc_capwap_resetsession\n");
|
||||
trace_sc_capwap_resetsession(session);
|
||||
|
||||
sc_capwap_close(session);
|
||||
sc_capwap_init(session, session->net);
|
||||
@ -55,7 +56,7 @@ int sc_capwap_sendkeepalive(struct sc_capwap_session *session)
|
||||
int length;
|
||||
uint8_t buffer[CAPWAP_KEEP_ALIVE_MAX_SIZE];
|
||||
|
||||
TRACEKMOD("### sc_capwap_sendkeepalive\n");
|
||||
trace_sc_capwap_sendkeepalive(session);
|
||||
|
||||
/* Build keepalive */
|
||||
length = sc_capwap_createkeepalive(&session->sessionid, buffer, CAPWAP_KEEP_ALIVE_MAX_SIZE);
|
||||
@ -80,7 +81,7 @@ int sc_capwap_send(struct sc_capwap_session *session, uint8_t* buffer, int lengt
|
||||
.msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL,
|
||||
};
|
||||
|
||||
TRACEKMOD("### sc_capwap_send\n");
|
||||
trace_sc_capwap_send(session);
|
||||
|
||||
return kernel_sendmsg(session->socket, &msg, &vec, 1, vec.iov_len);
|
||||
}
|
||||
@ -170,8 +171,7 @@ static void sc_send_80211(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
|
||||
printk(KERN_DEBUG "capwap inject: %s: hdr: %p\n",
|
||||
dev->name, skb->data);
|
||||
trace_sc_send_80211(skb, dev);
|
||||
|
||||
/* detach skb from CAPWAP */
|
||||
skb_orphan(skb);
|
||||
@ -213,7 +213,7 @@ void sc_capwap_parsingdatapacket(struct sc_capwap_session* session, struct sk_bu
|
||||
struct sc_capwap_destination_wlans* destwlan = NULL;
|
||||
int winfosize = 0;
|
||||
|
||||
TRACEKMOD("### sc_capwap_parsingdatapacket\n");
|
||||
trace_sc_capwap_parsingdatapacket(session, skb);
|
||||
|
||||
/* Retrieve optional attribute */
|
||||
pos = skb->data + sizeof(struct sc_capwap_header);
|
||||
|
Loading…
Reference in New Issue
Block a user