Lines Matching defs:phy
85 static void hwsim_del(struct hwsim_phy *phy);
98 struct hwsim_phy *phy = hw->priv;
105 pib_old = rtnl_dereference(phy->pib);
115 rcu_assign_pointer(phy->pib, pib);
122 struct hwsim_phy *phy = hw->priv;
127 pib = rcu_dereference(phy->pib);
138 struct hwsim_phy *phy = hw->priv;
143 pib = rcu_dereference(phy->pib);
154 struct hwsim_phy *phy = hw->priv;
158 pib = rcu_dereference(phy->pib);
294 struct hwsim_phy *phy = hw->priv;
296 phy->suspended = false;
303 struct hwsim_phy *phy = hw->priv;
305 phy->suspended = true;
312 struct hwsim_phy *phy = hw->priv;
322 pib = rcu_dereference(phy->pib);
347 struct hwsim_phy *phy, *tmp;
356 list_for_each_entry_safe(phy, tmp, &hwsim_phys, list) {
357 if (idx == phy->idx) {
358 hwsim_del(phy);
368 static int append_radio_msg(struct sk_buff *skb, struct hwsim_phy *phy)
375 ret = nla_put_u32(skb, MAC802154_HWSIM_ATTR_RADIO_ID, phy->idx);
380 if (list_empty(&phy->edges)) {
392 list_for_each_entry_rcu(e, &phy->edges, list) {
429 static int hwsim_get_radio(struct sk_buff *skb, struct hwsim_phy *phy,
444 res = append_radio_msg(skb, phy);
458 struct hwsim_phy *phy;
467 list_for_each_entry(phy, &hwsim_phys, list) {
468 if (phy->idx != idx)
477 res = hwsim_get_radio(skb, phy, info->snd_portid,
498 struct hwsim_phy *phy;
506 list_for_each_entry(phy, &hwsim_phys, list) {
507 if (phy->idx < idx)
510 res = hwsim_get_radio(skb, phy, NETLINK_CB(cb->skb).portid,
515 idx = phy->idx + 1;
528 struct hwsim_phy *phy;
530 list_for_each_entry(phy, &hwsim_phys, list) {
531 if (phy->idx == idx)
532 return phy;
814 static void hwsim_mcast_new_radio(struct genl_info *info, struct hwsim_phy *phy)
828 if (append_radio_msg(mcast_skb, phy) < 0)
841 static void hwsim_edge_unsubscribe_me(struct hwsim_phy *phy)
847 /* going to all phy edges and remove phy from it */
850 if (e->endpoint->idx == phy->idx) {
861 static int hwsim_subscribe_all_others(struct hwsim_phy *phy)
871 list_add_rcu(&e->list, &phy->edges);
875 e = hwsim_alloc_edge(phy, 0xff);
885 hwsim_edge_unsubscribe_me(phy);
888 list_for_each_entry_rcu(e, &phy->edges, list) {
900 struct hwsim_phy *phy;
907 hw = ieee802154_alloc_hw(sizeof(*phy), &hwsim_ops);
911 phy = hw->priv;
912 phy->hw = hw;
915 hw->phy->supported.channels[0] |= 1;
917 hw->phy->supported.channels[0] |= 0x7fe;
919 hw->phy->supported.channels[0] |= 0x7FFF800;
921 hw->phy->supported.channels[1] |= 1;
923 hw->phy->supported.channels[1] |= 0x7fe;
925 hw->phy->supported.channels[2] |= 1;
927 hw->phy->supported.channels[2] |= 0x7fe;
929 hw->phy->supported.channels[3] |= 0x3fff;
931 hw->phy->supported.channels[4] |= 1;
933 hw->phy->supported.channels[4] |= 0x1e;
935 hw->phy->supported.channels[4] |= 0xffe0;
937 hw->phy->supported.channels[5] |= 0xf;
939 hw->phy->supported.channels[5] |= 0xf0;
941 hw->phy->supported.channels[6] |= 0x3ff;
943 hw->phy->supported.channels[6] |= 0x3ffc00;
945 ieee802154_random_extended_addr(&hw->phy->perm_extended_addr);
947 /* hwsim phy channel 13 as default */
948 hw->phy->current_channel = 13;
958 rcu_assign_pointer(phy->pib, pib);
959 phy->idx = idx;
960 INIT_LIST_HEAD(&phy->edges);
971 err = hwsim_subscribe_all_others(phy);
977 list_add_tail(&phy->list, &hwsim_phys);
980 hwsim_mcast_new_radio(info, phy);
985 ieee802154_unregister_hw(phy->hw);
989 ieee802154_free_hw(phy->hw);
993 static void hwsim_del(struct hwsim_phy *phy)
998 hwsim_edge_unsubscribe_me(phy);
1000 list_del(&phy->list);
1003 list_for_each_entry_rcu(e, &phy->edges, list) {
1007 pib = rcu_dereference(phy->pib);
1012 ieee802154_unregister_hw(phy->hw);
1013 ieee802154_free_hw(phy->hw);
1018 struct hwsim_phy *phy, *tmp;
1032 list_for_each_entry_safe(phy, tmp, &hwsim_phys, list)
1033 hwsim_del(phy);
1040 struct hwsim_phy *phy, *tmp;
1043 list_for_each_entry_safe(phy, tmp, &hwsim_phys, list)
1044 hwsim_del(phy);