wiphy
approxlen
This function allocates and pre-fills an skb for a reply to the testmode command. Since it is intended for a reply, calling it outside of the testmode_cmd operation is invalid.
The returned skb (or NULL if any errors happen) is pre-filled with the wiphy index and set up in a way that any data that is put into the skb (with skb_put, nla_put or similar) will end up being within the NL80211_ATTR_TESTDATA attribute, so all that needs to be done with the skb is adding data for the corresponding userspace tool which can then read that data out of the testdata attribute. You must not modify the skb in any other way.
When done, call cfg80211_testmode_reply with the skb and return its error code as the result of the testmode_cmd operation.
Johannes Berg <johannes@sipsolutions.net>