From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by dpdk.org (Postfix) with ESMTP id D7ED22946 for ; Mon, 9 Jan 2017 00:08:57 +0100 (CET) Received: by mail-pf0-f181.google.com with SMTP id 189so13316050pfu.3 for ; Sun, 08 Jan 2017 15:08:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gIx4uYV0YfQZJU/OCfodHf0/m1IwH7pPfE6G0WIZgUw=; b=jaA+SYsa08YA+T4Himj33P+WrkFd4s3tbQxvV9FCHRTUx3LIEgsRXch42X5qLZQvPq MU3O68RZTv46bLA0ntSC0MRf7yczainwbntdXVtOi7s9EsElFtLeGdEHkjCJGK+vnPnX /uNEyv8SqBmUrfY/vegbORdvoWwj9/IyxHs7wR6LDs5cUpmozNotBDnU06gQ/TnnhPQf 9p5VqaLB1adiRwWy11eBxU0xae1VthWwb92KeNzat3Aw29PFLw0rxLbCecNkdnX2AApr d+3DFPUwJVOX+JUEp/phpOiguCmo3rjbm2Z6SW/FVfQJEDWf2jCib7DgIeGDbi1xSyxE bt/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gIx4uYV0YfQZJU/OCfodHf0/m1IwH7pPfE6G0WIZgUw=; b=dYqJKajDdVIiBk4ls5purNSz18AWg+4IbOaMNIO1KcwGGiif6GE+sASdiOZkDnq+4N 7Q6a1/ZSsYpgJPlcZqqX98lG6/OVakCMDFazqoVG8U9hWnBEpg6k5dSkqfWA2wfP5P2N 8zsjCK/mkqLccHw/5WXpx887Mdqi9fnEPYdKslcvfCIEI9JGeyY2gJv5Ui2V5pOEemaP mKBkdBWd+Z8q6kVAMl9124pqllchKJ43qW76hqJv1cokFqQlgOjYqL8HM8yEilcR0s7G 6Lb0KBzh5kcrVoaY43l+DNlIv5UALq+2086Dbhzq3EqngyCaVI+6ZbxAVZ5Y96z/JF25 nDew== X-Gm-Message-State: AIkVDXK3ZUGTdUfyV0ywctLxlutXHiEisa2oqsTbSyPwBflAVUegfTsr+OpRPHIFwezVRw== X-Received: by 10.99.151.1 with SMTP id n1mr156974505pge.122.1483916936277; Sun, 08 Jan 2017 15:08:56 -0800 (PST) Received: from xeon-e3 (204-195-18-65.wavecable.com. [204.195.18.65]) by smtp.gmail.com with ESMTPSA id n8sm153872686pgc.0.2017.01.08.15.08.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Jan 2017 15:08:56 -0800 (PST) Date: Sun, 8 Jan 2017 15:08:48 -0800 From: Stephen Hemminger To: Qiming Yang Cc: dev@dpdk.org, ferruh.yigit@intel.com, helin.zhang@intel.com, remy.horton@intel.com Message-ID: <20170108150848.50e8a15a@xeon-e3> In-Reply-To: <1483848695-44643-5-git-send-email-qiming.yang@intel.com> References: <1483531428-14481-1-git-send-email-qiming.yang@intel.com> <1483848695-44643-1-git-send-email-qiming.yang@intel.com> <1483848695-44643-5-git-send-email-qiming.yang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 4/5] net/i40e: add firmware version get 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: Sun, 08 Jan 2017 23:08:58 -0000 On Sun, 8 Jan 2017 12:11:34 +0800 Qiming Yang wrote: > static void > +i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length) > +{ > + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + snprintf(fw_version, fw_length, > + "%d.%d%d 0x%08x", > + ((hw->nvm.version >> 12) & 0xf), > + ((hw->nvm.version >> 4) & 0xff), > + (hw->nvm.version & 0xf), hw->nvm.eetrack); It would be good to have same constants and format between Linux kernel driver and DPDK. Use %u as format specifier for unsigned values static inline char *i40e_nvm_version_str(struct i40e_hw *hw) { static char buf[32]; u32 full_ver; u8 ver, patch; u16 build; full_ver = hw->nvm.oem_ver; ver = (u8)(full_ver >> I40E_OEM_VER_SHIFT); build = (u16)((full_ver >> I40E_OEM_VER_BUILD_SHIFT) & I40E_OEM_VER_BUILD_MASK); patch = (u8)(full_ver & I40E_OEM_VER_PATCH_MASK); snprintf(buf, sizeof(buf), "%x.%02x 0x%x %d.%d.%d", (hw->nvm.version & I40E_NVM_VERSION_HI_MASK) >> I40E_NVM_VERSION_HI_SHIFT, (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >> I40E_NVM_VERSION_LO_SHIFT, hw->nvm.eetrack, ver, build, patch);