net/ice/base: add method to disable FDIR swap option
[dpdk.git] / drivers / net / ice / base / ice_common.c
index 107cebc..ae55beb 100644 (file)
@@ -1357,6 +1357,7 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = {
        ICE_CTX_STORE(ice_tlan_ctx, cache_prof_idx,             2,      166),
        ICE_CTX_STORE(ice_tlan_ctx, pkt_shaper_prof_idx,        3,      168),
        ICE_CTX_STORE(ice_tlan_ctx, int_q_state,                122,    171),
+       ICE_CTX_STORE(ice_tlan_ctx, gsc_ena,                    1,      172),
        { 0 }
 };
 
@@ -5493,6 +5494,81 @@ ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
        return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
 }
 
+/**
+ * ice_aq_set_driver_param - Set driver parameter to share via firmware
+ * @hw: pointer to the HW struct
+ * @idx: parameter index to set
+ * @value: the value to set the parameter to
+ * @cd: pointer to command details structure or NULL
+ *
+ * Set the value of one of the software defined parameters. All PFs connected
+ * to this device can read the value using ice_aq_get_driver_param.
+ *
+ * Note that firmware provides no synchronization or locking, and will not
+ * save the parameter value during a device reset. It is expected that
+ * a single PF will write the parameter value, while all other PFs will only
+ * read it.
+ */
+enum ice_status
+ice_aq_set_driver_param(struct ice_hw *hw, enum ice_aqc_driver_params idx,
+                       u32 value, struct ice_sq_cd *cd)
+{
+       struct ice_aqc_driver_shared_params *cmd;
+       struct ice_aq_desc desc;
+
+       if (idx >= ICE_AQC_DRIVER_PARAM_MAX)
+               return ICE_ERR_OUT_OF_RANGE;
+
+       cmd = &desc.params.drv_shared_params;
+
+       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_driver_shared_params);
+
+       cmd->set_or_get_op = ICE_AQC_DRIVER_PARAM_SET;
+       cmd->param_indx = idx;
+       cmd->param_val = CPU_TO_LE32(value);
+
+       return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+}
+
+/**
+ * ice_aq_get_driver_param - Get driver parameter shared via firmware
+ * @hw: pointer to the HW struct
+ * @idx: parameter index to set
+ * @value: storage to return the shared parameter
+ * @cd: pointer to command details structure or NULL
+ *
+ * Get the value of one of the software defined parameters.
+ *
+ * Note that firmware provides no synchronization or locking. It is expected
+ * that only a single PF will write a given parameter.
+ */
+enum ice_status
+ice_aq_get_driver_param(struct ice_hw *hw, enum ice_aqc_driver_params idx,
+                       u32 *value, struct ice_sq_cd *cd)
+{
+       struct ice_aqc_driver_shared_params *cmd;
+       struct ice_aq_desc desc;
+       enum ice_status status;
+
+       if (idx >= ICE_AQC_DRIVER_PARAM_MAX)
+               return ICE_ERR_OUT_OF_RANGE;
+
+       cmd = &desc.params.drv_shared_params;
+
+       ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_driver_shared_params);
+
+       cmd->set_or_get_op = ICE_AQC_DRIVER_PARAM_GET;
+       cmd->param_indx = idx;
+
+       status = ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
+       if (status)
+               return status;
+
+       *value = LE32_TO_CPU(cmd->param_val);
+
+       return ICE_SUCCESS;
+}
+
 /**
  * ice_aq_set_gpio
  * @hw: pointer to the hw struct