Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1405209ybz; Fri, 17 Apr 2020 23:51:50 -0700 (PDT) X-Google-Smtp-Source: APiQypJRSdxzNcRks275jTGr3iiV6yyqLf1dSaalLoUROVf+Ce3w+wyPLAUDBLGBp2BXDIYxRL16 X-Received: by 2002:a05:6402:645:: with SMTP id u5mr6354024edx.41.1587192710171; Fri, 17 Apr 2020 23:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587192710; cv=none; d=google.com; s=arc-20160816; b=DzY3N6TKE3PRoyGyvM5qlXg/VDHNS4+pUQoWJ8gykClAYx9cK9QQMYZStYFE515zxU YX65SX2YfbvH1qAYIoj4C/49d7uMwL8atS+z/d4/Gk7k71C7InoXhx4zKiiiIvpW2GOv ergRzbaZScU4mtuWtEbF39K7FdXFepPKVXJf93M+/2WnUOaw2mAA7eTZr8mS0/f6LE6K foBq095U2kXe0nxS5Y+qBCBgHiJelMlba6G161OsM8Zvf+E4nHjLO1SKa98eEog8nWHh 7gpND41bmlzrVbiGVAhi/f72P3d74c47eHcwaoST6+bh+GfbpbBYCB7Mul02ffg4n73k eOXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=T2Y7jLNMWMkI+KJjrLHQfNydx3MIkvO6cbS5UY7njPs=; b=kw2HmO2ElNPbZ/Hl76e7LHGlUYru2UncexA8wo6MhOOdJLYjvC1VetAfl03yU15f2K C/OhozxnTiqr/UCcIywgwnLfZTAgjt6oCj3DFQ2lbmNiecifcWCoFUHxfUtdYq05lhgG /dVqwskrcukIlpdpnrkfndCGG0QXR1zmPlNBaHwaKJbZ1VfiekoSHcqmSP9Q8jrzS4V0 yBZV/FvBE7HQVCZo1zPe5uToiuKjh8KGtAYzI+OTkWY44vZ9JvZWye7yCjvkX9bWxtAi FwBcMcYOJjzS8cLpjw1AVjHRd2tO5uY7DCvNCqam5SO3LY/4SXHpha8LZ1QwUMOvWPjX 4icg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si15636979edf.265.2020.04.17.23.51.28; Fri, 17 Apr 2020 23:51:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726335AbgDRGsq (ORCPT + 99 others); Sat, 18 Apr 2020 02:48:46 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:54286 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726048AbgDRGs0 (ORCPT ); Sat, 18 Apr 2020 02:48:26 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 2BD041BD36E313F0A85C; Sat, 18 Apr 2020 14:48:20 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Sat, 18 Apr 2020 14:48:11 +0800 From: Huazhong Tan To: CC: , , , , , , Guojia Liao , Huazhong Tan Subject: [PATCH net-next 08/10] net: hns3: add debug information for flow table when failed Date: Sat, 18 Apr 2020 14:47:07 +0800 Message-ID: <1587192429-11463-9-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587192429-11463-1-git-send-email-tanhuazhong@huawei.com> References: <1587192429-11463-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guojia Liao Add some debug information for processing flow table if failed. Signed-off-by: Guojia Liao Signed-off-by: Huazhong Tan --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 40 ++++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 74efd95..20216e1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5381,22 +5381,31 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, u32 *unused_tuple) { if (fs->flow_type & FLOW_EXT) { - if (fs->h_ext.vlan_etype) + if (fs->h_ext.vlan_etype) { + dev_err(&hdev->pdev->dev, "vlan-etype is not supported!\n"); return -EOPNOTSUPP; + } + if (!fs->h_ext.vlan_tci) *unused_tuple |= BIT(INNER_VLAN_TAG_FST); if (fs->m_ext.vlan_tci && - be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) + be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) { + dev_err(&hdev->pdev->dev, "failed to config vlan_tci, invalid vlan_tci: %u, max is %u.\n", + ntohs(fs->h_ext.vlan_tci), VLAN_N_VID - 1); return -EINVAL; + } } else { *unused_tuple |= BIT(INNER_VLAN_TAG_FST); } if (fs->flow_type & FLOW_MAC_EXT) { if (hdev->fd_cfg.fd_mode != - HCLGE_FD_MODE_DEPTH_2K_WIDTH_400B_STAGE_1) + HCLGE_FD_MODE_DEPTH_2K_WIDTH_400B_STAGE_1) { + dev_err(&hdev->pdev->dev, + "FLOW_MAC_EXT is not supported in current fd mode!\n"); return -EOPNOTSUPP; + } if (is_zero_ether_addr(fs->h_ext.h_dest)) *unused_tuple |= BIT(INNER_DST_MAC); @@ -5414,8 +5423,12 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, u32 flow_type; int ret = 0; - if (fs->location >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) + if (fs->location >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) { + dev_err(&hdev->pdev->dev, "failed to config fd rules, invalid rule location: %u, max is %u\n.", + fs->location, + hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1] - 1); return -EINVAL; + } if ((fs->flow_type & FLOW_EXT) && (fs->h_ext.data[0] != 0 || fs->h_ext.data[1] != 0)) { @@ -5457,11 +5470,16 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, unused_tuple); break; default: + dev_err(&hdev->pdev->dev, "unsupported protocol type, protocol type = %#x\n", + flow_type); return -EOPNOTSUPP; } - if (ret) + if (ret) { + dev_err(&hdev->pdev->dev, "failed to check flow union tuple, ret = %d\n", + ret); return ret; + } return hclge_fd_check_ext_tuple(hdev, fs, unused_tuple); } @@ -5729,22 +5747,22 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle, u8 action; int ret; - if (!hnae3_dev_fd_supported(hdev)) + if (!hnae3_dev_fd_supported(hdev)) { + dev_err(&hdev->pdev->dev, "flow table director is not supported\n"); return -EOPNOTSUPP; + } if (!hdev->fd_en) { - dev_warn(&hdev->pdev->dev, - "Please enable flow director first\n"); + dev_err(&hdev->pdev->dev, + "please enable flow director first\n"); return -EOPNOTSUPP; } fs = (struct ethtool_rx_flow_spec *)&cmd->fs; ret = hclge_fd_check_spec(hdev, fs, &unused); - if (ret) { - dev_err(&hdev->pdev->dev, "Check fd spec failed\n"); + if (ret) return ret; - } if (fs->ring_cookie == RX_CLS_FLOW_DISC) { action = HCLGE_FD_ACTION_DROP_PACKET; -- 2.7.4