From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (lpdvrndsmtp01.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id C514C3250 for ; Thu, 18 May 2017 03:58:29 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.224.233]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id B577330C07A; Wed, 17 May 2017 18:58:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com B577330C07A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1495072708; bh=TbU7vHhlkBIUf/YNwnie1ZNDOPE1N9k+njtivj+t+00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q8RklpHisEkGNqjpNsbPc3soCYvVrkAnVFWGHm3x5fws9t+Bp/kIuojvRiiwcBLsC xd3kcn+QTtsxMKqckuM4semZL3pXYvSEMZ7/4tHg/5vL4qcZKerCEP8l/y7DZn4txx bLq3Vg0oNOhsmCLg9Ts00hE0+Xh2lytFBWSz0R9U= Received: from C02PT1RBG8WP.vpn.broadcom.net (unknown [10.10.118.136]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 0D36F820A6; Wed, 17 May 2017 18:58:27 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Wed, 17 May 2017 20:58:05 -0500 Message-Id: <20170518015813.7862-16-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20170518015813.7862-1-ajit.khaparde@broadcom.com> References: <20170518015813.7862-1-ajit.khaparde@broadcom.com> Subject: [dpdk-dev] [PATCH 15/23] bnxt: add support for fw_version_get dev_op X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 01:58:31 -0000 This patch adds support for fw_version_get dev_op Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 9a0acee..9d503b7 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1356,6 +1356,25 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev, return bnxt_hwrm_cfa_l2_set_rx_mask(bp, &bp->vnic_info[0], 0, NULL); } +static int +bnxt_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) +{ + struct bnxt *bp = (struct bnxt *)dev->data->dev_private; + uint8_t fw_major = (bp->fw_ver >> 24) & 0xff; + uint8_t fw_minor = (bp->fw_ver >> 16) & 0xff; + uint8_t fw_updt = (bp->fw_ver >> 8) & 0xff; + int ret; + + ret = snprintf(fw_version, fw_size, "%d.%d.%d", + fw_major, fw_minor, fw_updt); + + ret += 1; /* add the size of '\0' */ + if (fw_size < (uint32_t)ret) + return ret; + else + return 0; +} + /* * Initialization */ @@ -1395,6 +1414,7 @@ static const struct eth_dev_ops bnxt_dev_ops = { .xstats_get = bnxt_dev_xstats_get_op, .xstats_get_names = bnxt_dev_xstats_get_names_op, .xstats_reset = bnxt_dev_xstats_reset_op, + .fw_version_get = bnxt_fw_version_get, .set_mc_addr_list = bnxt_dev_set_mc_addr_list_op, }; -- 2.10.1 (Apple Git-78)