1 // SPDX-License-Identifier: GPL-2.0-only
3 * OCB mode implementation
5 * Copyright: (c) 2014 Czech Technical University in Prague
6 * (c) 2014 Volkswagen Group Research
7 * Copyright (C) 2022 Intel Corporation
8 * Author: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
9 * Funded by: Volkswagen Group Research
12 #include <linux/ieee80211.h>
13 #include <net/cfg80211.h>
18 int __cfg80211_join_ocb(struct cfg80211_registered_device *rdev,
19 struct net_device *dev,
20 struct ocb_setup *setup)
22 struct wireless_dev *wdev = dev->ieee80211_ptr;
25 ASSERT_WDEV_LOCK(wdev);
27 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_OCB)
30 if (!rdev->ops->join_ocb)
33 if (WARN_ON(!setup->chandef.chan))
36 err = rdev_join_ocb(rdev, dev, setup);
38 wdev->u.ocb.chandef = setup->chandef;
43 int cfg80211_join_ocb(struct cfg80211_registered_device *rdev,
44 struct net_device *dev,
45 struct ocb_setup *setup)
47 struct wireless_dev *wdev = dev->ieee80211_ptr;
51 err = __cfg80211_join_ocb(rdev, dev, setup);
57 int __cfg80211_leave_ocb(struct cfg80211_registered_device *rdev,
58 struct net_device *dev)
60 struct wireless_dev *wdev = dev->ieee80211_ptr;
63 ASSERT_WDEV_LOCK(wdev);
65 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_OCB)
68 if (!rdev->ops->leave_ocb)
71 err = rdev_leave_ocb(rdev, dev);
73 memset(&wdev->u.ocb.chandef, 0, sizeof(wdev->u.ocb.chandef));
78 int cfg80211_leave_ocb(struct cfg80211_registered_device *rdev,
79 struct net_device *dev)
81 struct wireless_dev *wdev = dev->ieee80211_ptr;
85 err = __cfg80211_leave_ocb(rdev, dev);