diff options
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8734efa663d1..67ff7e92cb99 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -5715,6 +5715,51 @@ nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev, | |||
5715 | nlmsg_free(msg); | 5715 | nlmsg_free(msg); |
5716 | } | 5716 | } |
5717 | 5717 | ||
5718 | void | ||
5719 | nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, | ||
5720 | struct net_device *netdev, const u8 *peer, | ||
5721 | u32 num_packets, gfp_t gfp) | ||
5722 | { | ||
5723 | struct sk_buff *msg; | ||
5724 | struct nlattr *pinfoattr; | ||
5725 | void *hdr; | ||
5726 | |||
5727 | msg = nlmsg_new(NLMSG_GOODSIZE, gfp); | ||
5728 | if (!msg) | ||
5729 | return; | ||
5730 | |||
5731 | hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NOTIFY_CQM); | ||
5732 | if (!hdr) { | ||
5733 | nlmsg_free(msg); | ||
5734 | return; | ||
5735 | } | ||
5736 | |||
5737 | NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); | ||
5738 | NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); | ||
5739 | NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, peer); | ||
5740 | |||
5741 | pinfoattr = nla_nest_start(msg, NL80211_ATTR_CQM); | ||
5742 | if (!pinfoattr) | ||
5743 | goto nla_put_failure; | ||
5744 | |||
5745 | NLA_PUT_U32(msg, NL80211_ATTR_CQM_PKT_LOSS_EVENT, num_packets); | ||
5746 | |||
5747 | nla_nest_end(msg, pinfoattr); | ||
5748 | |||
5749 | if (genlmsg_end(msg, hdr) < 0) { | ||
5750 | nlmsg_free(msg); | ||
5751 | return; | ||
5752 | } | ||
5753 | |||
5754 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | ||
5755 | nl80211_mlme_mcgrp.id, gfp); | ||
5756 | return; | ||
5757 | |||
5758 | nla_put_failure: | ||
5759 | genlmsg_cancel(msg, hdr); | ||
5760 | nlmsg_free(msg); | ||
5761 | } | ||
5762 | |||
5718 | static int nl80211_netlink_notify(struct notifier_block * nb, | 5763 | static int nl80211_netlink_notify(struct notifier_block * nb, |
5719 | unsigned long state, | 5764 | unsigned long state, |
5720 | void *_notify) | 5765 | void *_notify) |