net/hns3: support promiscuous and allmulticast mode for VF
[dpdk.git] / drivers / net / hns3 / hns3_mbx.c
index 0d03f50..b03a3d6 100644 (file)
@@ -324,6 +324,21 @@ hns3_handle_link_change_event(struct hns3_hw *hw,
        hns3_update_link_status(hw);
 }
 
+static void
+hns3_handle_promisc_info(struct hns3_hw *hw, uint16_t promisc_en)
+{
+       if (!promisc_en) {
+               /*
+                * When promisc/allmulti mode is closed by the hns3 PF kernel
+                * ethdev driver for untrusted, modify VF's related status.
+                */
+               hns3_warn(hw, "Promisc mode will be closed by host for being "
+                             "untrusted.");
+               hw->data->promiscuous = 0;
+               hw->data->all_multicast = 0;
+       }
+}
+
 void
 hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
 {
@@ -380,6 +395,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
                case HNS3_MBX_PUSH_LINK_STATUS:
                        hns3_handle_link_change_event(hw, req);
                        break;
+               case HNS3_MBX_PUSH_PROMISC_INFO:
+                       /*
+                        * When the trust status of VF device changed by the
+                        * hns3 PF kernel driver, VF driver will receive this
+                        * mailbox message from PF driver.
+                        */
+                       hns3_handle_promisc_info(hw, req->msg[1]);
+                       break;
                default:
                        hns3_err(hw,
                                 "VF received unsupported(%d) mbx msg from PF",