iw: use updated structures and enums for packet pattern
Subsystems (2)
PATCH v5 2/2 iw: add coalesce support
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
User can configure multiple coalesce rules using 'iw coalesce enable <config-file>' command. The setting can be cleared using 'iw coalesce disable' command. 'iw coalesce show' displays current configuration.
---
depends on nl80211.h patch:
cfg80211/nl80211: Add packet coalesce support
v3: match cfg80211/nl80211 structures v3 patchset
v5: match cfg80211/nl80211 structures v5 patchset
provide coalesce configurations through file
Makefile | 2 +- coalesce.c | 285 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ info.c | 15 ++++ 3 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 coalesce.c
Makefile +1 -1
@@ -16,7 +16,7 @@ OBJS = iw.o genl.o event.o info.o phy.o \ interface.o ibss.o station.o survey.o util.o \ mesh.o mpath.o scan.o reg.o version.o \ reason.o status.o connect.o link.o offch.o ps.o cqm.o \ - bitrate.o wowlan.o roc.o p2p.o + bitrate.o wowlan.o coalesce.o roc.o p2p.o OBJS += sections.o OBJS-$(HWSIM) += hwsim.o
coalesce.c new file +285 -0
285 lines not on this page · raw message
info.c +15 -0
@@ -528,6 +528,21 @@ broken_combination:printf ("\tDevice supports AP scan.\n" ); } +if (tb_msg[NL80211_ATTR_COALESCE_RULE ]) { +struct nl80211_coalesce_rule_support *rule; +struct nl80211_pattern_support *pat; + +printf ("\tCoalesce support:\n" ); + rule =nla_data (tb_msg[NL80211_ATTR_COALESCE_RULE ]); + pat = &rule->pat; +printf ("\t\t * Maximum %u coalesce rules supported\n" +"\t\t * Each rule contains upto %u patterns of %u-%u bytes,\n" +"\t\t maximum packet offset %u bytes\n" +"\t\t * Maximum supported coalescing delay %u msecs\n" , + rule->max_rules, pat->max_patterns, pat->min_pattern_len, + pat->max_pattern_len, pat->max_pkt_offset, rule->max_delay); + } +return NL_SKIP ; }
Signature · 1 line
1.8.0
PATCH v5 1/2 iw: use updated structures and enums for packet pattern
From: Amitkumar Karwar <[email protected]>
They are renamed in new nl80211.h so that they can be used for new feature. This patch uses those updated structures and enums to make the code look nicer.
---
depends on nl80211.h patch:
cfg80211/nl80211: rename packet pattern related structures and enums
v3: use new structure/enum names to make the code look nicer
v5: no change since v3. Resend as v5 series
info.c | 2 +- wowlan.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-)
info.c +1 -1
@@ -432,7 +432,7 @@ broken_combination: [NL80211_WOWLAN_TRIG_RFKILL_RELEASE] = { .type = NLA_FLAG }, [NL80211_WOWLAN_TRIG_TCP_CONNECTION] = { .type = NLA_NESTED }, }; -struct nl80211_wowlan_pattern_support *pat; +struct nl80211_pattern_support *pat;int err; err = nla_parse_nested(tb_wowlan, MAX_NL80211_WOWLAN_TRIG,
wowlan.c +16 -16
@@ -261,11 +261,11 @@ static int handle_wowlan_enable(struct nl80211_state *state, struct nl_cb *cb, } pattern =nla_nest_start (patterns, ++patnum); -NLA_PUT (patterns,NL80211_WOWLAN_PKTPAT_MASK , +NLA_PUT (patterns,NL80211_PKTPAT_MASK ,DIV_ROUND_UP (patlen,8 ), mask); -NLA_PUT (patterns,NL80211_WOWLAN_PKTPAT_PATTERN , - patlen, pat); -NLA_PUT_U32 (patterns,NL80211_WOWLAN_PKTPAT_OFFSET , pkt_offset); +NLA_PUT (patterns,NL80211_PKTPAT_PATTERN , patlen, pat); +NLA_PUT_U32 (patterns,NL80211_PKTPAT_OFFSET , + pkt_offset);nla_nest_end (patterns, pattern);free (mask);free (pat);
@@ -356,29 +356,29 @@ static int print_wowlan_handler(struct nl_msg *msg, void *arg)nla_for_each_nested (pattern, trig[NL80211_WOWLAN_TRIG_PKT_PATTERN ], rem_pattern) { -struct nlattr *patattr[NUM_NL80211_WOWLAN_PKTPAT ]; +struct nlattr *patattr[NUM_NL80211_PKTPAT ];int i, patlen, masklen, pkt_offset;uint8_t *mask, *pat; -nla_parse (patattr,MAX_NL80211_WOWLAN_PKTPAT , -nla_data (pattern),nla_len (pattern), -NULL ); -if (!patattr[NL80211_WOWLAN_PKTPAT_MASK ] || - !patattr[NL80211_WOWLAN_PKTPAT_PATTERN ] || - !patattr[NL80211_WOWLAN_PKTPAT_OFFSET ]) { +nla_parse (patattr,MAX_NL80211_PKTPAT , +nla_data (pattern),nla_len (pattern),NULL ); +if (!patattr[NL80211_PKTPAT_MASK ] || + !patattr[NL80211_PKTPAT_PATTERN ] || + !patattr[NL80211_PKTPAT_OFFSET ]) {printf (" * (invalid pattern specification)\n" );continue ; } - masklen =nla_len (patattr[NL80211_WOWLAN_PKTPAT_MASK ]); - patlen =nla_len (patattr[NL80211_WOWLAN_PKTPAT_PATTERN ]); - pkt_offset =nla_get_u32 (patattr[NL80211_WOWLAN_PKTPAT_OFFSET ]); + masklen =nla_len (patattr[NL80211_PKTPAT_MASK ]); + patlen =nla_len (patattr[NL80211_PKTPAT_PATTERN ]); + pkt_offset = +nla_get_u32 (patattr[NL80211_PKTPAT_OFFSET ]);if (DIV_ROUND_UP (patlen,8 ) != masklen) {printf (" * (invalid pattern specification)\n" );continue ; }printf (" * wake up on packet offset: %d" , pkt_offset);printf (" pattern: " ); - pat =nla_data (patattr[NL80211_WOWLAN_PKTPAT_PATTERN ]); - mask =nla_data (patattr[NL80211_WOWLAN_PKTPAT_MASK ]); + pat =nla_data (patattr[NL80211_PKTPAT_PATTERN ]); + mask =nla_data (patattr[NL80211_PKTPAT_MASK ]);for (i =0 ; i < patlen; i++) {if (mask[i /8 ] & (1 << (i %8 )))printf ("%.2x" , pat[i]);
Signature · 1 line
1.8.0
Quoted 5 lines · Bing Zhao
From: Amitkumar Karwar <[email protected]>
They are renamed in new
nl80211.hso that they can be used for new feature. This patch uses those updated structures and enums to make the code look nicer.
Both applied, thanks.
johannes