Merge tag 'powerpc-5.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux-2.6-microblaze.git] / drivers / net / ethernet / intel / ice / ice_switch.c
index 357d307..3b6c142 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright (c) 2018, Intel Corporation. */
 
+#include "ice_lib.h"
 #include "ice_switch.h"
 
 #define ICE_ETH_DA_OFFSET              0
@@ -302,6 +303,10 @@ static void ice_clear_vsi_q_ctx(struct ice_hw *hw, u16 vsi_handle)
                        devm_kfree(ice_hw_to_dev(hw), vsi->lan_q_ctx[i]);
                        vsi->lan_q_ctx[i] = NULL;
                }
+               if (vsi->rdma_q_ctx[i]) {
+                       devm_kfree(ice_hw_to_dev(hw), vsi->rdma_q_ctx[i]);
+                       vsi->rdma_q_ctx[i] = NULL;
+               }
        }
 }
 
@@ -422,6 +427,29 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
        return ice_aq_update_vsi(hw, vsi_ctx, cd);
 }
 
+/**
+ * ice_cfg_rdma_fltr - enable/disable RDMA filtering on VSI
+ * @hw: pointer to HW struct
+ * @vsi_handle: VSI SW index
+ * @enable: boolean for enable/disable
+ */
+int
+ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable)
+{
+       struct ice_vsi_ctx *ctx;
+
+       ctx = ice_get_vsi_ctx(hw, vsi_handle);
+       if (!ctx)
+               return -EIO;
+
+       if (enable)
+               ctx->info.q_opt_flags |= ICE_AQ_VSI_Q_OPT_PE_FLTR_EN;
+       else
+               ctx->info.q_opt_flags &= ~ICE_AQ_VSI_Q_OPT_PE_FLTR_EN;
+
+       return ice_status_to_errno(ice_update_vsi(hw, vsi_handle, ctx, NULL));
+}
+
 /**
  * ice_aq_alloc_free_vsi_list
  * @hw: pointer to the HW struct