@@ -2032,6 +2032,37 @@ i40e_status i40e_aq_set_vsi_broadcast(struct i40e_hw *hw,
2032
2032
return status ;
2033
2033
}
2034
2034
2035
+ /**
2036
+ * i40e_aq_set_vsi_vlan_promisc - control the VLAN promiscuous setting
2037
+ * @hw: pointer to the hw struct
2038
+ * @seid: vsi number
2039
+ * @enable: set MAC L2 layer unicast promiscuous enable/disable for a given VLAN
2040
+ * @cmd_details: pointer to command details structure or NULL
2041
+ **/
2042
+ i40e_status i40e_aq_set_vsi_vlan_promisc (struct i40e_hw * hw ,
2043
+ u16 seid , bool enable ,
2044
+ struct i40e_asq_cmd_details * cmd_details )
2045
+ {
2046
+ struct i40e_aq_desc desc ;
2047
+ struct i40e_aqc_set_vsi_promiscuous_modes * cmd =
2048
+ (struct i40e_aqc_set_vsi_promiscuous_modes * )& desc .params .raw ;
2049
+ i40e_status status ;
2050
+ u16 flags = 0 ;
2051
+
2052
+ i40e_fill_default_direct_cmd_desc (& desc ,
2053
+ i40e_aqc_opc_set_vsi_promiscuous_modes );
2054
+ if (enable )
2055
+ flags |= I40E_AQC_SET_VSI_PROMISC_VLAN ;
2056
+
2057
+ cmd -> promiscuous_flags = cpu_to_le16 (flags );
2058
+ cmd -> valid_flags = cpu_to_le16 (I40E_AQC_SET_VSI_PROMISC_VLAN );
2059
+ cmd -> seid = cpu_to_le16 (seid );
2060
+
2061
+ status = i40e_asq_send_command (hw , & desc , NULL , 0 , cmd_details );
2062
+
2063
+ return status ;
2064
+ }
2065
+
2035
2066
/**
2036
2067
* i40e_get_vsi_params - get VSI configuration info
2037
2068
* @hw: pointer to the hw struct
@@ -2469,6 +2500,137 @@ i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 seid,
2469
2500
return status ;
2470
2501
}
2471
2502
2503
+ /**
2504
+ * i40e_mirrorrule_op - Internal helper function to add/delete mirror rule
2505
+ * @hw: pointer to the hw struct
2506
+ * @opcode: AQ opcode for add or delete mirror rule
2507
+ * @sw_seid: Switch SEID (to which rule refers)
2508
+ * @rule_type: Rule Type (ingress/egress/VLAN)
2509
+ * @id: Destination VSI SEID or Rule ID
2510
+ * @count: length of the list
2511
+ * @mr_list: list of mirrored VSI SEIDs or VLAN IDs
2512
+ * @cmd_details: pointer to command details structure or NULL
2513
+ * @rule_id: Rule ID returned from FW
2514
+ * @rule_used: Number of rules used in internal switch
2515
+ * @rule_free: Number of rules free in internal switch
2516
+ *
2517
+ * Add/Delete a mirror rule to a specific switch. Mirror rules are supported for
2518
+ * VEBs/VEPA elements only
2519
+ **/
2520
+ static i40e_status i40e_mirrorrule_op (struct i40e_hw * hw ,
2521
+ u16 opcode , u16 sw_seid , u16 rule_type , u16 id ,
2522
+ u16 count , __le16 * mr_list ,
2523
+ struct i40e_asq_cmd_details * cmd_details ,
2524
+ u16 * rule_id , u16 * rules_used , u16 * rules_free )
2525
+ {
2526
+ struct i40e_aq_desc desc ;
2527
+ struct i40e_aqc_add_delete_mirror_rule * cmd =
2528
+ (struct i40e_aqc_add_delete_mirror_rule * )& desc .params .raw ;
2529
+ struct i40e_aqc_add_delete_mirror_rule_completion * resp =
2530
+ (struct i40e_aqc_add_delete_mirror_rule_completion * )& desc .params .raw ;
2531
+ i40e_status status ;
2532
+ u16 buf_size ;
2533
+
2534
+ buf_size = count * sizeof (* mr_list );
2535
+
2536
+ /* prep the rest of the request */
2537
+ i40e_fill_default_direct_cmd_desc (& desc , opcode );
2538
+ cmd -> seid = cpu_to_le16 (sw_seid );
2539
+ cmd -> rule_type = cpu_to_le16 (rule_type &
2540
+ I40E_AQC_MIRROR_RULE_TYPE_MASK );
2541
+ cmd -> num_entries = cpu_to_le16 (count );
2542
+ /* Dest VSI for add, rule_id for delete */
2543
+ cmd -> destination = cpu_to_le16 (id );
2544
+ if (mr_list ) {
2545
+ desc .flags |= cpu_to_le16 ((u16 )(I40E_AQ_FLAG_BUF |
2546
+ I40E_AQ_FLAG_RD ));
2547
+ if (buf_size > I40E_AQ_LARGE_BUF )
2548
+ desc .flags |= cpu_to_le16 ((u16 )I40E_AQ_FLAG_LB );
2549
+ }
2550
+
2551
+ status = i40e_asq_send_command (hw , & desc , mr_list , buf_size ,
2552
+ cmd_details );
2553
+ if (!status ||
2554
+ hw -> aq .asq_last_status == I40E_AQ_RC_ENOSPC ) {
2555
+ if (rule_id )
2556
+ * rule_id = le16_to_cpu (resp -> rule_id );
2557
+ if (rules_used )
2558
+ * rules_used = le16_to_cpu (resp -> mirror_rules_used );
2559
+ if (rules_free )
2560
+ * rules_free = le16_to_cpu (resp -> mirror_rules_free );
2561
+ }
2562
+ return status ;
2563
+ }
2564
+
2565
+ /**
2566
+ * i40e_aq_add_mirrorrule - add a mirror rule
2567
+ * @hw: pointer to the hw struct
2568
+ * @sw_seid: Switch SEID (to which rule refers)
2569
+ * @rule_type: Rule Type (ingress/egress/VLAN)
2570
+ * @dest_vsi: SEID of VSI to which packets will be mirrored
2571
+ * @count: length of the list
2572
+ * @mr_list: list of mirrored VSI SEIDs or VLAN IDs
2573
+ * @cmd_details: pointer to command details structure or NULL
2574
+ * @rule_id: Rule ID returned from FW
2575
+ * @rule_used: Number of rules used in internal switch
2576
+ * @rule_free: Number of rules free in internal switch
2577
+ *
2578
+ * Add mirror rule. Mirror rules are supported for VEBs or VEPA elements only
2579
+ **/
2580
+ i40e_status i40e_aq_add_mirrorrule (struct i40e_hw * hw , u16 sw_seid ,
2581
+ u16 rule_type , u16 dest_vsi , u16 count , __le16 * mr_list ,
2582
+ struct i40e_asq_cmd_details * cmd_details ,
2583
+ u16 * rule_id , u16 * rules_used , u16 * rules_free )
2584
+ {
2585
+ if (!(rule_type == I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS ||
2586
+ rule_type == I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS )) {
2587
+ if (count == 0 || !mr_list )
2588
+ return I40E_ERR_PARAM ;
2589
+ }
2590
+
2591
+ return i40e_mirrorrule_op (hw , i40e_aqc_opc_add_mirror_rule , sw_seid ,
2592
+ rule_type , dest_vsi , count , mr_list ,
2593
+ cmd_details , rule_id , rules_used , rules_free );
2594
+ }
2595
+
2596
+ /**
2597
+ * i40e_aq_delete_mirrorrule - delete a mirror rule
2598
+ * @hw: pointer to the hw struct
2599
+ * @sw_seid: Switch SEID (to which rule refers)
2600
+ * @rule_type: Rule Type (ingress/egress/VLAN)
2601
+ * @count: length of the list
2602
+ * @rule_id: Rule ID that is returned in the receive desc as part of
2603
+ * add_mirrorrule.
2604
+ * @mr_list: list of mirrored VLAN IDs to be removed
2605
+ * @cmd_details: pointer to command details structure or NULL
2606
+ * @rule_used: Number of rules used in internal switch
2607
+ * @rule_free: Number of rules free in internal switch
2608
+ *
2609
+ * Delete a mirror rule. Mirror rules are supported for VEBs/VEPA elements only
2610
+ **/
2611
+ i40e_status i40e_aq_delete_mirrorrule (struct i40e_hw * hw , u16 sw_seid ,
2612
+ u16 rule_type , u16 rule_id , u16 count , __le16 * mr_list ,
2613
+ struct i40e_asq_cmd_details * cmd_details ,
2614
+ u16 * rules_used , u16 * rules_free )
2615
+ {
2616
+ /* Rule ID has to be valid except rule_type: INGRESS VLAN mirroring */
2617
+ if (rule_type != I40E_AQC_MIRROR_RULE_TYPE_VLAN ) {
2618
+ if (!rule_id )
2619
+ return I40E_ERR_PARAM ;
2620
+ } else {
2621
+ /* count and mr_list shall be valid for rule_type INGRESS VLAN
2622
+ * mirroring. For other rule_type, count and rule_type should
2623
+ * not matter.
2624
+ */
2625
+ if (count == 0 || !mr_list )
2626
+ return I40E_ERR_PARAM ;
2627
+ }
2628
+
2629
+ return i40e_mirrorrule_op (hw , i40e_aqc_opc_delete_mirror_rule , sw_seid ,
2630
+ rule_type , rule_id , count , mr_list ,
2631
+ cmd_details , NULL , rules_used , rules_free );
2632
+ }
2633
+
2472
2634
/**
2473
2635
* i40e_aq_send_msg_to_vf
2474
2636
* @hw: pointer to the hardware structure
0 commit comments