]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ice: Add code to process LLDP MIB change events
authorAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Thu, 28 Feb 2019 23:24:26 +0000 (15:24 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 18 Apr 2019 15:38:47 +0000 (08:38 -0700)
This patch adds support to process LLDP MIB change notifications sent
by the firmware.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ice/ice_dcb.c
drivers/net/ethernet/intel/ice/ice_dcb.h
drivers/net/ethernet/intel/ice/ice_dcb_lib.c
drivers/net/ethernet/intel/ice/ice_dcb_lib.h
drivers/net/ethernet/intel/ice/ice_main.c

index fbc656589144621e2da1aa0b1bea646e7cbe4c34..0df244cf684d9ee2275b8eff9144cd2a2ed103db 100644 (file)
@@ -588,8 +588,7 @@ ice_parse_org_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg)
  *
  * Parse DCB configuration from the LLDPDU
  */
-static enum ice_status
-ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
+enum ice_status ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
 {
        struct ice_lldp_org_tlv *tlv;
        enum ice_status ret = 0;
@@ -871,7 +870,7 @@ out:
  *
  * Get DCB configuration from the Firmware
  */
-static enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi)
+enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi)
 {
        struct ice_aqc_get_cee_dcb_cfg_resp cee_cfg;
        struct ice_dcbx_cfg *dcbx_cfg;
index 25d9b6f07ae068aa266ce0cead22e959bfcc32a2..39fb20c7900b033ee8d70a79b73f1c551fa0b14e 100644 (file)
@@ -121,6 +121,8 @@ struct ice_cee_app_prio {
 } __packed;
 
 u8 ice_get_dcbx_status(struct ice_hw *hw);
+enum ice_status ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg);
+enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi);
 enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi);
 enum ice_status ice_init_dcb(struct ice_hw *hw);
 enum ice_status
index c52bd5bb37c2c4d1e2b46e9ed302709ebbc15ed4..6bbca2c99dbdf6251e9935d9286f97d1b8098d92 100644 (file)
@@ -320,3 +320,39 @@ dcb_init_err:
        dev_err(dev, "DCB init failed\n");
        return err;
 }
+
+/**
+ * ice_dcb_process_lldp_set_mib_change - Process MIB change
+ * @pf: ptr to ice_pf
+ * @event: pointer to the admin queue receive event
+ */
+void
+ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,
+                                   struct ice_rq_event_info *event)
+{
+       if (pf->dcbx_cap & DCB_CAP_DCBX_LLD_MANAGED) {
+               struct ice_dcbx_cfg *dcbcfg, *prev_cfg;
+               int err;
+
+               prev_cfg = &pf->hw.port_info->local_dcbx_cfg;
+               dcbcfg = devm_kmemdup(&pf->pdev->dev, prev_cfg,
+                                     sizeof(*dcbcfg), GFP_KERNEL);
+               if (!dcbcfg)
+                       return;
+
+               err = ice_lldp_to_dcb_cfg(event->msg_buf, dcbcfg);
+               if (!err)
+                       ice_pf_dcb_cfg(pf, dcbcfg);
+
+               devm_kfree(&pf->pdev->dev, dcbcfg);
+
+               /* Get updated DCBx data from firmware */
+               err = ice_get_dcb_cfg(pf->hw.port_info);
+               if (err)
+                       dev_err(&pf->pdev->dev,
+                               "Failed to get DCB config\n");
+       } else {
+               dev_dbg(&pf->pdev->dev,
+                       "MIB Change Event in HOST mode\n");
+       }
+}
index 9c2fa11f6383d3658ac03246cba9c6d4a66565b0..3a2ffc98f292dd47ec19b23c290df6189f3917a9 100644 (file)
@@ -11,6 +11,9 @@
 u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg);
 u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);
 int ice_init_pf_dcb(struct ice_pf *pf);
+void
+ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,
+                                   struct ice_rq_event_info *event);
 #else
 static inline u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg __always_unused *dcbcfg)
 {
@@ -28,5 +31,6 @@ static inline int ice_init_pf_dcb(struct ice_pf *pf)
        return -EOPNOTSUPP;
 }
 
+#define ice_dcb_process_lldp_set_mib_change(pf, event) do {} while (0)
 #endif /* CONFIG_DCB */
 #endif /* _ICE_DCB_LIB_H_ */
index ff84a6c318a67a80e36199c8e63fc0d654f63e5d..ac560862f56036f32935e6de327a5fc79d4a5f68 100644 (file)
@@ -936,6 +936,9 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
                case ice_aqc_opc_fw_logging:
                        ice_output_fw_log(hw, &event.desc, event.msg_buf);
                        break;
+               case ice_aqc_opc_lldp_set_mib_change:
+                       ice_dcb_process_lldp_set_mib_change(pf, &event);
+                       break;
                default:
                        dev_dbg(&pf->pdev->dev,
                                "%s Receive Queue unknown event 0x%04x ignored\n",