Search Linux Wireless

Re: [RFC 15/17] cfg80211: add P2P Device abstraction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 19, 2012 at 5:50 PM, Johannes Berg
<johannes@xxxxxxxxxxxxxxxx> wrote:
> From: Johannes Berg <johannes.berg@xxxxxxxxx>
>
> In order to support using a different MAC address
> for the P2P Device address we must first have a
> P2P Device abstraction that can be assigned a MAC
> address.
>
> This abstraction will also be useful to support
> offloading P2P operations to the device, e.g.
> periodic listen for discoverability.
>
> Currently, the driver is responsible for assigning
> a MAC address to the P2P Device, but this could be
> changed by allowing a MAC address to be given to
> the NEW_INTERFACE command.
>
> As it has no associated netdev, a P2P Device can
> only be identified by its wdev identifier but the
> previous patches allowed using the wdev identifier
> in various APIs, e.g. remain-on-channel.
>
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
> ---
[...]


> @@ -230,9 +230,24 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked)
>        rtnl_lock();
>        mutex_lock(&rdev->devlist_mtx);
>
> -       list_for_each_entry(wdev, &rdev->wdev_list, list)
> -               if (wdev->netdev)
> +       list_for_each_entry(wdev, &rdev->wdev_list, list) {
> +               if (wdev->netdev) {
>                        dev_close(wdev->netdev);
> +                       continue;
> +               }
> +               /* otherwise, check iftype */
> +               switch (wdev->iftype) {
> +               case NL80211_IFTYPE_P2P_DEVICE:
> +                       if (!wdev->p2p_started)
> +                               break;
> +                       rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
> +                       wdev->p2p_started = false;
> +                       rdev->opencount--;
> +                       break;
> +               default:
> +                       break;
> +               }
> +       }
>
>        mutex_unlock(&rdev->devlist_mtx);
>        rtnl_unlock();


> +void cfg80211_unregister_wdev(struct wireless_dev *wdev)
> +{
> +       struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
> +
> +       ASSERT_RTNL();
> +
> +       if (WARN_ON(wdev->netdev))
> +               return;
> +
> +       mutex_lock(&rdev->devlist_mtx);
> +       list_del_rcu(&wdev->list);
> +       rdev->devlist_generation++;
> +
> +       switch (wdev->iftype) {
> +       case NL80211_IFTYPE_P2P_DEVICE:
> +               if (wdev->p2p_started) {
> +                       wdev->p2p_started = false;
> +                       rdev->opencount--;
> +               }
any reason not calling stop_p2p_device() here as well?


> +static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info)
> +{
> +       struct cfg80211_registered_device *rdev = info->user_ptr[0];
> +       struct wireless_dev *wdev = info->user_ptr[1];
> +       int err;
> +
> +       if (!rdev->ops->start_p2p_device)
> +               return -EOPNOTSUPP;
> +
> +       if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE)
> +               return -EOPNOTSUPP;
> +
> +       if (!(rdev->wiphy.interface_modes & BIT(NL80211_IFTYPE_P2P_DEVICE)))
> +               return -EOPNOTSUPP;
> +
nl80211_new_interface() should already check it.

Eliad.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux