@@ -8786,32 +8786,16 @@ static void hclge_enable_vlan_filter(struct hnae3_handle *handle, bool enable)
8786
8786
handle -> netdev_flags &= ~HNAE3_VLAN_FLTR ;
8787
8787
}
8788
8788
8789
- static int hclge_set_vf_vlan_common (struct hclge_dev * hdev , u16 vfid ,
8790
- bool is_kill , u16 vlan ,
8791
- __be16 proto )
8789
+ static int hclge_set_vf_vlan_filter_cmd (struct hclge_dev * hdev , u16 vfid ,
8790
+ bool is_kill , u16 vlan ,
8791
+ struct hclge_desc * desc )
8792
8792
{
8793
- struct hclge_vport * vport = & hdev -> vport [vfid ];
8794
8793
struct hclge_vlan_filter_vf_cfg_cmd * req0 ;
8795
8794
struct hclge_vlan_filter_vf_cfg_cmd * req1 ;
8796
- struct hclge_desc desc [2 ];
8797
8795
u8 vf_byte_val ;
8798
8796
u8 vf_byte_off ;
8799
8797
int ret ;
8800
8798
8801
- /* if vf vlan table is full, firmware will close vf vlan filter, it
8802
- * is unable and unnecessary to add new vlan id to vf vlan filter.
8803
- * If spoof check is enable, and vf vlan is full, it shouldn't add
8804
- * new vlan, because tx packets with these vlan id will be dropped.
8805
- */
8806
- if (test_bit (vfid , hdev -> vf_vlan_full ) && !is_kill ) {
8807
- if (vport -> vf_info .spoofchk && vlan ) {
8808
- dev_err (& hdev -> pdev -> dev ,
8809
- "Can't add vlan due to spoof check is on and vf vlan table is full\n" );
8810
- return - EPERM ;
8811
- }
8812
- return 0 ;
8813
- }
8814
-
8815
8799
hclge_cmd_setup_basic_desc (& desc [0 ],
8816
8800
HCLGE_OPC_VLAN_FILTER_VF_CFG , false);
8817
8801
hclge_cmd_setup_basic_desc (& desc [1 ],
@@ -8841,12 +8825,22 @@ static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, u16 vfid,
8841
8825
return ret ;
8842
8826
}
8843
8827
8828
+ return 0 ;
8829
+ }
8830
+
8831
+ static int hclge_check_vf_vlan_cmd_status (struct hclge_dev * hdev , u16 vfid ,
8832
+ bool is_kill , struct hclge_desc * desc )
8833
+ {
8834
+ struct hclge_vlan_filter_vf_cfg_cmd * req ;
8835
+
8836
+ req = (struct hclge_vlan_filter_vf_cfg_cmd * )desc [0 ].data ;
8837
+
8844
8838
if (!is_kill ) {
8845
8839
#define HCLGE_VF_VLAN_NO_ENTRY 2
8846
- if (!req0 -> resp_code || req0 -> resp_code == 1 )
8840
+ if (!req -> resp_code || req -> resp_code == 1 )
8847
8841
return 0 ;
8848
8842
8849
- if (req0 -> resp_code == HCLGE_VF_VLAN_NO_ENTRY ) {
8843
+ if (req -> resp_code == HCLGE_VF_VLAN_NO_ENTRY ) {
8850
8844
set_bit (vfid , hdev -> vf_vlan_full );
8851
8845
dev_warn (& hdev -> pdev -> dev ,
8852
8846
"vf vlan table is full, vf vlan filter is disabled\n" );
@@ -8855,28 +8849,57 @@ static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, u16 vfid,
8855
8849
8856
8850
dev_err (& hdev -> pdev -> dev ,
8857
8851
"Add vf vlan filter fail, ret =%u.\n" ,
8858
- req0 -> resp_code );
8852
+ req -> resp_code );
8859
8853
} else {
8860
8854
#define HCLGE_VF_VLAN_DEL_NO_FOUND 1
8861
- if (!req0 -> resp_code )
8855
+ if (!req -> resp_code )
8862
8856
return 0 ;
8863
8857
8864
8858
/* vf vlan filter is disabled when vf vlan table is full,
8865
8859
* then new vlan id will not be added into vf vlan table.
8866
8860
* Just return 0 without warning, avoid massive verbose
8867
8861
* print logs when unload.
8868
8862
*/
8869
- if (req0 -> resp_code == HCLGE_VF_VLAN_DEL_NO_FOUND )
8863
+ if (req -> resp_code == HCLGE_VF_VLAN_DEL_NO_FOUND )
8870
8864
return 0 ;
8871
8865
8872
8866
dev_err (& hdev -> pdev -> dev ,
8873
8867
"Kill vf vlan filter fail, ret =%u.\n" ,
8874
- req0 -> resp_code );
8868
+ req -> resp_code );
8875
8869
}
8876
8870
8877
8871
return - EIO ;
8878
8872
}
8879
8873
8874
+ static int hclge_set_vf_vlan_common (struct hclge_dev * hdev , u16 vfid ,
8875
+ bool is_kill , u16 vlan ,
8876
+ __be16 proto )
8877
+ {
8878
+ struct hclge_vport * vport = & hdev -> vport [vfid ];
8879
+ struct hclge_desc desc [2 ];
8880
+ int ret ;
8881
+
8882
+ /* if vf vlan table is full, firmware will close vf vlan filter, it
8883
+ * is unable and unnecessary to add new vlan id to vf vlan filter.
8884
+ * If spoof check is enable, and vf vlan is full, it shouldn't add
8885
+ * new vlan, because tx packets with these vlan id will be dropped.
8886
+ */
8887
+ if (test_bit (vfid , hdev -> vf_vlan_full ) && !is_kill ) {
8888
+ if (vport -> vf_info .spoofchk && vlan ) {
8889
+ dev_err (& hdev -> pdev -> dev ,
8890
+ "Can't add vlan due to spoof check is on and vf vlan table is full\n" );
8891
+ return - EPERM ;
8892
+ }
8893
+ return 0 ;
8894
+ }
8895
+
8896
+ ret = hclge_set_vf_vlan_filter_cmd (hdev , vfid , is_kill , vlan , desc );
8897
+ if (ret )
8898
+ return ret ;
8899
+
8900
+ return hclge_check_vf_vlan_cmd_status (hdev , vfid , is_kill , desc );
8901
+ }
8902
+
8880
8903
static int hclge_set_port_vlan_filter (struct hclge_dev * hdev , __be16 proto ,
8881
8904
u16 vlan_id , bool is_kill )
8882
8905
{
0 commit comments