From patchwork Fri May 3 13:57:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 139840 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 55EBB43F76; Fri, 3 May 2024 15:59:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59C9F40DDB; Fri, 3 May 2024 15:58:47 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by mails.dpdk.org (Postfix) with ESMTP id 3122440A82 for ; Fri, 3 May 2024 15:58:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714744726; x=1746280726; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Az6ekstKTYrf2jGrZ3RcLmxxo/FXdjG1D0NxeKvHWnY=; b=eTl9/VMN2CcZ6rqpk1eNzacuSD/BaJRP1jDdgDJSeMVurK6PH66JFuQp 0uAFQnfaoo1PDf3jyYt8LQvJqfty5Pf62xEgO7r9PPzXPibCA7IUxUYko 8kTCVOY/Kmz0+OPwPwYN1Y3U3GAwDR5n6gpKZGFSeUiaS3tn0y3Jz7otM +1V2mF+X2Tjyr92PKO/30iuFZt5944hDHKNNrBzZqzw8xUpvESZG9aO+C +6iYGp9nRojZwAPfmr0sR0PwUjYwOepmMvsFZdIIsoz1nETEdtSpHYeSH WnUI2rHC+LJ2yyYOJdk9iI0lqVJ/AkrAp5Jhb8WL2xUES6cKbiGeD0yi6 A==; X-CSE-ConnectionGUID: WFZp6MtDRMqmDhkwas3Olw== X-CSE-MsgGUID: 33bJe+WEQ7KlXLf0b4IbmQ== X-IronPort-AV: E=McAfee;i="6600,9927,11063"; a="10714944" X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="10714944" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2024 06:58:45 -0700 X-CSE-ConnectionGUID: 3ecRsp15RcWS4UrbqTGtKQ== X-CSE-MsgGUID: uYREfTgCR3+aIJrtHZeXrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,251,1708416000"; d="scan'208";a="50642006" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by fmviesa002.fm.intel.com with ESMTP; 03 May 2024 06:58:43 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Slawomir Mrozowicz , bruce.richardson@intel.com, vladimir.medvedkin@intel.com, Tyl@dpdk.org, RadoslawX , Skajewski@dpdk.org, PiotrX , Michael@dpdk.org, Alice Subject: [PATCH v2 12/27] net/ixgbe/base: added link state handling Date: Fri, 3 May 2024 14:57:43 +0100 Message-ID: <12911b60ac69e1d2a39d0a81f214302d4cbe866e.1714744628.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Slawomir Mrozowicz Adding a functionality that retrieves information from PF regarding the link state of a given VF. It is part of the general functionality that allows the PF driver to control the state of the virtual link VF devices. Signed-off-by: Slawomir Mrozowicz Reviewed-by: Tyl, RadoslawX Reviewed-by: Skajewski, PiotrX Reviewed-by: Michael, Alice --- drivers/net/ixgbe/base/ixgbe_mbx.h | 1 + drivers/net/ixgbe/base/ixgbe_type.h | 1 + drivers/net/ixgbe/base/ixgbe_vf.c | 29 +++++++++++++++++++++++++++++ drivers/net/ixgbe/base/ixgbe_vf.h | 1 + 4 files changed, 32 insertions(+) diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h index fadfccaabb..f368b1d745 100644 --- a/drivers/net/ixgbe/base/ixgbe_mbx.h +++ b/drivers/net/ixgbe/base/ixgbe_mbx.h @@ -123,6 +123,7 @@ enum ixgbe_pfvf_api_rev { #define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */ #define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS key */ #define IXGBE_VF_UPDATE_XCAST_MODE 0x0c +#define IXGBE_VF_GET_LINK_STATE 0x10 /* get vf link state */ /* mode choices for IXGBE_VF_UPDATE_XCAST_MODE */ enum ixgbevf_xcast_modes { diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h index 51b9ef274b..ec832fb1b0 100644 --- a/drivers/net/ixgbe/base/ixgbe_type.h +++ b/drivers/net/ixgbe/base/ixgbe_type.h @@ -3983,6 +3983,7 @@ struct ixgbe_mac_operations { ixgbe_mc_addr_itr); s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32, ixgbe_mc_addr_itr, bool clear); + s32 (*get_link_state)(struct ixgbe_hw *, bool *); s32 (*enable_mc)(struct ixgbe_hw *); s32 (*disable_mc)(struct ixgbe_hw *); s32 (*clear_vfta)(struct ixgbe_hw *); diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c index 603c24b653..0d5b29ba50 100644 --- a/drivers/net/ixgbe/base/ixgbe_vf.c +++ b/drivers/net/ixgbe/base/ixgbe_vf.c @@ -46,6 +46,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw) hw->mac.ops.init_rx_addrs = NULL; hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf; hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode; + hw->mac.ops.get_link_state = ixgbe_get_link_state_vf; hw->mac.ops.enable_mc = NULL; hw->mac.ops.disable_mc = NULL; hw->mac.ops.clear_vfta = NULL; @@ -426,6 +427,34 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode) return IXGBE_SUCCESS; } +/** + * ixgbe_get_link_state_vf - Get VF link state from PF + * @hw: pointer to the HW structure + * @link_state: link state storage + * + * Returns state of the operation error or success. + **/ +s32 ixgbe_get_link_state_vf(struct ixgbe_hw *hw, bool *link_state) +{ + u32 msgbuf[2]; + s32 err; + s32 ret_val; + + msgbuf[0] = IXGBE_VF_GET_LINK_STATE; + msgbuf[1] = 0x0; + + err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2); + + if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE)) { + ret_val = IXGBE_ERR_MBX; + } else { + ret_val = IXGBE_SUCCESS; + *link_state = msgbuf[1]; + } + + return ret_val; +} + /** * ixgbe_set_vfta_vf - Set/Unset vlan filter table address * @hw: pointer to the HW structure diff --git a/drivers/net/ixgbe/base/ixgbe_vf.h b/drivers/net/ixgbe/base/ixgbe_vf.h index be58b4f76e..bd10865d57 100644 --- a/drivers/net/ixgbe/base/ixgbe_vf.h +++ b/drivers/net/ixgbe/base/ixgbe_vf.h @@ -106,6 +106,7 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list, u32 mc_addr_count, ixgbe_mc_addr_itr, bool clear); s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode); +s32 ixgbe_get_link_state_vf(struct ixgbe_hw *hw, bool *link_state); s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on, bool vlvf_bypass); s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);