aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-12-18 08:43:31 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-12-19 07:40:31 -0500
commit567ffc3509b2d3f965a49a18631d3da7f9a96d4f (patch)
tree844230d68e94ef86fb8958ed89676ff9349b11d0 /include
parenta7022e65c68ad89d6eb64f21aa4831c3822403d4 (diff)
nl80211: support vendor-specific events
In addition to vendor-specific commands, also support vendor-specific events. These must be registered with cfg80211 before they can be used. They're also advertised in nl80211 in the wiphy information so that userspace knows can be expected. The events themselves are sent on a new multicast group called "vendor". Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/cfg80211.h65
-rw-r--r--include/uapi/linux/nl80211.h3
2 files changed, 64 insertions, 4 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 80a10212b1b9..6d238a4331bd 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2824,6 +2824,8 @@ struct wiphy_vendor_command {
2824 * 2824 *
2825 * @vendor_commands: array of vendor commands supported by the hardware 2825 * @vendor_commands: array of vendor commands supported by the hardware
2826 * @n_vendor_commands: number of vendor commands 2826 * @n_vendor_commands: number of vendor commands
2827 * @vendor_events: array of vendor events supported by the hardware
2828 * @n_vendor_events: number of vendor events
2827 */ 2829 */
2828struct wiphy { 2830struct wiphy {
2829 /* assign these fields before you register the wiphy */ 2831 /* assign these fields before you register the wiphy */
@@ -2936,7 +2938,8 @@ struct wiphy {
2936 const struct wiphy_coalesce_support *coalesce; 2938 const struct wiphy_coalesce_support *coalesce;
2937 2939
2938 const struct wiphy_vendor_command *vendor_commands; 2940 const struct wiphy_vendor_command *vendor_commands;
2939 int n_vendor_commands; 2941 const struct nl80211_vendor_cmd_info *vendor_events;
2942 int n_vendor_commands, n_vendor_events;
2940 2943
2941 char priv[0] __aligned(NETDEV_ALIGN); 2944 char priv[0] __aligned(NETDEV_ALIGN);
2942}; 2945};
@@ -3907,6 +3910,14 @@ struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
3907 enum nl80211_attrs attr, 3910 enum nl80211_attrs attr,
3908 int approxlen); 3911 int approxlen);
3909 3912
3913struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
3914 enum nl80211_commands cmd,
3915 enum nl80211_attrs attr,
3916 int vendor_event_idx,
3917 int approxlen, gfp_t gfp);
3918
3919void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
3920
3910/** 3921/**
3911 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply 3922 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
3912 * @wiphy: the wiphy 3923 * @wiphy: the wiphy
@@ -3951,6 +3962,44 @@ cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
3951 */ 3962 */
3952int cfg80211_vendor_cmd_reply(struct sk_buff *skb); 3963int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
3953 3964
3965/**
3966 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
3967 * @wiphy: the wiphy
3968 * @event_idx: index of the vendor event in the wiphy's vendor_events
3969 * @approxlen: an upper bound of the length of the data that will
3970 * be put into the skb
3971 * @gfp: allocation flags
3972 *
3973 * This function allocates and pre-fills an skb for an event on the
3974 * vendor-specific multicast group.
3975 *
3976 * When done filling the skb, call cfg80211_vendor_event() with the
3977 * skb to send the event.
3978 *
3979 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
3980 */
3981static inline struct sk_buff *
3982cfg80211_vendor_event_alloc(struct wiphy *wiphy, int approxlen,
3983 int event_idx, gfp_t gfp)
3984{
3985 return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_VENDOR,
3986 NL80211_ATTR_VENDOR_DATA,
3987 event_idx, approxlen, gfp);
3988}
3989
3990/**
3991 * cfg80211_vendor_event - send the event
3992 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
3993 * @gfp: allocation flags
3994 *
3995 * This function sends the given @skb, which must have been allocated
3996 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
3997 */
3998static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
3999{
4000 __cfg80211_send_event_skb(skb, gfp);
4001}
4002
3954#ifdef CONFIG_NL80211_TESTMODE 4003#ifdef CONFIG_NL80211_TESTMODE
3955/** 4004/**
3956 * DOC: Test mode 4005 * DOC: Test mode
@@ -4031,8 +4080,13 @@ static inline int cfg80211_testmode_reply(struct sk_buff *skb)
4031 * 4080 *
4032 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4081 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4033 */ 4082 */
4034struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 4083static inline struct sk_buff *
4035 int approxlen, gfp_t gfp); 4084cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
4085{
4086 return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_TESTMODE,
4087 NL80211_ATTR_TESTDATA, -1,
4088 approxlen, gfp);
4089}
4036 4090
4037/** 4091/**
4038 * cfg80211_testmode_event - send the event 4092 * cfg80211_testmode_event - send the event
@@ -4044,7 +4098,10 @@ struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
4044 * by cfg80211_testmode_alloc_event_skb(), as an event. It always 4098 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
4045 * consumes it. 4099 * consumes it.
4046 */ 4100 */
4047void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 4101static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
4102{
4103 __cfg80211_send_event_skb(skb, gfp);
4104}
4048 4105
4049#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 4106#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
4050#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), 4107#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index e1307909ecf1..381184eb6c96 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1540,6 +1540,8 @@ enum nl80211_commands {
1540 * @NL80211_ATTR_VENDOR_SUBCMD: vendor sub-command 1540 * @NL80211_ATTR_VENDOR_SUBCMD: vendor sub-command
1541 * @NL80211_ATTR_VENDOR_DATA: data for the vendor command, if any; this 1541 * @NL80211_ATTR_VENDOR_DATA: data for the vendor command, if any; this
1542 * attribute is also used for vendor command feature advertisement 1542 * attribute is also used for vendor command feature advertisement
1543 * @NL80211_ATTR_VENDOR_EVENTS: used for event list advertising in the wiphy
1544 * info, containing a nested array of possible events
1543 * 1545 *
1544 * @NL80211_ATTR_MAX: highest attribute number currently defined 1546 * @NL80211_ATTR_MAX: highest attribute number currently defined
1545 * @__NL80211_ATTR_AFTER_LAST: internal use 1547 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -1865,6 +1867,7 @@ enum nl80211_attrs {
1865 NL80211_ATTR_VENDOR_ID, 1867 NL80211_ATTR_VENDOR_ID,
1866 NL80211_ATTR_VENDOR_SUBCMD, 1868 NL80211_ATTR_VENDOR_SUBCMD,
1867 NL80211_ATTR_VENDOR_DATA, 1869 NL80211_ATTR_VENDOR_DATA,
1870 NL80211_ATTR_VENDOR_EVENTS,
1868 1871
1869 /* add attributes here, update the policy in nl80211.c */ 1872 /* add attributes here, update the policy in nl80211.c */
1870 1873