From patchwork Wed Dec 2 08:38:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 551389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 20968140306 for ; Thu, 3 Dec 2015 01:37:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6F7A8840E6; Wed, 2 Dec 2015 14:37:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MxJ11-ItUyLS; Wed, 2 Dec 2015 14:37:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D2C5E87858; Wed, 2 Dec 2015 14:37:14 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id E68FC1C10D6 for ; Wed, 2 Dec 2015 14:37:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E08B225C61 for ; Wed, 2 Dec 2015 14:37:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q9OBgr0OM1tt for ; Wed, 2 Dec 2015 14:37:11 +0000 (UTC) X-Greylist: delayed 04:24:38 by SQLgrey-1.7.6 Received: from smtprelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by silver.osuosl.org (Postfix) with ESMTPS id 6AD3626BDE for ; Wed, 2 Dec 2015 14:37:11 +0000 (UTC) Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave08.hostedemail.com (Postfix) with ESMTP id B7A5C211B23 for ; Wed, 2 Dec 2015 08:39:02 +0000 (UTC) Received: from filter.hostedemail.com (unknown [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 31DBB26919A; Wed, 2 Dec 2015 08:38:58 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::, RULES_HIT:41:69:355:379:541:800:960:966:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:2194:2196:2199:2200:2393:2559:2562:2828:3138:3139:3140:3141:3142:3354:3866:3867:3870:3872:4225:4321:4385:5007:6119:6261:9592:10004:10400:10848:11026:11473:11657:11658:11783:11914:12043:12296:12438:12517:12519:12555:12679:13208:13229:13894:14394:14659:21067:21080:30054:30055:30064, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0, LFtime:2, LUA_SUMMARY:none X-HE-Tag: swim15_4e1aa7c82a63e X-Filterd-Recvd-Size: 4612 Received: from joe-X200MA.home (pool-173-51-221-2.lsanca.fios.verizon.net [173.51.221.2]) (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA; Wed, 2 Dec 2015 08:38:56 +0000 (UTC) Message-ID: <1449045535.3716.10.camel@perches.com> From: Joe Perches To: intel-wired-lan Date: Wed, 02 Dec 2015 00:38:55 -0800 In-Reply-To: <1449041100.3224.17.camel@intel.com> References: <1448475679-57194-1-git-send-email-jeffrey.t.kirsher@intel.com> <1448475679-57194-5-git-send-email-jeffrey.t.kirsher@intel.com> <5655FD72.70902@cogentembedded.com> <1448476535.3021.5.camel@intel.com> <1448480194.20113.48.camel@perches.com> <1449002936.1593.10.camel@perches.com> <1449041100.3224.17.camel@intel.com> X-Mailer: Evolution 3.18.2-0ubuntu2 Mime-Version: 1.0 Cc: netdev , Sergei Shtylyov Subject: [Intel-wired-lan] [PATCH] i40e: Fix i40e_print_features() VEB mode output X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building") added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in function i40e_print_features. Fix it. Miscellanea: o Remove unnecessary string variable o Add space before not after fixed strings o Use kmalloc not kzalloc o Don't initialize i to 0, use result of first snprintf Noticed-by: Sergei Shtylyov Signed-off-by: Joe Perches ---  drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----------------  1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 4b7d874..145eeb5 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -10240,52 +10240,48 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)  static void i40e_print_features(struct i40e_pf *pf)  {   struct i40e_hw *hw = &pf->hw; - char *buf, *string; - int i = 0; + char *buf; + int i;   - string = kzalloc(INFO_STRING_LEN, GFP_KERNEL); - if (!string) { - dev_err(&pf->pdev->dev, "Features string allocation failed\n"); + buf = kmalloc(INFO_STRING_LEN, GFP_KERNEL); + if (!buf)   return; - } - - buf = string;   - i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id); + i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id);  #ifdef CONFIG_PCI_IOV - i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs); + i += snprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs);  #endif - i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ", + i += snprintf(&buf[i], REMAIN(i), " VSIs: %d QP: %d RX: %s",         pf->hw.func_caps.num_vsis,         pf->vsi[pf->lan_vsi]->num_queue_pairs,         pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");     if (pf->flags & I40E_FLAG_RSS_ENABLED) - i += snprintf(&buf[i], REMAIN(i), "RSS "); + i += snprintf(&buf[i], REMAIN(i), " RSS");   if (pf->flags & I40E_FLAG_FD_ATR_ENABLED) - i += snprintf(&buf[i], REMAIN(i), "FD_ATR "); + i += snprintf(&buf[i], REMAIN(i), " FD_ATR");   if (pf->flags & I40E_FLAG_FD_SB_ENABLED) { - i += snprintf(&buf[i], REMAIN(i), "FD_SB "); - i += snprintf(&buf[i], REMAIN(i), "NTUPLE "); + i += snprintf(&buf[i], REMAIN(i), " FD_SB"); + i += snprintf(&buf[i], REMAIN(i), " NTUPLE");   }   if (pf->flags & I40E_FLAG_DCB_CAPABLE) - i += snprintf(&buf[i], REMAIN(i), "DCB "); + i += snprintf(&buf[i], REMAIN(i), " DCB");  #if IS_ENABLED(CONFIG_VXLAN) - i += snprintf(&buf[i], REMAIN(i), "VxLAN "); + i += snprintf(&buf[i], REMAIN(i), " VxLAN");  #endif   if (pf->flags & I40E_FLAG_PTP) - i += snprintf(&buf[i], REMAIN(i), "PTP "); + i += snprintf(&buf[i], REMAIN(i), " PTP");  #ifdef I40E_FCOE   if (pf->flags & I40E_FLAG_FCOE_ENABLED) - i += snprintf(&buf[i], REMAIN(i), "FCOE "); + i += snprintf(&buf[i], REMAIN(i), " FCOE");  #endif   if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED) - i += snprintf(&buf[i], REMAIN(i), "VEPA "); + i += snprintf(&buf[i], REMAIN(i), " VEB");   else - buf += sprintf(buf, "VEPA "); + i += snprintf(&buf[i], REMAIN(i), " VEPA");   - dev_info(&pf->pdev->dev, "%s\n", string); - kfree(string); + dev_info(&pf->pdev->dev, "%s\n", buf); + kfree(buf);   WARN_ON(i > INFO_STRING_LEN);  }