Lines Matching +full:attribute +full:- +full:set

1 // SPDX-License-Identifier: GPL-2.0
30 cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS); in lbs_mesh_access()
31 cmd->hdr.size = cpu_to_le16(sizeof(*cmd)); in lbs_mesh_access()
32 cmd->hdr.result = 0; in lbs_mesh_access()
34 cmd->action = cpu_to_le16(cmd_action); in lbs_mesh_access()
50 * id in bits 14-13-12. in __lbs_mesh_config_send()
52 if (priv->mesh_tlv == TLV_TYPE_MESH_ID) in __lbs_mesh_config_send()
56 cmd->hdr.command = cpu_to_le16(command); in __lbs_mesh_config_send()
57 cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_config)); in __lbs_mesh_config_send()
58 cmd->hdr.result = 0; in __lbs_mesh_config_send()
60 cmd->type = cpu_to_le16(type); in __lbs_mesh_config_send()
61 cmd->action = cpu_to_le16(action); in __lbs_mesh_config_send()
74 if (!(priv->fwcapinfo & FW_CAPINFO_PERSISTENT_CONFIG)) in lbs_mesh_config_send()
75 return -EOPNOTSUPP; in lbs_mesh_config_send()
99 ie->id = WLAN_EID_VENDOR_SPECIFIC; in lbs_mesh_config()
100 ie->val.oui[0] = 0x00; in lbs_mesh_config()
101 ie->val.oui[1] = 0x50; in lbs_mesh_config()
102 ie->val.oui[2] = 0x43; in lbs_mesh_config()
103 ie->val.type = MARVELL_MESH_IE_TYPE; in lbs_mesh_config()
104 ie->val.subtype = MARVELL_MESH_IE_SUBTYPE; in lbs_mesh_config()
105 ie->val.version = MARVELL_MESH_IE_VERSION; in lbs_mesh_config()
106 ie->val.active_protocol_id = MARVELL_MESH_PROTO_ID_HWMP; in lbs_mesh_config()
107 ie->val.active_metric_id = MARVELL_MESH_METRIC_ID; in lbs_mesh_config()
108 ie->val.mesh_capability = MARVELL_MESH_CAPABILITY; in lbs_mesh_config()
110 if (priv->mesh_dev) { in lbs_mesh_config()
111 mesh_wdev = priv->mesh_dev->ieee80211_ptr; in lbs_mesh_config()
112 ie->val.mesh_id_len = mesh_wdev->u.mesh.id_up_len; in lbs_mesh_config()
113 memcpy(ie->val.mesh_id, mesh_wdev->u.mesh.id, in lbs_mesh_config()
114 mesh_wdev->u.mesh.id_up_len); in lbs_mesh_config()
117 ie->len = sizeof(struct mrvl_meshie_val) - in lbs_mesh_config()
118 IEEE80211_MAX_SSID_LEN + ie->val.mesh_id_len; in lbs_mesh_config()
125 return -1; in lbs_mesh_config()
128 action, priv->mesh_tlv, chan, ie->val.mesh_id_len, in lbs_mesh_config()
129 ie->val.mesh_id); in lbs_mesh_config()
131 return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv); in lbs_mesh_config()
136 priv->mesh_channel = channel; in lbs_mesh_set_channel()
142 return priv->mesh_channel ?: 1; in lbs_mesh_get_channel()
154 * anycast_mask_show - Get function for sysfs attribute anycast_mask
162 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in anycast_mask_show()
176 * anycast_mask_store - Set function for sysfs attribute anycast_mask
179 * @buf: buffer that contains new attribute value
186 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in anycast_mask_store()
206 * prb_rsp_limit_show - Get function for sysfs attribute prb_rsp_limit
214 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in prb_rsp_limit_show()
232 * prb_rsp_limit_store - Set function for sysfs attribute prb_rsp_limit
235 * @buf: buffer that contains new attribute value
242 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in prb_rsp_limit_store()
251 return -ENOTSUPP; in prb_rsp_limit_store()
266 * lbs_mesh_show - Get function for sysfs attribute mesh
274 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in lbs_mesh_show()
275 return sysfs_emit(buf, "0x%X\n", !!priv->mesh_dev); in lbs_mesh_show()
279 * lbs_mesh_store - Set function for sysfs attribute mesh
282 * @buf: buffer that contains new attribute value
289 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in lbs_mesh_store()
297 if (enable == !!priv->mesh_dev) in lbs_mesh_store()
309 * lbs_mesh attribute to be exported per ethX interface
315 * anycast_mask attribute to be exported per mshX interface
321 * prb_rsp_limit attribute to be exported per mshX interface
326 static struct attribute *lbs_mesh_sysfs_entries[] = {
344 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in mesh_get_default_parameters()
353 return -EOPNOTSUPP; in mesh_get_default_parameters()
361 * bootflag_show - Get function for sysfs attribute bootflag
381 * bootflag_store - Set function for sysfs attribute bootflag
384 * @buf: buffer that contains new attribute value
390 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in bootflag_store()
399 return -EINVAL; in bootflag_store()
413 * boottime_show - Get function for sysfs attribute boottime
433 * boottime_store - Set function for sysfs attribute boottime
436 * @buf: buffer that contains new attribute value
443 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in boottime_store()
452 return -EINVAL; in boottime_store()
457 * standalone (no-host) mode before the host can take control of it, in boottime_store()
476 * channel_show - Get function for sysfs attribute channel
496 * channel_store - Set function for sysfs attribute channel
499 * @buf: buffer that contains new attribute value
505 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in channel_store()
514 return -EINVAL; in channel_store()
528 * mesh_id_show - Get function for sysfs attribute mesh_id
557 * mesh_id_store - Set function for sysfs attribute mesh_id
560 * @buf: buffer that contains new attribute value
569 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in mesh_id_store()
574 return -EINVAL; in mesh_id_store()
587 len = count - 1; in mesh_id_store()
588 memcpy(ie->val.mesh_id, buf, len); in mesh_id_store()
590 ie->val.mesh_id_len = len; in mesh_id_store()
592 ie->len = sizeof(struct mrvl_meshie_val) - IEEE80211_MAX_SSID_LEN + len; in mesh_id_store()
603 * protocol_id_show - Get function for sysfs attribute protocol_id
624 * protocol_id_store - Set function for sysfs attribute protocol_id
627 * @buf: buffer that contains new attribute value
637 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in protocol_id_store()
645 return -EINVAL; in protocol_id_store()
658 ie->val.active_protocol_id = datum; in protocol_id_store()
669 * metric_id_show - Get function for sysfs attribute metric_id
689 * metric_id_store - Set function for sysfs attribute metric_id
692 * @buf: buffer that contains new attribute value
702 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in metric_id_store()
709 return -EINVAL; in metric_id_store()
720 ie->val.active_metric_id = datum; in metric_id_store()
731 * capability_show - Get function for sysfs attribute capability
751 * capability_store - Set function for sysfs attribute capability
754 * @buf: buffer that contains new attribute value
764 struct lbs_private *priv = to_net_dev(dev)->ml_priv; in capability_store()
771 return -EINVAL; in capability_store()
782 ie->val.mesh_capability = datum; in capability_store()
801 static struct attribute *boot_opts_attrs[] = {
813 static struct attribute *mesh_ie_attrs[] = {
842 if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5) { in lbs_init_mesh()
847 give an error -- it just silently fails. */ in lbs_init_mesh()
856 priv->mesh_tlv = TLV_TYPE_OLD_MESH_ID; in lbs_init_mesh()
858 priv->mesh_tlv = TLV_TYPE_MESH_ID; in lbs_init_mesh()
860 priv->mesh_tlv = 0; in lbs_init_mesh()
863 if ((MRVL_FW_MAJOR_REV(priv->fwrelease) >= MRVL_FW_V10) && in lbs_init_mesh()
864 (priv->fwcapinfo & MESH_CAPINFO_ENABLE_MASK)) { in lbs_init_mesh()
868 priv->mesh_tlv = TLV_TYPE_MESH_ID; in lbs_init_mesh()
870 priv->mesh_tlv = 0; in lbs_init_mesh()
881 if (device_create_file(&priv->dev->dev, &dev_attr_lbs_mesh)) in lbs_start_mesh()
882 netdev_err(priv->dev, "cannot register lbs_mesh attribute\n"); in lbs_start_mesh()
887 struct net_device *dev = priv->dev; in lbs_deinit_mesh()
890 if (priv->mesh_tlv) { in lbs_deinit_mesh()
891 device_remove_file(&dev->dev, &dev_attr_lbs_mesh); in lbs_deinit_mesh()
900 * lbs_mesh_stop - close the mshX interface
907 struct lbs_private *priv = dev->ml_priv; in lbs_mesh_stop()
912 spin_lock_irq(&priv->driver_lock); in lbs_mesh_stop()
917 spin_unlock_irq(&priv->driver_lock); in lbs_mesh_stop()
927 * lbs_mesh_dev_open - open the mshX interface
930 * returns: 0 or -EBUSY if monitor mode active
934 struct lbs_private *priv = dev->ml_priv; in lbs_mesh_dev_open()
937 if (!priv->iface_running) { in lbs_mesh_dev_open()
943 spin_lock_irq(&priv->driver_lock); in lbs_mesh_dev_open()
945 if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { in lbs_mesh_dev_open()
946 ret = -EBUSY; in lbs_mesh_dev_open()
947 spin_unlock_irq(&priv->driver_lock); in lbs_mesh_dev_open()
953 if (!priv->tx_pending_len) in lbs_mesh_dev_open()
956 spin_unlock_irq(&priv->driver_lock); in lbs_mesh_dev_open()
974 * lbs_add_mesh - add mshX interface
977 * returns: 0 if successful, -X otherwise
989 ret = -ENOMEM; in lbs_add_mesh()
996 ret = -ENOMEM; in lbs_add_mesh()
1000 mesh_wdev->iftype = NL80211_IFTYPE_MESH_POINT; in lbs_add_mesh()
1001 mesh_wdev->wiphy = priv->wdev->wiphy; in lbs_add_mesh()
1003 if (priv->mesh_tlv) { in lbs_add_mesh()
1004 sprintf(mesh_wdev->u.mesh.id, "mesh"); in lbs_add_mesh()
1005 mesh_wdev->u.mesh.id_up_len = 4; in lbs_add_mesh()
1008 mesh_wdev->netdev = mesh_dev; in lbs_add_mesh()
1010 mesh_dev->ml_priv = priv; in lbs_add_mesh()
1011 mesh_dev->ieee80211_ptr = mesh_wdev; in lbs_add_mesh()
1012 priv->mesh_dev = mesh_dev; in lbs_add_mesh()
1014 mesh_dev->netdev_ops = &mesh_netdev_ops; in lbs_add_mesh()
1015 mesh_dev->ethtool_ops = &lbs_ethtool_ops; in lbs_add_mesh()
1016 eth_hw_addr_inherit(mesh_dev, priv->dev); in lbs_add_mesh()
1018 SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); in lbs_add_mesh()
1020 mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST; in lbs_add_mesh()
1021 mesh_dev->sysfs_groups[0] = &lbs_mesh_attr_group; in lbs_add_mesh()
1022 mesh_dev->sysfs_groups[1] = &boot_opts_group; in lbs_add_mesh()
1023 mesh_dev->sysfs_groups[2] = &mesh_ie_group; in lbs_add_mesh()
1050 mesh_dev = priv->mesh_dev; in lbs_remove_mesh()
1057 priv->mesh_dev = NULL; in lbs_remove_mesh()
1058 kfree(mesh_dev->ieee80211_ptr); in lbs_remove_mesh()
1069 if (priv->mesh_dev) { in lbs_mesh_set_dev()
1070 if (priv->mesh_tlv == TLV_TYPE_OLD_MESH_ID) { in lbs_mesh_set_dev()
1071 if (rxpd->rx_control & RxPD_MESH_FRAME) in lbs_mesh_set_dev()
1072 dev = priv->mesh_dev; in lbs_mesh_set_dev()
1073 } else if (priv->mesh_tlv == TLV_TYPE_MESH_ID) { in lbs_mesh_set_dev()
1074 if (rxpd->u.bss.bss_num == MESH_IFACE_ID) in lbs_mesh_set_dev()
1075 dev = priv->mesh_dev; in lbs_mesh_set_dev()
1085 if (dev == priv->mesh_dev) { in lbs_mesh_set_txpd()
1086 if (priv->mesh_tlv == TLV_TYPE_OLD_MESH_ID) in lbs_mesh_set_txpd()
1087 txpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); in lbs_mesh_set_txpd()
1088 else if (priv->mesh_tlv == TLV_TYPE_MESH_ID) in lbs_mesh_set_txpd()
1089 txpd->u.bss.bss_num = MESH_IFACE_ID; in lbs_mesh_set_txpd()
1112 struct lbs_private *priv = dev->ml_priv; in lbs_mesh_ethtool_get_stats()
1124 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); in lbs_mesh_ethtool_get_stats()
1125 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); in lbs_mesh_ethtool_get_stats()
1126 priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]); in lbs_mesh_ethtool_get_stats()
1127 priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]); in lbs_mesh_ethtool_get_stats()
1128 priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]); in lbs_mesh_ethtool_get_stats()
1129 priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]); in lbs_mesh_ethtool_get_stats()
1130 priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]); in lbs_mesh_ethtool_get_stats()
1131 priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]); in lbs_mesh_ethtool_get_stats()
1133 data[0] = priv->mstats.fwd_drop_rbt; in lbs_mesh_ethtool_get_stats()
1134 data[1] = priv->mstats.fwd_drop_ttl; in lbs_mesh_ethtool_get_stats()
1135 data[2] = priv->mstats.fwd_drop_noroute; in lbs_mesh_ethtool_get_stats()
1136 data[3] = priv->mstats.fwd_drop_nobuf; in lbs_mesh_ethtool_get_stats()
1137 data[4] = priv->mstats.fwd_unicast_cnt; in lbs_mesh_ethtool_get_stats()
1138 data[5] = priv->mstats.fwd_bcast_cnt; in lbs_mesh_ethtool_get_stats()
1139 data[6] = priv->mstats.drop_blind; in lbs_mesh_ethtool_get_stats()
1140 data[7] = priv->mstats.tx_failed_cnt; in lbs_mesh_ethtool_get_stats()
1145 struct lbs_private *priv = dev->ml_priv; in lbs_mesh_ethtool_get_sset_count()
1147 if (sset == ETH_SS_STATS && dev == priv->mesh_dev) in lbs_mesh_ethtool_get_sset_count()
1150 return -EOPNOTSUPP; in lbs_mesh_ethtool_get_sset_count()