1 // SPDX-License-Identifier: GPL-2.0-only 1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 2 /* 3 * OCB mode implementation 3 * OCB mode implementation 4 * 4 * 5 * Copyright: (c) 2014 Czech Technical Univers 5 * Copyright: (c) 2014 Czech Technical University in Prague 6 * (c) 2014 Volkswagen Group Resear 6 * (c) 2014 Volkswagen Group Research 7 * Copyright (C) 2022-2023 Intel Corporation !! 7 * Copyright (C) 2022 Intel Corporation 8 * Author: Rostislav Lisovy <rostislav.liso 8 * Author: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz> 9 * Funded by: Volkswagen Group Research 9 * Funded by: Volkswagen Group Research 10 */ 10 */ 11 11 12 #include <linux/ieee80211.h> 12 #include <linux/ieee80211.h> 13 #include <net/cfg80211.h> 13 #include <net/cfg80211.h> 14 #include "nl80211.h" 14 #include "nl80211.h" 15 #include "core.h" 15 #include "core.h" 16 #include "rdev-ops.h" 16 #include "rdev-ops.h" 17 17 18 int cfg80211_join_ocb(struct cfg80211_register !! 18 int __cfg80211_join_ocb(struct cfg80211_registered_device *rdev, 19 struct net_device *dev, !! 19 struct net_device *dev, 20 struct ocb_setup *setup) !! 20 struct ocb_setup *setup) 21 { 21 { 22 struct wireless_dev *wdev = dev->ieee8 22 struct wireless_dev *wdev = dev->ieee80211_ptr; 23 int err; 23 int err; 24 24 25 lockdep_assert_wiphy(wdev->wiphy); !! 25 ASSERT_WDEV_LOCK(wdev); 26 26 27 if (dev->ieee80211_ptr->iftype != NL80 27 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_OCB) 28 return -EOPNOTSUPP; 28 return -EOPNOTSUPP; 29 29 30 if (!rdev->ops->join_ocb) 30 if (!rdev->ops->join_ocb) 31 return -EOPNOTSUPP; 31 return -EOPNOTSUPP; 32 32 33 if (WARN_ON(!setup->chandef.chan)) 33 if (WARN_ON(!setup->chandef.chan)) 34 return -EINVAL; 34 return -EINVAL; 35 35 36 err = rdev_join_ocb(rdev, dev, setup); 36 err = rdev_join_ocb(rdev, dev, setup); 37 if (!err) 37 if (!err) 38 wdev->u.ocb.chandef = setup->c 38 wdev->u.ocb.chandef = setup->chandef; 39 39 40 return err; 40 return err; 41 } 41 } 42 42 43 int cfg80211_leave_ocb(struct cfg80211_registe !! 43 int cfg80211_join_ocb(struct cfg80211_registered_device *rdev, 44 struct net_device *dev) !! 44 struct net_device *dev, >> 45 struct ocb_setup *setup) >> 46 { >> 47 struct wireless_dev *wdev = dev->ieee80211_ptr; >> 48 int err; >> 49 >> 50 wdev_lock(wdev); >> 51 err = __cfg80211_join_ocb(rdev, dev, setup); >> 52 wdev_unlock(wdev); >> 53 >> 54 return err; >> 55 } >> 56 >> 57 int __cfg80211_leave_ocb(struct cfg80211_registered_device *rdev, >> 58 struct net_device *dev) 45 { 59 { 46 struct wireless_dev *wdev = dev->ieee8 60 struct wireless_dev *wdev = dev->ieee80211_ptr; 47 int err; 61 int err; 48 62 49 lockdep_assert_wiphy(wdev->wiphy); !! 63 ASSERT_WDEV_LOCK(wdev); 50 64 51 if (dev->ieee80211_ptr->iftype != NL80 65 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_OCB) 52 return -EOPNOTSUPP; 66 return -EOPNOTSUPP; 53 67 54 if (!rdev->ops->leave_ocb) 68 if (!rdev->ops->leave_ocb) 55 return -EOPNOTSUPP; 69 return -EOPNOTSUPP; 56 70 57 if (!wdev->u.ocb.chandef.chan) 71 if (!wdev->u.ocb.chandef.chan) 58 return -ENOTCONN; 72 return -ENOTCONN; 59 73 60 err = rdev_leave_ocb(rdev, dev); 74 err = rdev_leave_ocb(rdev, dev); 61 if (!err) 75 if (!err) 62 memset(&wdev->u.ocb.chandef, 0 76 memset(&wdev->u.ocb.chandef, 0, sizeof(wdev->u.ocb.chandef)); >> 77 >> 78 return err; >> 79 } >> 80 >> 81 int cfg80211_leave_ocb(struct cfg80211_registered_device *rdev, >> 82 struct net_device *dev) >> 83 { >> 84 struct wireless_dev *wdev = dev->ieee80211_ptr; >> 85 int err; >> 86 >> 87 wdev_lock(wdev); >> 88 err = __cfg80211_leave_ocb(rdev, dev); >> 89 wdev_unlock(wdev); 63 90 64 return err; 91 return err; 65 } 92 } 66 93
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.