~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/mac802154/mac_cmd.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/mac802154/mac_cmd.c (Version linux-6.11.5) and /net/mac802154/mac_cmd.c (Version linux-4.9.337)


  1 // SPDX-License-Identifier: GPL-2.0-only       << 
  2 /*                                                  1 /*
  3  * MAC commands interface                           2  * MAC commands interface
  4  *                                                  3  *
  5  * Copyright 2007-2012 Siemens AG                   4  * Copyright 2007-2012 Siemens AG
                                                   >>   5  *
                                                   >>   6  * This program is free software; you can redistribute it and/or modify
                                                   >>   7  * it under the terms of the GNU General Public License version 2
                                                   >>   8  * as published by the Free Software Foundation.
                                                   >>   9  *
                                                   >>  10  * This program is distributed in the hope that it will be useful,
                                                   >>  11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
                                                   >>  12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                                                   >>  13  * GNU General Public License for more details.
  6  *                                                 14  *
  7  * Written by:                                     15  * Written by:
  8  * Sergey Lapin <slapin@ossfans.org>               16  * Sergey Lapin <slapin@ossfans.org>
  9  * Dmitry Eremin-Solenikov <dbaryshkov@gmail.c     17  * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
 10  * Alexander Smirnov <alex.bluesman.smirnov@gm     18  * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
 11  */                                                19  */
 12                                                    20 
 13 #include <linux/skbuff.h>                          21 #include <linux/skbuff.h>
 14 #include <linux/if_arp.h>                          22 #include <linux/if_arp.h>
 15 #include <linux/ieee802154.h>                      23 #include <linux/ieee802154.h>
 16                                                    24 
 17 #include <net/ieee802154_netdev.h>                 25 #include <net/ieee802154_netdev.h>
 18 #include <net/cfg802154.h>                         26 #include <net/cfg802154.h>
 19 #include <net/mac802154.h>                         27 #include <net/mac802154.h>
 20                                                    28 
 21 #include "ieee802154_i.h"                          29 #include "ieee802154_i.h"
 22 #include "driver-ops.h"                            30 #include "driver-ops.h"
 23                                                    31 
 24 static int mac802154_mlme_start_req(struct net     32 static int mac802154_mlme_start_req(struct net_device *dev,
 25                                     struct iee     33                                     struct ieee802154_addr *addr,
 26                                     u8 channel     34                                     u8 channel, u8 page,
 27                                     u8 bcn_ord     35                                     u8 bcn_ord, u8 sf_ord,
 28                                     u8 pan_coo     36                                     u8 pan_coord, u8 blx,
 29                                     u8 coord_r     37                                     u8 coord_realign)
 30 {                                                  38 {
 31         struct ieee802154_llsec_params params;     39         struct ieee802154_llsec_params params;
 32         int changed = 0;                           40         int changed = 0;
 33                                                    41 
 34         ASSERT_RTNL();                             42         ASSERT_RTNL();
 35                                                    43 
 36         BUG_ON(addr->mode != IEEE802154_ADDR_S     44         BUG_ON(addr->mode != IEEE802154_ADDR_SHORT);
 37                                                    45 
 38         dev->ieee802154_ptr->pan_id = addr->pa     46         dev->ieee802154_ptr->pan_id = addr->pan_id;
 39         dev->ieee802154_ptr->short_addr = addr     47         dev->ieee802154_ptr->short_addr = addr->short_addr;
 40         mac802154_dev_set_page_channel(dev, pa     48         mac802154_dev_set_page_channel(dev, page, channel);
 41                                                    49 
 42         params.pan_id = addr->pan_id;              50         params.pan_id = addr->pan_id;
 43         changed |= IEEE802154_LLSEC_PARAM_PAN_     51         changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
 44                                                    52 
 45         params.hwaddr = ieee802154_devaddr_fro     53         params.hwaddr = ieee802154_devaddr_from_raw(dev->dev_addr);
 46         changed |= IEEE802154_LLSEC_PARAM_HWAD     54         changed |= IEEE802154_LLSEC_PARAM_HWADDR;
 47                                                    55 
 48         params.coord_hwaddr = params.hwaddr;       56         params.coord_hwaddr = params.hwaddr;
 49         changed |= IEEE802154_LLSEC_PARAM_COOR     57         changed |= IEEE802154_LLSEC_PARAM_COORD_HWADDR;
 50                                                    58 
 51         params.coord_shortaddr = addr->short_a     59         params.coord_shortaddr = addr->short_addr;
 52         changed |= IEEE802154_LLSEC_PARAM_COOR     60         changed |= IEEE802154_LLSEC_PARAM_COORD_SHORTADDR;
 53                                                    61 
 54         return mac802154_set_params(dev, &para     62         return mac802154_set_params(dev, &params, changed);
 55 }                                                  63 }
 56                                                    64 
 57 static int mac802154_set_mac_params(struct net     65 static int mac802154_set_mac_params(struct net_device *dev,
 58                                     const stru     66                                     const struct ieee802154_mac_params *params)
 59 {                                                  67 {
 60         struct ieee802154_sub_if_data *sdata =     68         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 61         struct ieee802154_local *local = sdata     69         struct ieee802154_local *local = sdata->local;
 62         struct wpan_dev *wpan_dev = &sdata->wp     70         struct wpan_dev *wpan_dev = &sdata->wpan_dev;
 63         int ret;                                   71         int ret;
 64                                                    72 
 65         ASSERT_RTNL();                             73         ASSERT_RTNL();
 66                                                    74 
 67         /* PHY */                                  75         /* PHY */
 68         wpan_dev->wpan_phy->transmit_power = p     76         wpan_dev->wpan_phy->transmit_power = params->transmit_power;
 69         wpan_dev->wpan_phy->cca = params->cca;     77         wpan_dev->wpan_phy->cca = params->cca;
 70         wpan_dev->wpan_phy->cca_ed_level = par     78         wpan_dev->wpan_phy->cca_ed_level = params->cca_ed_level;
 71                                                    79 
 72         /* MAC */                                  80         /* MAC */
 73         wpan_dev->min_be = params->min_be;         81         wpan_dev->min_be = params->min_be;
 74         wpan_dev->max_be = params->max_be;         82         wpan_dev->max_be = params->max_be;
 75         wpan_dev->csma_retries = params->csma_     83         wpan_dev->csma_retries = params->csma_retries;
 76         wpan_dev->frame_retries = params->fram     84         wpan_dev->frame_retries = params->frame_retries;
 77         wpan_dev->lbt = params->lbt;               85         wpan_dev->lbt = params->lbt;
 78                                                    86 
 79         if (local->hw.phy->flags & WPAN_PHY_FL     87         if (local->hw.phy->flags & WPAN_PHY_FLAG_TXPOWER) {
 80                 ret = drv_set_tx_power(local,      88                 ret = drv_set_tx_power(local, params->transmit_power);
 81                 if (ret < 0)                       89                 if (ret < 0)
 82                         return ret;                90                         return ret;
 83         }                                          91         }
 84                                                    92 
 85         if (local->hw.phy->flags & WPAN_PHY_FL     93         if (local->hw.phy->flags & WPAN_PHY_FLAG_CCA_MODE) {
 86                 ret = drv_set_cca_mode(local,      94                 ret = drv_set_cca_mode(local, &params->cca);
 87                 if (ret < 0)                       95                 if (ret < 0)
 88                         return ret;                96                         return ret;
 89         }                                          97         }
 90                                                    98 
 91         if (local->hw.phy->flags & WPAN_PHY_FL     99         if (local->hw.phy->flags & WPAN_PHY_FLAG_CCA_ED_LEVEL) {
 92                 ret = drv_set_cca_ed_level(loc    100                 ret = drv_set_cca_ed_level(local, params->cca_ed_level);
 93                 if (ret < 0)                      101                 if (ret < 0)
 94                         return ret;               102                         return ret;
 95         }                                         103         }
 96                                                   104 
 97         return 0;                                 105         return 0;
 98 }                                                 106 }
 99                                                   107 
100 static void mac802154_get_mac_params(struct ne    108 static void mac802154_get_mac_params(struct net_device *dev,
101                                      struct ie    109                                      struct ieee802154_mac_params *params)
102 {                                                 110 {
103         struct ieee802154_sub_if_data *sdata =    111         struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
104         struct wpan_dev *wpan_dev = &sdata->wp    112         struct wpan_dev *wpan_dev = &sdata->wpan_dev;
105                                                   113 
106         ASSERT_RTNL();                            114         ASSERT_RTNL();
107                                                   115 
108         /* PHY */                                 116         /* PHY */
109         params->transmit_power = wpan_dev->wpa    117         params->transmit_power = wpan_dev->wpan_phy->transmit_power;
110         params->cca = wpan_dev->wpan_phy->cca;    118         params->cca = wpan_dev->wpan_phy->cca;
111         params->cca_ed_level = wpan_dev->wpan_    119         params->cca_ed_level = wpan_dev->wpan_phy->cca_ed_level;
112                                                   120 
113         /* MAC */                                 121         /* MAC */
114         params->min_be = wpan_dev->min_be;        122         params->min_be = wpan_dev->min_be;
115         params->max_be = wpan_dev->max_be;        123         params->max_be = wpan_dev->max_be;
116         params->csma_retries = wpan_dev->csma_    124         params->csma_retries = wpan_dev->csma_retries;
117         params->frame_retries = wpan_dev->fram    125         params->frame_retries = wpan_dev->frame_retries;
118         params->lbt = wpan_dev->lbt;              126         params->lbt = wpan_dev->lbt;
119 }                                                 127 }
120                                                   128 
121 static const struct ieee802154_llsec_ops mac80    129 static const struct ieee802154_llsec_ops mac802154_llsec_ops = {
122         .get_params = mac802154_get_params,       130         .get_params = mac802154_get_params,
123         .set_params = mac802154_set_params,       131         .set_params = mac802154_set_params,
124         .add_key = mac802154_add_key,             132         .add_key = mac802154_add_key,
125         .del_key = mac802154_del_key,             133         .del_key = mac802154_del_key,
126         .add_dev = mac802154_add_dev,             134         .add_dev = mac802154_add_dev,
127         .del_dev = mac802154_del_dev,             135         .del_dev = mac802154_del_dev,
128         .add_devkey = mac802154_add_devkey,       136         .add_devkey = mac802154_add_devkey,
129         .del_devkey = mac802154_del_devkey,       137         .del_devkey = mac802154_del_devkey,
130         .add_seclevel = mac802154_add_seclevel    138         .add_seclevel = mac802154_add_seclevel,
131         .del_seclevel = mac802154_del_seclevel    139         .del_seclevel = mac802154_del_seclevel,
132         .lock_table = mac802154_lock_table,       140         .lock_table = mac802154_lock_table,
133         .get_table = mac802154_get_table,         141         .get_table = mac802154_get_table,
134         .unlock_table = mac802154_unlock_table    142         .unlock_table = mac802154_unlock_table,
135 };                                                143 };
136                                                   144 
137 struct ieee802154_mlme_ops mac802154_mlme_wpan    145 struct ieee802154_mlme_ops mac802154_mlme_wpan = {
138         .start_req = mac802154_mlme_start_req,    146         .start_req = mac802154_mlme_start_req,
139                                                   147 
140         .llsec = &mac802154_llsec_ops,            148         .llsec = &mac802154_llsec_ops,
141                                                   149 
142         .set_mac_params = mac802154_set_mac_pa    150         .set_mac_params = mac802154_set_mac_params,
143         .get_mac_params = mac802154_get_mac_pa    151         .get_mac_params = mac802154_get_mac_params,
144 };                                                152 };
145                                                   153 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php