iw: use updated structures and enums for packet pattern
Subsystems (2)
PATCH v2 1/2 iw: use updated structures and enums for packet pattern
From: Amitkumar Karwar <[email protected]>
They are renamed so that they can be used for new feature.
--- 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
PATCH v2 2/2 iw: add coalesce support
From: Amitkumar Karwar <[email protected]>
User can add one coalesce rule at a time using 'iw coalesce add' command. The settings can be cleared using 'iw coalesce disable' command. 'iw coalesce show' displays current configuration.
--- Makefile | 2 +- coalesce.c | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ info.c | 14 ++++ 3 files changed, 247 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 +232 -0
232 lines not on this page · raw message
info.c +14 -0
@@ -528,6 +528,20 @@ 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" , + rule->max_rules, pat->max_patterns, pat->min_pattern_len, + pat->max_pattern_len, pat->max_pkt_offset); + } +return NL_SKIP ; }
Signature · 1 line
1.8.0
Quoted 3 lines · Bing Zhao
From: Amitkumar Karwar <[email protected]>
They are renamed so that they can be used for new feature.
This isn't really necessary, right? I mean, it should compile w/o this even after the kernel patches, but this is just for making it look nicer?
johannes
SGkgSm9oYW5uZXMsDQoNCj4gT24gVGh1LCAyMDEzLTA1LTIzIGF0IDE0OjM1IC0wNzAwLCBCaW5n IFpoYW8gd3JvdGU6DQo+ID4gRnJvbTogQW1pdGt1bWFyIEthcndhciA8YWthcndhckBtYXJ2ZWxs LmNvbT4NCj4gPg0KPiA+IFRoZXkgYXJlIHJlbmFtZWQgc28gdGhhdCB0aGV5IGNhbiBiZSB1c2Vk IGZvciBuZXcgZmVhdHVyZS4NCj4gDQo+IFRoaXMgaXNuJ3QgcmVhbGx5IG5lY2Vzc2FyeSwgcmln aHQ/IEkgbWVhbiwgaXQgc2hvdWxkIGNvbXBpbGUgdy9vIHRoaXMNCj4gZXZlbiBhZnRlciB0aGUg a2VybmVsIHBhdGNoZXMsIGJ1dCB0aGlzIGlzIGp1c3QgZm9yIG1ha2luZyBpdCBsb29rDQo+IG5p Y2VyPw0KDQpZZXMsIGl0IGNvbXBpbGVzIHcvbyB0aGlzIHBhdGNoLiBJdCBkb2VzIG1ha2UgaXQg bG9vayBuaWNlciwgSSB0aGluay4NCkhvd2V2ZXIsIHRoZSBjb21taXQgbWVzc2FnZSBzaG91bGQg YmUgc29tZXRoaW5nIGxpa2U6DQoNCiJUaGV5IGFyZSByZW5hbWVkIHRvIG1hdGNoIG5ldyBubDgw MjExLmggYW5kIG1ha2UgdGhlIGNvZGUgbG9vayBuaWNlci4iDQoNClBsZWFzZSBsZXQgbWUga25v dyBpZiB5b3Ugd2FudCBtZSB0byByZXNlbmQgMS8yIHdpdGggcmV2aXNlZCBjb21taXQgbG9nLg0K T3RoZXJ3aXNlLCBwbGVhc2Ugc2ltcGx5IGRyb3AgMS8yIGFuZCBhcHBseSAyLzIgYWxvbmUuDQoN ClRoYW5rcywNCkJpbmcNCg0K
Quoted 11 lines · Bing Zhao
Hi Johannes,
Quoted 8 lines · Bing Zhao
Quoted 3 lines
From: Amitkumar Karwar <[email protected]>
They are renamed so that they can be used for new feature.
This isn't really necessary, right? I mean, it should compile w/o this even after the kernel patches, but this is just for making it look nicer?
Quoted 7 lines
Yes, it compiles w/o this patch. It does make it look nicer, I think. However, the commit message should be something like:
"They are renamed to match new
nl80211.hand make the code look nicer."Please let me know if you want me to resend 1/2 with revised commit log. Otherwise, please simply drop 1/2 and apply 2/2 alone.
No, no need. Just wanted to double-check. I started going through the kernel side patches and had some comments, but I'm too tired to finish now.
johannes
SGkgSm9oYW5uZXMsDQoNCj4gPiBQbGVhc2UgbGV0IG1lIGtub3cgaWYgeW91IHdhbnQgbWUgdG8g cmVzZW5kIDEvMiB3aXRoIHJldmlzZWQgY29tbWl0IGxvZy4NCj4gPiBPdGhlcndpc2UsIHBsZWFz ZSBzaW1wbHkgZHJvcCAxLzIgYW5kIGFwcGx5IDIvMiBhbG9uZS4NCj4gDQo+IE5vLCBubyBuZWVk LiBKdXN0IHdhbnRlZCB0byBkb3VibGUtY2hlY2suIEkgc3RhcnRlZCBnb2luZyB0aHJvdWdoIHRo ZQ0KPiBrZXJuZWwgc2lkZSBwYXRjaGVzIGFuZCBoYWQgc29tZSBjb21tZW50cywgYnV0IEknbSB0 b28gdGlyZWQgdG8gZmluaXNoDQo+IG5vdy4NCg0KT0ssIE5vIGh1cnJ5Lg0KDQpUaGFua3MsDQpC aW5nDQo=