19a9f26e8SHoratiu Vultur // SPDX-License-Identifier: GPL-2.0-or-later 29a9f26e8SHoratiu Vultur 39a9f26e8SHoratiu Vultur #include <linux/mrp_bridge.h> 49a9f26e8SHoratiu Vultur #include "br_private_mrp.h" 59a9f26e8SHoratiu Vultur 69a9f26e8SHoratiu Vultur static const u8 mrp_test_dmac[ETH_ALEN] = { 0x1, 0x15, 0x4e, 0x0, 0x0, 0x1 }; 79a9f26e8SHoratiu Vultur 89a9f26e8SHoratiu Vultur static struct net_bridge_port *br_mrp_get_port(struct net_bridge *br, 99a9f26e8SHoratiu Vultur u32 ifindex) 109a9f26e8SHoratiu Vultur { 119a9f26e8SHoratiu Vultur struct net_bridge_port *res = NULL; 129a9f26e8SHoratiu Vultur struct net_bridge_port *port; 139a9f26e8SHoratiu Vultur 149a9f26e8SHoratiu Vultur list_for_each_entry(port, &br->port_list, list) { 159a9f26e8SHoratiu Vultur if (port->dev->ifindex == ifindex) { 169a9f26e8SHoratiu Vultur res = port; 179a9f26e8SHoratiu Vultur break; 189a9f26e8SHoratiu Vultur } 199a9f26e8SHoratiu Vultur } 209a9f26e8SHoratiu Vultur 219a9f26e8SHoratiu Vultur return res; 229a9f26e8SHoratiu Vultur } 239a9f26e8SHoratiu Vultur 249a9f26e8SHoratiu Vultur static struct br_mrp *br_mrp_find_id(struct net_bridge *br, u32 ring_id) 259a9f26e8SHoratiu Vultur { 269a9f26e8SHoratiu Vultur struct br_mrp *res = NULL; 279a9f26e8SHoratiu Vultur struct br_mrp *mrp; 289a9f26e8SHoratiu Vultur 299a9f26e8SHoratiu Vultur list_for_each_entry_rcu(mrp, &br->mrp_list, list, 309a9f26e8SHoratiu Vultur lockdep_rtnl_is_held()) { 319a9f26e8SHoratiu Vultur if (mrp->ring_id == ring_id) { 329a9f26e8SHoratiu Vultur res = mrp; 339a9f26e8SHoratiu Vultur break; 349a9f26e8SHoratiu Vultur } 359a9f26e8SHoratiu Vultur } 369a9f26e8SHoratiu Vultur 379a9f26e8SHoratiu Vultur return res; 389a9f26e8SHoratiu Vultur } 399a9f26e8SHoratiu Vultur 407aa38018SHoratiu Vultur static bool br_mrp_unique_ifindex(struct net_bridge *br, u32 ifindex) 417aa38018SHoratiu Vultur { 427aa38018SHoratiu Vultur struct br_mrp *mrp; 437aa38018SHoratiu Vultur 447aa38018SHoratiu Vultur list_for_each_entry_rcu(mrp, &br->mrp_list, list, 457aa38018SHoratiu Vultur lockdep_rtnl_is_held()) { 467aa38018SHoratiu Vultur struct net_bridge_port *p; 477aa38018SHoratiu Vultur 487aa38018SHoratiu Vultur p = rtnl_dereference(mrp->p_port); 497aa38018SHoratiu Vultur if (p && p->dev->ifindex == ifindex) 507aa38018SHoratiu Vultur return false; 517aa38018SHoratiu Vultur 527aa38018SHoratiu Vultur p = rtnl_dereference(mrp->s_port); 537aa38018SHoratiu Vultur if (p && p->dev->ifindex == ifindex) 547aa38018SHoratiu Vultur return false; 557aa38018SHoratiu Vultur } 567aa38018SHoratiu Vultur 577aa38018SHoratiu Vultur return true; 587aa38018SHoratiu Vultur } 597aa38018SHoratiu Vultur 609a9f26e8SHoratiu Vultur static struct br_mrp *br_mrp_find_port(struct net_bridge *br, 619a9f26e8SHoratiu Vultur struct net_bridge_port *p) 629a9f26e8SHoratiu Vultur { 639a9f26e8SHoratiu Vultur struct br_mrp *res = NULL; 649a9f26e8SHoratiu Vultur struct br_mrp *mrp; 659a9f26e8SHoratiu Vultur 669a9f26e8SHoratiu Vultur list_for_each_entry_rcu(mrp, &br->mrp_list, list, 679a9f26e8SHoratiu Vultur lockdep_rtnl_is_held()) { 689a9f26e8SHoratiu Vultur if (rcu_access_pointer(mrp->p_port) == p || 699a9f26e8SHoratiu Vultur rcu_access_pointer(mrp->s_port) == p) { 709a9f26e8SHoratiu Vultur res = mrp; 719a9f26e8SHoratiu Vultur break; 729a9f26e8SHoratiu Vultur } 739a9f26e8SHoratiu Vultur } 749a9f26e8SHoratiu Vultur 759a9f26e8SHoratiu Vultur return res; 769a9f26e8SHoratiu Vultur } 779a9f26e8SHoratiu Vultur 789a9f26e8SHoratiu Vultur static int br_mrp_next_seq(struct br_mrp *mrp) 799a9f26e8SHoratiu Vultur { 809a9f26e8SHoratiu Vultur mrp->seq_id++; 819a9f26e8SHoratiu Vultur return mrp->seq_id; 829a9f26e8SHoratiu Vultur } 839a9f26e8SHoratiu Vultur 849a9f26e8SHoratiu Vultur static struct sk_buff *br_mrp_skb_alloc(struct net_bridge_port *p, 859a9f26e8SHoratiu Vultur const u8 *src, const u8 *dst) 869a9f26e8SHoratiu Vultur { 879a9f26e8SHoratiu Vultur struct ethhdr *eth_hdr; 889a9f26e8SHoratiu Vultur struct sk_buff *skb; 899a9f26e8SHoratiu Vultur u16 *version; 909a9f26e8SHoratiu Vultur 919a9f26e8SHoratiu Vultur skb = dev_alloc_skb(MRP_MAX_FRAME_LENGTH); 929a9f26e8SHoratiu Vultur if (!skb) 939a9f26e8SHoratiu Vultur return NULL; 949a9f26e8SHoratiu Vultur 959a9f26e8SHoratiu Vultur skb->dev = p->dev; 969a9f26e8SHoratiu Vultur skb->protocol = htons(ETH_P_MRP); 979a9f26e8SHoratiu Vultur skb->priority = MRP_FRAME_PRIO; 989a9f26e8SHoratiu Vultur skb_reserve(skb, sizeof(*eth_hdr)); 999a9f26e8SHoratiu Vultur 1009a9f26e8SHoratiu Vultur eth_hdr = skb_push(skb, sizeof(*eth_hdr)); 1019a9f26e8SHoratiu Vultur ether_addr_copy(eth_hdr->h_dest, dst); 1029a9f26e8SHoratiu Vultur ether_addr_copy(eth_hdr->h_source, src); 1039a9f26e8SHoratiu Vultur eth_hdr->h_proto = htons(ETH_P_MRP); 1049a9f26e8SHoratiu Vultur 1059a9f26e8SHoratiu Vultur version = skb_put(skb, sizeof(*version)); 1069a9f26e8SHoratiu Vultur *version = cpu_to_be16(MRP_VERSION); 1079a9f26e8SHoratiu Vultur 1089a9f26e8SHoratiu Vultur return skb; 1099a9f26e8SHoratiu Vultur } 1109a9f26e8SHoratiu Vultur 1119a9f26e8SHoratiu Vultur static void br_mrp_skb_tlv(struct sk_buff *skb, 1129a9f26e8SHoratiu Vultur enum br_mrp_tlv_header_type type, 1139a9f26e8SHoratiu Vultur u8 length) 1149a9f26e8SHoratiu Vultur { 1159a9f26e8SHoratiu Vultur struct br_mrp_tlv_hdr *hdr; 1169a9f26e8SHoratiu Vultur 1179a9f26e8SHoratiu Vultur hdr = skb_put(skb, sizeof(*hdr)); 1189a9f26e8SHoratiu Vultur hdr->type = type; 1199a9f26e8SHoratiu Vultur hdr->length = length; 1209a9f26e8SHoratiu Vultur } 1219a9f26e8SHoratiu Vultur 1229a9f26e8SHoratiu Vultur static void br_mrp_skb_common(struct sk_buff *skb, struct br_mrp *mrp) 1239a9f26e8SHoratiu Vultur { 1249a9f26e8SHoratiu Vultur struct br_mrp_common_hdr *hdr; 1259a9f26e8SHoratiu Vultur 1269a9f26e8SHoratiu Vultur br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_COMMON, sizeof(*hdr)); 1279a9f26e8SHoratiu Vultur 1289a9f26e8SHoratiu Vultur hdr = skb_put(skb, sizeof(*hdr)); 1299a9f26e8SHoratiu Vultur hdr->seq_id = cpu_to_be16(br_mrp_next_seq(mrp)); 1309a9f26e8SHoratiu Vultur memset(hdr->domain, 0xff, MRP_DOMAIN_UUID_LENGTH); 1319a9f26e8SHoratiu Vultur } 1329a9f26e8SHoratiu Vultur 1339a9f26e8SHoratiu Vultur static struct sk_buff *br_mrp_alloc_test_skb(struct br_mrp *mrp, 1349a9f26e8SHoratiu Vultur struct net_bridge_port *p, 1359a9f26e8SHoratiu Vultur enum br_mrp_port_role_type port_role) 1369a9f26e8SHoratiu Vultur { 1379a9f26e8SHoratiu Vultur struct br_mrp_ring_test_hdr *hdr = NULL; 1389a9f26e8SHoratiu Vultur struct sk_buff *skb = NULL; 1399a9f26e8SHoratiu Vultur 1409a9f26e8SHoratiu Vultur if (!p) 1419a9f26e8SHoratiu Vultur return NULL; 1429a9f26e8SHoratiu Vultur 1439a9f26e8SHoratiu Vultur skb = br_mrp_skb_alloc(p, p->dev->dev_addr, mrp_test_dmac); 1449a9f26e8SHoratiu Vultur if (!skb) 1459a9f26e8SHoratiu Vultur return NULL; 1469a9f26e8SHoratiu Vultur 1479a9f26e8SHoratiu Vultur br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_RING_TEST, sizeof(*hdr)); 1489a9f26e8SHoratiu Vultur hdr = skb_put(skb, sizeof(*hdr)); 1499a9f26e8SHoratiu Vultur 1504b3a61b0SHoratiu Vultur hdr->prio = cpu_to_be16(mrp->prio); 1519a9f26e8SHoratiu Vultur ether_addr_copy(hdr->sa, p->br->dev->dev_addr); 1529a9f26e8SHoratiu Vultur hdr->port_role = cpu_to_be16(port_role); 1539a9f26e8SHoratiu Vultur hdr->state = cpu_to_be16(mrp->ring_state); 1549a9f26e8SHoratiu Vultur hdr->transitions = cpu_to_be16(mrp->ring_transitions); 1559a9f26e8SHoratiu Vultur hdr->timestamp = cpu_to_be32(jiffies_to_msecs(jiffies)); 1569a9f26e8SHoratiu Vultur 1579a9f26e8SHoratiu Vultur br_mrp_skb_common(skb, mrp); 1589a9f26e8SHoratiu Vultur br_mrp_skb_tlv(skb, BR_MRP_TLV_HEADER_END, 0x0); 1599a9f26e8SHoratiu Vultur 1609a9f26e8SHoratiu Vultur return skb; 1619a9f26e8SHoratiu Vultur } 1629a9f26e8SHoratiu Vultur 163c6676e7dSHoratiu Vultur /* This function is continuously called in the following cases: 164c6676e7dSHoratiu Vultur * - when node role is MRM, in this case test_monitor is always set to false 165c6676e7dSHoratiu Vultur * because it needs to notify the userspace that the ring is open and needs to 166c6676e7dSHoratiu Vultur * send MRP_Test frames 167c6676e7dSHoratiu Vultur * - when node role is MRA, there are 2 subcases: 168c6676e7dSHoratiu Vultur * - when MRA behaves as MRM, in this case is similar with MRM role 169c6676e7dSHoratiu Vultur * - when MRA behaves as MRC, in this case test_monitor is set to true, 170c6676e7dSHoratiu Vultur * because it needs to detect when it stops seeing MRP_Test frames 171c6676e7dSHoratiu Vultur * from MRM node but it doesn't need to send MRP_Test frames. 172c6676e7dSHoratiu Vultur */ 1739a9f26e8SHoratiu Vultur static void br_mrp_test_work_expired(struct work_struct *work) 1749a9f26e8SHoratiu Vultur { 1759a9f26e8SHoratiu Vultur struct delayed_work *del_work = to_delayed_work(work); 1769a9f26e8SHoratiu Vultur struct br_mrp *mrp = container_of(del_work, struct br_mrp, test_work); 1779a9f26e8SHoratiu Vultur struct net_bridge_port *p; 1789a9f26e8SHoratiu Vultur bool notify_open = false; 1799a9f26e8SHoratiu Vultur struct sk_buff *skb; 1809a9f26e8SHoratiu Vultur 1819a9f26e8SHoratiu Vultur if (time_before_eq(mrp->test_end, jiffies)) 1829a9f26e8SHoratiu Vultur return; 1839a9f26e8SHoratiu Vultur 1849a9f26e8SHoratiu Vultur if (mrp->test_count_miss < mrp->test_max_miss) { 1859a9f26e8SHoratiu Vultur mrp->test_count_miss++; 1869a9f26e8SHoratiu Vultur } else { 1879a9f26e8SHoratiu Vultur /* Notify that the ring is open only if the ring state is 1889a9f26e8SHoratiu Vultur * closed, otherwise it would continue to notify at every 1899a9f26e8SHoratiu Vultur * interval. 190c6676e7dSHoratiu Vultur * Also notify that the ring is open when the node has the 191c6676e7dSHoratiu Vultur * role MRA and behaves as MRC. The reason is that the 192c6676e7dSHoratiu Vultur * userspace needs to know when the MRM stopped sending 193c6676e7dSHoratiu Vultur * MRP_Test frames so that the current node to try to take 194c6676e7dSHoratiu Vultur * the role of a MRM. 1959a9f26e8SHoratiu Vultur */ 196c6676e7dSHoratiu Vultur if (mrp->ring_state == BR_MRP_RING_STATE_CLOSED || 197c6676e7dSHoratiu Vultur mrp->test_monitor) 1989a9f26e8SHoratiu Vultur notify_open = true; 1999a9f26e8SHoratiu Vultur } 2009a9f26e8SHoratiu Vultur 2019a9f26e8SHoratiu Vultur rcu_read_lock(); 2029a9f26e8SHoratiu Vultur 2039a9f26e8SHoratiu Vultur p = rcu_dereference(mrp->p_port); 2049a9f26e8SHoratiu Vultur if (p) { 205c6676e7dSHoratiu Vultur if (!mrp->test_monitor) { 206c6676e7dSHoratiu Vultur skb = br_mrp_alloc_test_skb(mrp, p, 207c6676e7dSHoratiu Vultur BR_MRP_PORT_ROLE_PRIMARY); 2089a9f26e8SHoratiu Vultur if (!skb) 2099a9f26e8SHoratiu Vultur goto out; 2109a9f26e8SHoratiu Vultur 2119a9f26e8SHoratiu Vultur skb_reset_network_header(skb); 2129a9f26e8SHoratiu Vultur dev_queue_xmit(skb); 213c6676e7dSHoratiu Vultur } 2149a9f26e8SHoratiu Vultur 2159a9f26e8SHoratiu Vultur if (notify_open && !mrp->ring_role_offloaded) 2169a9f26e8SHoratiu Vultur br_mrp_port_open(p->dev, true); 2179a9f26e8SHoratiu Vultur } 2189a9f26e8SHoratiu Vultur 2199a9f26e8SHoratiu Vultur p = rcu_dereference(mrp->s_port); 2209a9f26e8SHoratiu Vultur if (p) { 221c6676e7dSHoratiu Vultur if (!mrp->test_monitor) { 222c6676e7dSHoratiu Vultur skb = br_mrp_alloc_test_skb(mrp, p, 223c6676e7dSHoratiu Vultur BR_MRP_PORT_ROLE_SECONDARY); 2249a9f26e8SHoratiu Vultur if (!skb) 2259a9f26e8SHoratiu Vultur goto out; 2269a9f26e8SHoratiu Vultur 2279a9f26e8SHoratiu Vultur skb_reset_network_header(skb); 2289a9f26e8SHoratiu Vultur dev_queue_xmit(skb); 229c6676e7dSHoratiu Vultur } 2309a9f26e8SHoratiu Vultur 2319a9f26e8SHoratiu Vultur if (notify_open && !mrp->ring_role_offloaded) 2329a9f26e8SHoratiu Vultur br_mrp_port_open(p->dev, true); 2339a9f26e8SHoratiu Vultur } 2349a9f26e8SHoratiu Vultur 2359a9f26e8SHoratiu Vultur out: 2369a9f26e8SHoratiu Vultur rcu_read_unlock(); 2379a9f26e8SHoratiu Vultur 2389a9f26e8SHoratiu Vultur queue_delayed_work(system_wq, &mrp->test_work, 2399a9f26e8SHoratiu Vultur usecs_to_jiffies(mrp->test_interval)); 2409a9f26e8SHoratiu Vultur } 2419a9f26e8SHoratiu Vultur 2429a9f26e8SHoratiu Vultur /* Deletes the MRP instance. 2439a9f26e8SHoratiu Vultur * note: called under rtnl_lock 2449a9f26e8SHoratiu Vultur */ 2459a9f26e8SHoratiu Vultur static void br_mrp_del_impl(struct net_bridge *br, struct br_mrp *mrp) 2469a9f26e8SHoratiu Vultur { 2479a9f26e8SHoratiu Vultur struct net_bridge_port *p; 2484fb13499SHoratiu Vultur u8 state; 2499a9f26e8SHoratiu Vultur 2509a9f26e8SHoratiu Vultur /* Stop sending MRP_Test frames */ 2519a9f26e8SHoratiu Vultur cancel_delayed_work_sync(&mrp->test_work); 252c6676e7dSHoratiu Vultur br_mrp_switchdev_send_ring_test(br, mrp, 0, 0, 0, 0); 2539a9f26e8SHoratiu Vultur 2549a9f26e8SHoratiu Vultur br_mrp_switchdev_del(br, mrp); 2559a9f26e8SHoratiu Vultur 2569a9f26e8SHoratiu Vultur /* Reset the ports */ 2579a9f26e8SHoratiu Vultur p = rtnl_dereference(mrp->p_port); 2589a9f26e8SHoratiu Vultur if (p) { 2599a9f26e8SHoratiu Vultur spin_lock_bh(&br->lock); 2604fb13499SHoratiu Vultur state = netif_running(br->dev) ? 2614fb13499SHoratiu Vultur BR_STATE_FORWARDING : BR_STATE_DISABLED; 2624fb13499SHoratiu Vultur p->state = state; 2639a9f26e8SHoratiu Vultur p->flags &= ~BR_MRP_AWARE; 2649a9f26e8SHoratiu Vultur spin_unlock_bh(&br->lock); 2654fb13499SHoratiu Vultur br_mrp_port_switchdev_set_state(p, state); 2669a9f26e8SHoratiu Vultur rcu_assign_pointer(mrp->p_port, NULL); 2679a9f26e8SHoratiu Vultur } 2689a9f26e8SHoratiu Vultur 2699a9f26e8SHoratiu Vultur p = rtnl_dereference(mrp->s_port); 2709a9f26e8SHoratiu Vultur if (p) { 2719a9f26e8SHoratiu Vultur spin_lock_bh(&br->lock); 2724fb13499SHoratiu Vultur state = netif_running(br->dev) ? 2734fb13499SHoratiu Vultur BR_STATE_FORWARDING : BR_STATE_DISABLED; 2744fb13499SHoratiu Vultur p->state = state; 2759a9f26e8SHoratiu Vultur p->flags &= ~BR_MRP_AWARE; 2769a9f26e8SHoratiu Vultur spin_unlock_bh(&br->lock); 2774fb13499SHoratiu Vultur br_mrp_port_switchdev_set_state(p, state); 2789a9f26e8SHoratiu Vultur rcu_assign_pointer(mrp->s_port, NULL); 2799a9f26e8SHoratiu Vultur } 2809a9f26e8SHoratiu Vultur 2819a9f26e8SHoratiu Vultur list_del_rcu(&mrp->list); 2829a9f26e8SHoratiu Vultur kfree_rcu(mrp, rcu); 2839a9f26e8SHoratiu Vultur } 2849a9f26e8SHoratiu Vultur 2859a9f26e8SHoratiu Vultur /* Adds a new MRP instance. 2869a9f26e8SHoratiu Vultur * note: called under rtnl_lock 2879a9f26e8SHoratiu Vultur */ 2889a9f26e8SHoratiu Vultur int br_mrp_add(struct net_bridge *br, struct br_mrp_instance *instance) 2899a9f26e8SHoratiu Vultur { 2909a9f26e8SHoratiu Vultur struct net_bridge_port *p; 2919a9f26e8SHoratiu Vultur struct br_mrp *mrp; 2929a9f26e8SHoratiu Vultur int err; 2939a9f26e8SHoratiu Vultur 2949a9f26e8SHoratiu Vultur /* If the ring exists, it is not possible to create another one with the 2959a9f26e8SHoratiu Vultur * same ring_id 2969a9f26e8SHoratiu Vultur */ 2979a9f26e8SHoratiu Vultur mrp = br_mrp_find_id(br, instance->ring_id); 2989a9f26e8SHoratiu Vultur if (mrp) 2999a9f26e8SHoratiu Vultur return -EINVAL; 3009a9f26e8SHoratiu Vultur 3019a9f26e8SHoratiu Vultur if (!br_mrp_get_port(br, instance->p_ifindex) || 3029a9f26e8SHoratiu Vultur !br_mrp_get_port(br, instance->s_ifindex)) 3039a9f26e8SHoratiu Vultur return -EINVAL; 3049a9f26e8SHoratiu Vultur 3057aa38018SHoratiu Vultur /* It is not possible to have the same port part of multiple rings */ 3067aa38018SHoratiu Vultur if (!br_mrp_unique_ifindex(br, instance->p_ifindex) || 3077aa38018SHoratiu Vultur !br_mrp_unique_ifindex(br, instance->s_ifindex)) 3087aa38018SHoratiu Vultur return -EINVAL; 3097aa38018SHoratiu Vultur 3109a9f26e8SHoratiu Vultur mrp = kzalloc(sizeof(*mrp), GFP_KERNEL); 3119a9f26e8SHoratiu Vultur if (!mrp) 3129a9f26e8SHoratiu Vultur return -ENOMEM; 3139a9f26e8SHoratiu Vultur 3149a9f26e8SHoratiu Vultur mrp->ring_id = instance->ring_id; 3154b3a61b0SHoratiu Vultur mrp->prio = instance->prio; 3169a9f26e8SHoratiu Vultur 3179a9f26e8SHoratiu Vultur p = br_mrp_get_port(br, instance->p_ifindex); 3189a9f26e8SHoratiu Vultur spin_lock_bh(&br->lock); 3199a9f26e8SHoratiu Vultur p->state = BR_STATE_FORWARDING; 3209a9f26e8SHoratiu Vultur p->flags |= BR_MRP_AWARE; 3219a9f26e8SHoratiu Vultur spin_unlock_bh(&br->lock); 3229a9f26e8SHoratiu Vultur rcu_assign_pointer(mrp->p_port, p); 3239a9f26e8SHoratiu Vultur 3249a9f26e8SHoratiu Vultur p = br_mrp_get_port(br, instance->s_ifindex); 3259a9f26e8SHoratiu Vultur spin_lock_bh(&br->lock); 3269a9f26e8SHoratiu Vultur p->state = BR_STATE_FORWARDING; 3279a9f26e8SHoratiu Vultur p->flags |= BR_MRP_AWARE; 3289a9f26e8SHoratiu Vultur spin_unlock_bh(&br->lock); 3299a9f26e8SHoratiu Vultur rcu_assign_pointer(mrp->s_port, p); 3309a9f26e8SHoratiu Vultur 3319a9f26e8SHoratiu Vultur INIT_DELAYED_WORK(&mrp->test_work, br_mrp_test_work_expired); 3329a9f26e8SHoratiu Vultur list_add_tail_rcu(&mrp->list, &br->mrp_list); 3339a9f26e8SHoratiu Vultur 3349a9f26e8SHoratiu Vultur err = br_mrp_switchdev_add(br, mrp); 3359a9f26e8SHoratiu Vultur if (err) 3369a9f26e8SHoratiu Vultur goto delete_mrp; 3379a9f26e8SHoratiu Vultur 3389a9f26e8SHoratiu Vultur return 0; 3399a9f26e8SHoratiu Vultur 3409a9f26e8SHoratiu Vultur delete_mrp: 3419a9f26e8SHoratiu Vultur br_mrp_del_impl(br, mrp); 3429a9f26e8SHoratiu Vultur 3439a9f26e8SHoratiu Vultur return err; 3449a9f26e8SHoratiu Vultur } 3459a9f26e8SHoratiu Vultur 3469a9f26e8SHoratiu Vultur /* Deletes the MRP instance from which the port is part of 3479a9f26e8SHoratiu Vultur * note: called under rtnl_lock 3489a9f26e8SHoratiu Vultur */ 3499a9f26e8SHoratiu Vultur void br_mrp_port_del(struct net_bridge *br, struct net_bridge_port *p) 3509a9f26e8SHoratiu Vultur { 3519a9f26e8SHoratiu Vultur struct br_mrp *mrp = br_mrp_find_port(br, p); 3529a9f26e8SHoratiu Vultur 3539a9f26e8SHoratiu Vultur /* If the port is not part of a MRP instance just bail out */ 3549a9f26e8SHoratiu Vultur if (!mrp) 3559a9f26e8SHoratiu Vultur return; 3569a9f26e8SHoratiu Vultur 3579a9f26e8SHoratiu Vultur br_mrp_del_impl(br, mrp); 3589a9f26e8SHoratiu Vultur } 3599a9f26e8SHoratiu Vultur 3609a9f26e8SHoratiu Vultur /* Deletes existing MRP instance based on ring_id 3619a9f26e8SHoratiu Vultur * note: called under rtnl_lock 3629a9f26e8SHoratiu Vultur */ 3639a9f26e8SHoratiu Vultur int br_mrp_del(struct net_bridge *br, struct br_mrp_instance *instance) 3649a9f26e8SHoratiu Vultur { 3659a9f26e8SHoratiu Vultur struct br_mrp *mrp = br_mrp_find_id(br, instance->ring_id); 3669a9f26e8SHoratiu Vultur 3679a9f26e8SHoratiu Vultur if (!mrp) 3689a9f26e8SHoratiu Vultur return -EINVAL; 3699a9f26e8SHoratiu Vultur 3709a9f26e8SHoratiu Vultur br_mrp_del_impl(br, mrp); 3719a9f26e8SHoratiu Vultur 3729a9f26e8SHoratiu Vultur return 0; 3739a9f26e8SHoratiu Vultur } 3749a9f26e8SHoratiu Vultur 3759a9f26e8SHoratiu Vultur /* Set port state, port state can be forwarding, blocked or disabled 3769a9f26e8SHoratiu Vultur * note: already called with rtnl_lock 3779a9f26e8SHoratiu Vultur */ 3789a9f26e8SHoratiu Vultur int br_mrp_set_port_state(struct net_bridge_port *p, 3799a9f26e8SHoratiu Vultur enum br_mrp_port_state_type state) 3809a9f26e8SHoratiu Vultur { 3819a9f26e8SHoratiu Vultur if (!p || !(p->flags & BR_MRP_AWARE)) 3829a9f26e8SHoratiu Vultur return -EINVAL; 3839a9f26e8SHoratiu Vultur 3849a9f26e8SHoratiu Vultur spin_lock_bh(&p->br->lock); 3859a9f26e8SHoratiu Vultur 3869a9f26e8SHoratiu Vultur if (state == BR_MRP_PORT_STATE_FORWARDING) 3879a9f26e8SHoratiu Vultur p->state = BR_STATE_FORWARDING; 3889a9f26e8SHoratiu Vultur else 3899a9f26e8SHoratiu Vultur p->state = BR_STATE_BLOCKING; 3909a9f26e8SHoratiu Vultur 3919a9f26e8SHoratiu Vultur spin_unlock_bh(&p->br->lock); 3929a9f26e8SHoratiu Vultur 3939a9f26e8SHoratiu Vultur br_mrp_port_switchdev_set_state(p, state); 3949a9f26e8SHoratiu Vultur 3959a9f26e8SHoratiu Vultur return 0; 3969a9f26e8SHoratiu Vultur } 3979a9f26e8SHoratiu Vultur 3989a9f26e8SHoratiu Vultur /* Set port role, port role can be primary or secondary 3999a9f26e8SHoratiu Vultur * note: already called with rtnl_lock 4009a9f26e8SHoratiu Vultur */ 4019a9f26e8SHoratiu Vultur int br_mrp_set_port_role(struct net_bridge_port *p, 40220f6a05eSHoratiu Vultur enum br_mrp_port_role_type role) 4039a9f26e8SHoratiu Vultur { 4049a9f26e8SHoratiu Vultur struct br_mrp *mrp; 4059a9f26e8SHoratiu Vultur 4069a9f26e8SHoratiu Vultur if (!p || !(p->flags & BR_MRP_AWARE)) 4079a9f26e8SHoratiu Vultur return -EINVAL; 4089a9f26e8SHoratiu Vultur 40920f6a05eSHoratiu Vultur mrp = br_mrp_find_port(p->br, p); 4109a9f26e8SHoratiu Vultur 4119a9f26e8SHoratiu Vultur if (!mrp) 4129a9f26e8SHoratiu Vultur return -EINVAL; 4139a9f26e8SHoratiu Vultur 4147882c895SHoratiu Vultur switch (role) { 4157882c895SHoratiu Vultur case BR_MRP_PORT_ROLE_PRIMARY: 4169a9f26e8SHoratiu Vultur rcu_assign_pointer(mrp->p_port, p); 4177882c895SHoratiu Vultur break; 4187882c895SHoratiu Vultur case BR_MRP_PORT_ROLE_SECONDARY: 4199a9f26e8SHoratiu Vultur rcu_assign_pointer(mrp->s_port, p); 4207882c895SHoratiu Vultur break; 4217882c895SHoratiu Vultur default: 4227882c895SHoratiu Vultur return -EINVAL; 4237882c895SHoratiu Vultur } 4249a9f26e8SHoratiu Vultur 42520f6a05eSHoratiu Vultur br_mrp_port_switchdev_set_role(p, role); 4269a9f26e8SHoratiu Vultur 4279a9f26e8SHoratiu Vultur return 0; 4289a9f26e8SHoratiu Vultur } 4299a9f26e8SHoratiu Vultur 4309a9f26e8SHoratiu Vultur /* Set ring state, ring state can be only Open or Closed 4319a9f26e8SHoratiu Vultur * note: already called with rtnl_lock 4329a9f26e8SHoratiu Vultur */ 4339a9f26e8SHoratiu Vultur int br_mrp_set_ring_state(struct net_bridge *br, 4349a9f26e8SHoratiu Vultur struct br_mrp_ring_state *state) 4359a9f26e8SHoratiu Vultur { 4369a9f26e8SHoratiu Vultur struct br_mrp *mrp = br_mrp_find_id(br, state->ring_id); 4379a9f26e8SHoratiu Vultur 4389a9f26e8SHoratiu Vultur if (!mrp) 4399a9f26e8SHoratiu Vultur return -EINVAL; 4409a9f26e8SHoratiu Vultur 4419a9f26e8SHoratiu Vultur if (mrp->ring_state == BR_MRP_RING_STATE_CLOSED && 4429a9f26e8SHoratiu Vultur state->ring_state != BR_MRP_RING_STATE_CLOSED) 4439a9f26e8SHoratiu Vultur mrp->ring_transitions++; 4449a9f26e8SHoratiu Vultur 4459a9f26e8SHoratiu Vultur mrp->ring_state = state->ring_state; 4469a9f26e8SHoratiu Vultur 4479a9f26e8SHoratiu Vultur br_mrp_switchdev_set_ring_state(br, mrp, state->ring_state); 4489a9f26e8SHoratiu Vultur 4499a9f26e8SHoratiu Vultur return 0; 4509a9f26e8SHoratiu Vultur } 4519a9f26e8SHoratiu Vultur 4529a9f26e8SHoratiu Vultur /* Set ring role, ring role can be only MRM(Media Redundancy Manager) or 4539a9f26e8SHoratiu Vultur * MRC(Media Redundancy Client). 4549a9f26e8SHoratiu Vultur * note: already called with rtnl_lock 4559a9f26e8SHoratiu Vultur */ 4569a9f26e8SHoratiu Vultur int br_mrp_set_ring_role(struct net_bridge *br, 4579a9f26e8SHoratiu Vultur struct br_mrp_ring_role *role) 4589a9f26e8SHoratiu Vultur { 4599a9f26e8SHoratiu Vultur struct br_mrp *mrp = br_mrp_find_id(br, role->ring_id); 4609a9f26e8SHoratiu Vultur int err; 4619a9f26e8SHoratiu Vultur 4629a9f26e8SHoratiu Vultur if (!mrp) 4639a9f26e8SHoratiu Vultur return -EINVAL; 4649a9f26e8SHoratiu Vultur 4659a9f26e8SHoratiu Vultur mrp->ring_role = role->ring_role; 4669a9f26e8SHoratiu Vultur 4679a9f26e8SHoratiu Vultur /* If there is an error just bailed out */ 4689a9f26e8SHoratiu Vultur err = br_mrp_switchdev_set_ring_role(br, mrp, role->ring_role); 4699a9f26e8SHoratiu Vultur if (err && err != -EOPNOTSUPP) 4709a9f26e8SHoratiu Vultur return err; 4719a9f26e8SHoratiu Vultur 4729a9f26e8SHoratiu Vultur /* Now detect if the HW actually applied the role or not. If the HW 4739a9f26e8SHoratiu Vultur * applied the role it means that the SW will not to do those operations 4749a9f26e8SHoratiu Vultur * anymore. For example if the role ir MRM then the HW will notify the 4759a9f26e8SHoratiu Vultur * SW when ring is open, but if the is not pushed to the HW the SW will 4769a9f26e8SHoratiu Vultur * need to detect when the ring is open 4779a9f26e8SHoratiu Vultur */ 4789a9f26e8SHoratiu Vultur mrp->ring_role_offloaded = err == -EOPNOTSUPP ? 0 : 1; 4799a9f26e8SHoratiu Vultur 4809a9f26e8SHoratiu Vultur return 0; 4819a9f26e8SHoratiu Vultur } 4829a9f26e8SHoratiu Vultur 483c6676e7dSHoratiu Vultur /* Start to generate or monitor MRP test frames, the frames are generated by 484c6676e7dSHoratiu Vultur * HW and if it fails, they are generated by the SW. 4859a9f26e8SHoratiu Vultur * note: already called with rtnl_lock 4869a9f26e8SHoratiu Vultur */ 4879a9f26e8SHoratiu Vultur int br_mrp_start_test(struct net_bridge *br, 4889a9f26e8SHoratiu Vultur struct br_mrp_start_test *test) 4899a9f26e8SHoratiu Vultur { 4909a9f26e8SHoratiu Vultur struct br_mrp *mrp = br_mrp_find_id(br, test->ring_id); 4919a9f26e8SHoratiu Vultur 4929a9f26e8SHoratiu Vultur if (!mrp) 4939a9f26e8SHoratiu Vultur return -EINVAL; 4949a9f26e8SHoratiu Vultur 495c6676e7dSHoratiu Vultur /* Try to push it to the HW and if it fails then continue with SW 496c6676e7dSHoratiu Vultur * implementation and if that also fails then return error. 4979a9f26e8SHoratiu Vultur */ 4989a9f26e8SHoratiu Vultur if (!br_mrp_switchdev_send_ring_test(br, mrp, test->interval, 499c6676e7dSHoratiu Vultur test->max_miss, test->period, 500c6676e7dSHoratiu Vultur test->monitor)) 5019a9f26e8SHoratiu Vultur return 0; 5029a9f26e8SHoratiu Vultur 5039a9f26e8SHoratiu Vultur mrp->test_interval = test->interval; 5049a9f26e8SHoratiu Vultur mrp->test_end = jiffies + usecs_to_jiffies(test->period); 5059a9f26e8SHoratiu Vultur mrp->test_max_miss = test->max_miss; 506c6676e7dSHoratiu Vultur mrp->test_monitor = test->monitor; 5079a9f26e8SHoratiu Vultur mrp->test_count_miss = 0; 5089a9f26e8SHoratiu Vultur queue_delayed_work(system_wq, &mrp->test_work, 5099a9f26e8SHoratiu Vultur usecs_to_jiffies(test->interval)); 5109a9f26e8SHoratiu Vultur 5119a9f26e8SHoratiu Vultur return 0; 5129a9f26e8SHoratiu Vultur } 5139a9f26e8SHoratiu Vultur 5149a9f26e8SHoratiu Vultur /* Process only MRP Test frame. All the other MRP frames are processed by 5159a9f26e8SHoratiu Vultur * userspace application 5169a9f26e8SHoratiu Vultur * note: already called with rcu_read_lock 5179a9f26e8SHoratiu Vultur */ 5189a9f26e8SHoratiu Vultur static void br_mrp_mrm_process(struct br_mrp *mrp, struct net_bridge_port *port, 5199a9f26e8SHoratiu Vultur struct sk_buff *skb) 5209a9f26e8SHoratiu Vultur { 5219a9f26e8SHoratiu Vultur const struct br_mrp_tlv_hdr *hdr; 5229a9f26e8SHoratiu Vultur struct br_mrp_tlv_hdr _hdr; 5239a9f26e8SHoratiu Vultur 5249a9f26e8SHoratiu Vultur /* Each MRP header starts with a version field which is 16 bits. 5259a9f26e8SHoratiu Vultur * Therefore skip the version and get directly the TLV header. 5269a9f26e8SHoratiu Vultur */ 5279a9f26e8SHoratiu Vultur hdr = skb_header_pointer(skb, sizeof(uint16_t), sizeof(_hdr), &_hdr); 5289a9f26e8SHoratiu Vultur if (!hdr) 5299a9f26e8SHoratiu Vultur return; 5309a9f26e8SHoratiu Vultur 5319a9f26e8SHoratiu Vultur if (hdr->type != BR_MRP_TLV_HEADER_RING_TEST) 5329a9f26e8SHoratiu Vultur return; 5339a9f26e8SHoratiu Vultur 5349a9f26e8SHoratiu Vultur mrp->test_count_miss = 0; 5359a9f26e8SHoratiu Vultur 5369a9f26e8SHoratiu Vultur /* Notify the userspace that the ring is closed only when the ring is 5379a9f26e8SHoratiu Vultur * not closed 5389a9f26e8SHoratiu Vultur */ 5399a9f26e8SHoratiu Vultur if (mrp->ring_state != BR_MRP_RING_STATE_CLOSED) 5409a9f26e8SHoratiu Vultur br_mrp_port_open(port->dev, false); 5419a9f26e8SHoratiu Vultur } 5429a9f26e8SHoratiu Vultur 543c6676e7dSHoratiu Vultur /* Determin if the test hdr has a better priority than the node */ 544c6676e7dSHoratiu Vultur static bool br_mrp_test_better_than_own(struct br_mrp *mrp, 545c6676e7dSHoratiu Vultur struct net_bridge *br, 546c6676e7dSHoratiu Vultur const struct br_mrp_ring_test_hdr *hdr) 547c6676e7dSHoratiu Vultur { 548c6676e7dSHoratiu Vultur u16 prio = be16_to_cpu(hdr->prio); 549c6676e7dSHoratiu Vultur 550c6676e7dSHoratiu Vultur if (prio < mrp->prio || 551c6676e7dSHoratiu Vultur (prio == mrp->prio && 552c6676e7dSHoratiu Vultur ether_addr_to_u64(hdr->sa) < ether_addr_to_u64(br->dev->dev_addr))) 553c6676e7dSHoratiu Vultur return true; 554c6676e7dSHoratiu Vultur 555c6676e7dSHoratiu Vultur return false; 556c6676e7dSHoratiu Vultur } 557c6676e7dSHoratiu Vultur 558c6676e7dSHoratiu Vultur /* Process only MRP Test frame. All the other MRP frames are processed by 559c6676e7dSHoratiu Vultur * userspace application 560c6676e7dSHoratiu Vultur * note: already called with rcu_read_lock 561c6676e7dSHoratiu Vultur */ 562c6676e7dSHoratiu Vultur static void br_mrp_mra_process(struct br_mrp *mrp, struct net_bridge *br, 563c6676e7dSHoratiu Vultur struct net_bridge_port *port, 564c6676e7dSHoratiu Vultur struct sk_buff *skb) 565c6676e7dSHoratiu Vultur { 566c6676e7dSHoratiu Vultur const struct br_mrp_ring_test_hdr *test_hdr; 567c6676e7dSHoratiu Vultur struct br_mrp_ring_test_hdr _test_hdr; 568c6676e7dSHoratiu Vultur const struct br_mrp_tlv_hdr *hdr; 569c6676e7dSHoratiu Vultur struct br_mrp_tlv_hdr _hdr; 570c6676e7dSHoratiu Vultur 571c6676e7dSHoratiu Vultur /* Each MRP header starts with a version field which is 16 bits. 572c6676e7dSHoratiu Vultur * Therefore skip the version and get directly the TLV header. 573c6676e7dSHoratiu Vultur */ 574c6676e7dSHoratiu Vultur hdr = skb_header_pointer(skb, sizeof(uint16_t), sizeof(_hdr), &_hdr); 575c6676e7dSHoratiu Vultur if (!hdr) 576c6676e7dSHoratiu Vultur return; 577c6676e7dSHoratiu Vultur 578c6676e7dSHoratiu Vultur if (hdr->type != BR_MRP_TLV_HEADER_RING_TEST) 579c6676e7dSHoratiu Vultur return; 580c6676e7dSHoratiu Vultur 581c6676e7dSHoratiu Vultur test_hdr = skb_header_pointer(skb, sizeof(uint16_t) + sizeof(_hdr), 582c6676e7dSHoratiu Vultur sizeof(_test_hdr), &_test_hdr); 583c6676e7dSHoratiu Vultur if (!test_hdr) 584c6676e7dSHoratiu Vultur return; 585c6676e7dSHoratiu Vultur 586c6676e7dSHoratiu Vultur /* Only frames that have a better priority than the node will 587c6676e7dSHoratiu Vultur * clear the miss counter because otherwise the node will need to behave 588c6676e7dSHoratiu Vultur * as MRM. 589c6676e7dSHoratiu Vultur */ 590c6676e7dSHoratiu Vultur if (br_mrp_test_better_than_own(mrp, br, test_hdr)) 591c6676e7dSHoratiu Vultur mrp->test_count_miss = 0; 592c6676e7dSHoratiu Vultur } 593c6676e7dSHoratiu Vultur 5949a9f26e8SHoratiu Vultur /* This will just forward the frame to the other mrp ring port(MRC role) or will 5959a9f26e8SHoratiu Vultur * not do anything. 5969a9f26e8SHoratiu Vultur * note: already called with rcu_read_lock 5979a9f26e8SHoratiu Vultur */ 5989a9f26e8SHoratiu Vultur static int br_mrp_rcv(struct net_bridge_port *p, 5999a9f26e8SHoratiu Vultur struct sk_buff *skb, struct net_device *dev) 6009a9f26e8SHoratiu Vultur { 6019a9f26e8SHoratiu Vultur struct net_device *s_dev, *p_dev, *d_dev; 6029a9f26e8SHoratiu Vultur struct net_bridge_port *p_port, *s_port; 6039a9f26e8SHoratiu Vultur struct net_bridge *br; 6049a9f26e8SHoratiu Vultur struct sk_buff *nskb; 6059a9f26e8SHoratiu Vultur struct br_mrp *mrp; 6069a9f26e8SHoratiu Vultur 6079a9f26e8SHoratiu Vultur /* If port is disabled don't accept any frames */ 6089a9f26e8SHoratiu Vultur if (p->state == BR_STATE_DISABLED) 6099a9f26e8SHoratiu Vultur return 0; 6109a9f26e8SHoratiu Vultur 6119a9f26e8SHoratiu Vultur br = p->br; 6129a9f26e8SHoratiu Vultur mrp = br_mrp_find_port(br, p); 6139a9f26e8SHoratiu Vultur if (unlikely(!mrp)) 6149a9f26e8SHoratiu Vultur return 0; 6159a9f26e8SHoratiu Vultur 6169a9f26e8SHoratiu Vultur p_port = rcu_dereference(mrp->p_port); 6179a9f26e8SHoratiu Vultur if (!p_port) 6189a9f26e8SHoratiu Vultur return 0; 6199a9f26e8SHoratiu Vultur 6209a9f26e8SHoratiu Vultur s_port = rcu_dereference(mrp->s_port); 6219a9f26e8SHoratiu Vultur if (!s_port) 6229a9f26e8SHoratiu Vultur return 0; 6239a9f26e8SHoratiu Vultur 6249a9f26e8SHoratiu Vultur /* If the role is MRM then don't forward the frames */ 6259a9f26e8SHoratiu Vultur if (mrp->ring_role == BR_MRP_RING_ROLE_MRM) { 6269a9f26e8SHoratiu Vultur br_mrp_mrm_process(mrp, p, skb); 6279a9f26e8SHoratiu Vultur return 1; 6289a9f26e8SHoratiu Vultur } 6299a9f26e8SHoratiu Vultur 630c6676e7dSHoratiu Vultur /* If the role is MRA then don't forward the frames if it behaves as 631c6676e7dSHoratiu Vultur * MRM node 632c6676e7dSHoratiu Vultur */ 633c6676e7dSHoratiu Vultur if (mrp->ring_role == BR_MRP_RING_ROLE_MRA) { 634c6676e7dSHoratiu Vultur if (!mrp->test_monitor) { 635c6676e7dSHoratiu Vultur br_mrp_mrm_process(mrp, p, skb); 636c6676e7dSHoratiu Vultur return 1; 637c6676e7dSHoratiu Vultur } 638c6676e7dSHoratiu Vultur 639c6676e7dSHoratiu Vultur br_mrp_mra_process(mrp, br, p, skb); 640c6676e7dSHoratiu Vultur } 641c6676e7dSHoratiu Vultur 6429a9f26e8SHoratiu Vultur /* Clone the frame and forward it on the other MRP port */ 6439a9f26e8SHoratiu Vultur nskb = skb_clone(skb, GFP_ATOMIC); 6449a9f26e8SHoratiu Vultur if (!nskb) 6459a9f26e8SHoratiu Vultur return 0; 6469a9f26e8SHoratiu Vultur 6479a9f26e8SHoratiu Vultur p_dev = p_port->dev; 6489a9f26e8SHoratiu Vultur s_dev = s_port->dev; 6499a9f26e8SHoratiu Vultur 6509a9f26e8SHoratiu Vultur if (p_dev == dev) 6519a9f26e8SHoratiu Vultur d_dev = s_dev; 6529a9f26e8SHoratiu Vultur else 6539a9f26e8SHoratiu Vultur d_dev = p_dev; 6549a9f26e8SHoratiu Vultur 6559a9f26e8SHoratiu Vultur nskb->dev = d_dev; 6569a9f26e8SHoratiu Vultur skb_push(nskb, ETH_HLEN); 6579a9f26e8SHoratiu Vultur dev_queue_xmit(nskb); 6589a9f26e8SHoratiu Vultur 6599a9f26e8SHoratiu Vultur return 1; 6609a9f26e8SHoratiu Vultur } 6619a9f26e8SHoratiu Vultur 6629a9f26e8SHoratiu Vultur /* Check if the frame was received on a port that is part of MRP ring 6639a9f26e8SHoratiu Vultur * and if the frame has MRP eth. In that case process the frame otherwise do 6649a9f26e8SHoratiu Vultur * normal forwarding. 6659a9f26e8SHoratiu Vultur * note: already called with rcu_read_lock 6669a9f26e8SHoratiu Vultur */ 6679a9f26e8SHoratiu Vultur int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb) 6689a9f26e8SHoratiu Vultur { 6699a9f26e8SHoratiu Vultur /* If there is no MRP instance do normal forwarding */ 6709a9f26e8SHoratiu Vultur if (likely(!(p->flags & BR_MRP_AWARE))) 6719a9f26e8SHoratiu Vultur goto out; 6729a9f26e8SHoratiu Vultur 6739a9f26e8SHoratiu Vultur if (unlikely(skb->protocol == htons(ETH_P_MRP))) 6749a9f26e8SHoratiu Vultur return br_mrp_rcv(p, skb, p->dev); 6759a9f26e8SHoratiu Vultur 6769a9f26e8SHoratiu Vultur out: 6779a9f26e8SHoratiu Vultur return 0; 6789a9f26e8SHoratiu Vultur } 6799a9f26e8SHoratiu Vultur 6809a9f26e8SHoratiu Vultur bool br_mrp_enabled(struct net_bridge *br) 6819a9f26e8SHoratiu Vultur { 6829a9f26e8SHoratiu Vultur return !list_empty(&br->mrp_list); 6839a9f26e8SHoratiu Vultur } 684