aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2013-06-28 14:51:26 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-07-16 02:58:00 -0400
commitbe29b99a9b51b0338eea3c66a58de53bbd01de24 (patch)
treeabd4b2831ca396dddda2ea8bb02a39b12ea2a1b4 /include
parenta144f378a489b5900c028425cb0d0a7a3fc8c1c1 (diff)
cfg80211/nl80211: Add packet coalesce support
In most cases, host that receives IPv4 and IPv6 multicast/broadcast packets does not do anything with these packets. Therefore the reception of these unwanted packets causes unnecessary processing and power consumption. Packet coalesce feature helps to reduce number of received interrupts to host by buffering these packets in firmware/hardware for some predefined time. Received interrupt will be generated when one of the following events occur. a) Expiration of hardware timer whose expiration time is set to maximum coalescing delay of matching coalesce rule. b) Coalescing buffer in hardware reaches it's limit. c) Packet doesn't match any of the configured coalesce rules. This patch adds set/get configuration support for packet coalesce. User needs to configure following parameters for creating a coalesce rule. a) Maximum coalescing delay b) List of packet patterns which needs to be matched c) Condition for coalescence. pattern 'match' or 'no match' Multiple such rules can be created. This feature needs to be advertised during driver initialization. Drivers are supposed to do required firmware/hardware settings based on user configuration. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> [fix kernel-doc, change free function, fix copy/paste error] Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/cfg80211.h54
-rw-r--r--include/uapi/linux/nl80211.h90
2 files changed, 142 insertions, 2 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 49409602fe3d..071ed2395c9a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1781,6 +1781,35 @@ struct cfg80211_wowlan {
1781}; 1781};
1782 1782
1783/** 1783/**
1784 * struct cfg80211_coalesce_rules - Coalesce rule parameters
1785 *
1786 * This structure defines coalesce rule for the device.
1787 * @delay: maximum coalescing delay in msecs.
1788 * @condition: condition for packet coalescence.
1789 * see &enum nl80211_coalesce_condition.
1790 * @patterns: array of packet patterns
1791 * @n_patterns: number of patterns
1792 */
1793struct cfg80211_coalesce_rules {
1794 int delay;
1795 enum nl80211_coalesce_condition condition;
1796 struct cfg80211_pkt_pattern *patterns;
1797 int n_patterns;
1798};
1799
1800/**
1801 * struct cfg80211_coalesce - Packet coalescing settings
1802 *
1803 * This structure defines coalescing settings.
1804 * @rules: array of coalesce rules
1805 * @n_rules: number of rules
1806 */
1807struct cfg80211_coalesce {
1808 struct cfg80211_coalesce_rules *rules;
1809 int n_rules;
1810};
1811
1812/**
1784 * struct cfg80211_wowlan_wakeup - wakeup report 1813 * struct cfg80211_wowlan_wakeup - wakeup report
1785 * @disconnect: woke up by getting disconnected 1814 * @disconnect: woke up by getting disconnected
1786 * @magic_pkt: woke up by receiving magic packet 1815 * @magic_pkt: woke up by receiving magic packet
@@ -2076,6 +2105,7 @@ struct cfg80211_update_ft_ies_params {
2076 * driver can take the most appropriate actions. 2105 * driver can take the most appropriate actions.
2077 * @crit_proto_stop: Indicates critical protocol no longer needs increased link 2106 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
2078 * reliability. This operation can not fail. 2107 * reliability. This operation can not fail.
2108 * @set_coalesce: Set coalesce parameters.
2079 */ 2109 */
2080struct cfg80211_ops { 2110struct cfg80211_ops {
2081 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2111 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2311,6 +2341,8 @@ struct cfg80211_ops {
2311 u16 duration); 2341 u16 duration);
2312 void (*crit_proto_stop)(struct wiphy *wiphy, 2342 void (*crit_proto_stop)(struct wiphy *wiphy,
2313 struct wireless_dev *wdev); 2343 struct wireless_dev *wdev);
2344 int (*set_coalesce)(struct wiphy *wiphy,
2345 struct cfg80211_coalesce *coalesce);
2314}; 2346};
2315 2347
2316/* 2348/*
@@ -2537,6 +2569,25 @@ struct wiphy_wowlan_support {
2537}; 2569};
2538 2570
2539/** 2571/**
2572 * struct wiphy_coalesce_support - coalesce support data
2573 * @n_rules: maximum number of coalesce rules
2574 * @max_delay: maximum supported coalescing delay in msecs
2575 * @n_patterns: number of supported patterns in a rule
2576 * (see nl80211.h for the pattern definition)
2577 * @pattern_max_len: maximum length of each pattern
2578 * @pattern_min_len: minimum length of each pattern
2579 * @max_pkt_offset: maximum Rx packet offset
2580 */
2581struct wiphy_coalesce_support {
2582 int n_rules;
2583 int max_delay;
2584 int n_patterns;
2585 int pattern_max_len;
2586 int pattern_min_len;
2587 int max_pkt_offset;
2588};
2589
2590/**
2540 * struct wiphy - wireless hardware description 2591 * struct wiphy - wireless hardware description
2541 * @reg_notifier: the driver's regulatory notification callback, 2592 * @reg_notifier: the driver's regulatory notification callback,
2542 * note that if your driver uses wiphy_apply_custom_regulatory() 2593 * note that if your driver uses wiphy_apply_custom_regulatory()
@@ -2646,6 +2697,7 @@ struct wiphy_wowlan_support {
2646 * 802.11-2012 8.4.2.29 for the defined fields. 2697 * 802.11-2012 8.4.2.29 for the defined fields.
2647 * @extended_capabilities_mask: mask of the valid values 2698 * @extended_capabilities_mask: mask of the valid values
2648 * @extended_capabilities_len: length of the extended capabilities 2699 * @extended_capabilities_len: length of the extended capabilities
2700 * @coalesce: packet coalescing support information
2649 */ 2701 */
2650struct wiphy { 2702struct wiphy {
2651 /* assign these fields before you register the wiphy */ 2703 /* assign these fields before you register the wiphy */
@@ -2755,6 +2807,8 @@ struct wiphy {
2755 const struct iw_handler_def *wext; 2807 const struct iw_handler_def *wext;
2756#endif 2808#endif
2757 2809
2810 const struct wiphy_coalesce_support *coalesce;
2811
2758 char priv[0] __aligned(NETDEV_ALIGN); 2812 char priv[0] __aligned(NETDEV_ALIGN);
2759}; 2813};
2760 2814
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index de0ce809068a..5abc54d14d4d 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -126,6 +126,31 @@
126 */ 126 */
127 127
128/** 128/**
129 * DOC: packet coalesce support
130 *
131 * In most cases, host that receives IPv4 and IPv6 multicast/broadcast
132 * packets does not do anything with these packets. Therefore the
133 * reception of these unwanted packets causes unnecessary processing
134 * and power consumption.
135 *
136 * Packet coalesce feature helps to reduce number of received interrupts
137 * to host by buffering these packets in firmware/hardware for some
138 * predefined time. Received interrupt will be generated when one of the
139 * following events occur.
140 * a) Expiration of hardware timer whose expiration time is set to maximum
141 * coalescing delay of matching coalesce rule.
142 * b) Coalescing buffer in hardware reaches it's limit.
143 * c) Packet doesn't match any of the configured coalesce rules.
144 *
145 * User needs to configure following parameters for creating a coalesce
146 * rule.
147 * a) Maximum coalescing delay
148 * b) List of packet patterns which needs to be matched
149 * c) Condition for coalescence. pattern 'match' or 'no match'
150 * Multiple such rules can be created.
151 */
152
153/**
129 * enum nl80211_commands - supported nl80211 commands 154 * enum nl80211_commands - supported nl80211 commands
130 * 155 *
131 * @NL80211_CMD_UNSPEC: unspecified command to catch errors 156 * @NL80211_CMD_UNSPEC: unspecified command to catch errors
@@ -648,6 +673,9 @@
648 * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can 673 * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can
649 * return back to normal. 674 * return back to normal.
650 * 675 *
676 * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules.
677 * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules.
678 *
651 * @NL80211_CMD_MAX: highest used command number 679 * @NL80211_CMD_MAX: highest used command number
652 * @__NL80211_CMD_AFTER_LAST: internal use 680 * @__NL80211_CMD_AFTER_LAST: internal use
653 */ 681 */
@@ -810,6 +838,9 @@ enum nl80211_commands {
810 NL80211_CMD_CRIT_PROTOCOL_START, 838 NL80211_CMD_CRIT_PROTOCOL_START,
811 NL80211_CMD_CRIT_PROTOCOL_STOP, 839 NL80211_CMD_CRIT_PROTOCOL_STOP,
812 840
841 NL80211_CMD_GET_COALESCE,
842 NL80211_CMD_SET_COALESCE,
843
813 /* add new commands above here */ 844 /* add new commands above here */
814 845
815 /* used to define NL80211_CMD_MAX below */ 846 /* used to define NL80211_CMD_MAX below */
@@ -1436,6 +1467,8 @@ enum nl80211_commands {
1436 * allowed to be used with the first @NL80211_CMD_SET_STATION command to 1467 * allowed to be used with the first @NL80211_CMD_SET_STATION command to
1437 * update a TDLS peer STA entry. 1468 * update a TDLS peer STA entry.
1438 * 1469 *
1470 * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information.
1471 *
1439 * @NL80211_ATTR_MAX: highest attribute number currently defined 1472 * @NL80211_ATTR_MAX: highest attribute number currently defined
1440 * @__NL80211_ATTR_AFTER_LAST: internal use 1473 * @__NL80211_ATTR_AFTER_LAST: internal use
1441 */ 1474 */
@@ -1736,6 +1769,8 @@ enum nl80211_attrs {
1736 1769
1737 NL80211_ATTR_PEER_AID, 1770 NL80211_ATTR_PEER_AID,
1738 1771
1772 NL80211_ATTR_COALESCE_RULE,
1773
1739 /* add attributes here, update the policy in nl80211.c */ 1774 /* add attributes here, update the policy in nl80211.c */
1740 1775
1741 __NL80211_ATTR_AFTER_LAST, 1776 __NL80211_ATTR_AFTER_LAST,
@@ -3098,8 +3133,10 @@ enum nl80211_packet_pattern_attr {
3098 * @max_pkt_offset: maximum Rx packet offset 3133 * @max_pkt_offset: maximum Rx packet offset
3099 * 3134 *
3100 * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when 3135 * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
3101 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the 3136 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED or in
3102 * capability information given by the kernel to userspace. 3137 * %NL80211_ATTR_COALESCE_RULE_PKT_PATTERN when that is part of
3138 * %NL80211_ATTR_COALESCE_RULE in the capability information given
3139 * by the kernel to userspace.
3103 */ 3140 */
3104struct nl80211_pattern_support { 3141struct nl80211_pattern_support {
3105 __u32 max_patterns; 3142 __u32 max_patterns;
@@ -3318,6 +3355,55 @@ enum nl80211_wowlan_tcp_attrs {
3318}; 3355};
3319 3356
3320/** 3357/**
3358 * struct nl80211_coalesce_rule_support - coalesce rule support information
3359 * @max_rules: maximum number of rules supported
3360 * @pat: packet pattern support information
3361 * @max_delay: maximum supported coalescing delay in msecs
3362 *
3363 * This struct is carried in %NL80211_ATTR_COALESCE_RULE in the
3364 * capability information given by the kernel to userspace.
3365 */
3366struct nl80211_coalesce_rule_support {
3367 __u32 max_rules;
3368 struct nl80211_pattern_support pat;
3369 __u32 max_delay;
3370} __attribute__((packed));
3371
3372/**
3373 * enum nl80211_attr_coalesce_rule - coalesce rule attribute
3374 * @__NL80211_COALESCE_RULE_INVALID: invalid number for nested attribute
3375 * @NL80211_ATTR_COALESCE_RULE_DELAY: delay in msecs used for packet coalescing
3376 * @NL80211_ATTR_COALESCE_RULE_CONDITION: condition for packet coalescence,
3377 * see &enum nl80211_coalesce_condition.
3378 * @NL80211_ATTR_COALESCE_RULE_PKT_PATTERN: packet offset, pattern is matched
3379 * after these fixed number of bytes of received packet
3380 * @NUM_NL80211_ATTR_COALESCE_RULE: number of attributes
3381 * @NL80211_ATTR_COALESCE_RULE_MAX: max attribute number
3382 */
3383enum nl80211_attr_coalesce_rule {
3384 __NL80211_COALESCE_RULE_INVALID,
3385 NL80211_ATTR_COALESCE_RULE_DELAY,
3386 NL80211_ATTR_COALESCE_RULE_CONDITION,
3387 NL80211_ATTR_COALESCE_RULE_PKT_PATTERN,
3388
3389 /* keep last */
3390 NUM_NL80211_ATTR_COALESCE_RULE,
3391 NL80211_ATTR_COALESCE_RULE_MAX = NUM_NL80211_ATTR_COALESCE_RULE - 1
3392};
3393
3394/**
3395 * enum nl80211_coalesce_condition - coalesce rule conditions
3396 * @NL80211_COALESCE_CONDITION_MATCH: coalaesce Rx packets when patterns
3397 * in a rule are matched.
3398 * @NL80211_COALESCE_CONDITION_NO_MATCH: coalesce Rx packets when patterns
3399 * in a rule are not matched.
3400 */
3401enum nl80211_coalesce_condition {
3402 NL80211_COALESCE_CONDITION_MATCH,
3403 NL80211_COALESCE_CONDITION_NO_MATCH
3404};
3405
3406/**
3321 * enum nl80211_iface_limit_attrs - limit attributes 3407 * enum nl80211_iface_limit_attrs - limit attributes
3322 * @NL80211_IFACE_LIMIT_UNSPEC: (reserved) 3408 * @NL80211_IFACE_LIMIT_UNSPEC: (reserved)
3323 * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that 3409 * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that