Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1295709imu; Fri, 9 Nov 2018 14:10:45 -0800 (PST) X-Google-Smtp-Source: AJdET5crEqay/lH1aXChMN8AazvA49uaGxzyRYG0/tH1H+B+bWIs0XuwmNuDdSK3ikhMTJTb6MX4 X-Received: by 2002:a17:902:b90c:: with SMTP id bf12-v6mr10008603plb.1.1541801445836; Fri, 09 Nov 2018 14:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541801445; cv=none; d=google.com; s=arc-20160816; b=QR7zFNCYIBXQ/dsHZChZWBtt2Y0tYz0QXj55NcXoxghf/MP6TEVMWSLv63zkC/Kq0P DWuDaeMeEbcYCzzndPWFPbOOEL/sVYFpu76tDx1aU5FdpjDF5/8dWFhvFF1hikrmoHk9 LpDxi4l72grXjJCxFSAjXoER/QUtpvTL6vomTaGv5hTLwNhiouWi/CinfZHDa484+F7H +hlnWae+ySMwrtvMp8LS3F5dHDSk1HgqLMP7cDOKIZteQPS+BEMwzqGii1duI1++YUvb WqY5Jhl1hnZpYCTpiln64U7Y421UXiDujvkpJAtPhPpmAV3RMbaXJ+zfubUv55CYqemq +hgg== 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=p1oNGZBs0c7uXAylKT3qRx10sBHGeWioLF28sXO9tAQ=; b=wAIR/ZoeSB5SFVTKpjoqY7Qr0jEh2RlkX69MqOuQHijhPBDIwoc7rOB7n0RizX/oz6 oUnA/If5DjUNEupmM8Mzx+6xlz5aEhONuc6my5+HorO+jmoCqWTAYRPhvvM1bNllrANW ceMVqtEstzif1Lb0Tp3yIVKZROj97KhkP60F8ZnrlKElNz7Fp/8+7XBxpv7AHklDQxfU mScbsMm1lsDnhOe7ChFdRq3cR088d6TqoZ0h6N0W4MGP0bsN1mtxmaWZzPhV2cB8lnSe TsyBlZf4IuvvvVmtiIZ5rgQt76zQDipHn182Tc9uRNT6r+RvNyhZloEPwJlG+zo8nBBB jfxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j135-v6si9924677pfd.243.2018.11.09.14.10.30; Fri, 09 Nov 2018 14:10:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728895AbeKJHwJ (ORCPT + 99 others); Sat, 10 Nov 2018 02:52:09 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15075 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728784AbeKJHvn (ORCPT ); Sat, 10 Nov 2018 02:51:43 -0500 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0D137BC4054E5; Sat, 10 Nov 2018 06:09:09 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.408.0; Sat, 10 Nov 2018 06:09:00 +0800 From: Salil Mehta To: CC: , , , , , , , , , , , liuzhongzhu Subject: [RFC PATCH 07/10] net: hns3: Add checksum info query function Date: Fri, 9 Nov 2018 22:07:40 +0000 Message-ID: <20181109220743.10264-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181109220743.10264-1-salil.mehta@huawei.com> References: <20181109220743.10264-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: liuzhongzhu This patch prints checksum config information related to various layers of headers. debugfs command: echo dump checksum > cmd Sample Output: root@(none)# echo dump checksum > cmd hns3 0000:7d:00.0: dump checksum hns3 0000:7d:00.0: outer_l3: enable hns3 0000:7d:00.0: outer_udp: enable hns3 0000:7d:00.0: inner_l3: enable hns3 0000:7d:00.0: inner_tcp: enable hns3 0000:7d:00.0: inner_udp: enable hns3 0000:7d:00.0: inner_sctp: enable root@(none)# Signed-off-by: liuzhongzhu Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 1 + .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 3 ++ .../ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 50 ++++++++++++++++++++++ .../ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h | 11 +++++ 4 files changed, 65 insertions(+) create mode 100644 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c index 4d7be38..27757be 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c @@ -132,6 +132,7 @@ static void hns3_dbg_help(struct hnae3_handle *h) dev_info(&h->pdev->dev, "dump promisc [vf id]\n"); dev_info(&h->pdev->dev, "dump tc\n"); dev_info(&h->pdev->dev, "dump tm\n"); + dev_info(&h->pdev->dev, "dump checksum\n"); } static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h index cc0f214..2c84e39 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h @@ -96,6 +96,9 @@ enum hclge_opcode_type { HCLGE_OPC_CONFIG_SPEED_DUP = 0x0309, HCLGE_OPC_SERDES_LOOPBACK = 0x0315, + /* check sum command */ + HCLGE_OPC_CFG_CHECKSUM_EN = 0x0601, + /* PFC/Pause commands */ HCLGE_OPC_CFG_MAC_PAUSE_EN = 0x0701, HCLGE_OPC_CFG_PFC_PAUSE_EN = 0x0702, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index 4ada773..4fa546f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -3,6 +3,7 @@ #include +#include "hclge_debugfs.h" #include "hclge_cmd.h" #include "hclge_main.h" #include "hclge_tm.h" @@ -17,6 +18,15 @@ static void hclge_print(struct hclge_dev *hdev, bool flag, char *true_buf, dev_info(&hdev->pdev->dev, "%s\n", false_buf); } +static void hclge_title_print(struct hclge_dev *hdev, bool flag, + char *title_buf, char *true_buf, char *false_buf) +{ + if (flag) + dev_info(&hdev->pdev->dev, "%s: %s\n", title_buf, true_buf); + else + dev_info(&hdev->pdev->dev, "%s: %s\n", title_buf, false_buf); +} + static void hclge_title_idx_print(struct hclge_dev *hdev, bool flag, int index, char *title_buf, char *true_buf, char *false_buf) @@ -293,6 +303,44 @@ static void hclge_dbg_dump_tm(struct hclge_dev *hdev) cmd, ret); } +static void hclge_dbg_dump_checksum(struct hclge_dev *hdev) +{ +#define HCLGE_DBG_OUTER_L3_B BIT(0) +#define HCLGE_DBG_OUTER_UDP_B BIT(1) +#define HCLGE_DBG_INNER_L3_B BIT(0) +#define HCLGE_DBG_INNER_TCP_B BIT(1) +#define HCLGE_DBG_INNER_UDP_B BIT(2) +#define HCLGE_DBG_INNER_SCTP_B BIT(3) + + struct hclge_checksum_cmd *checksum; + struct hclge_desc desc; + int ret; + + hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CFG_CHECKSUM_EN, true); + + ret = hclge_cmd_send(&hdev->hw, &desc, 1); + if (ret) { + dev_err(&hdev->pdev->dev, "dump checksum fail, status is %d.\n", + ret); + return; + } + + checksum = (struct hclge_checksum_cmd *)desc.data; + dev_info(&hdev->pdev->dev, "dump checksum\n"); + hclge_title_print(hdev, checksum->outer & HCLGE_DBG_OUTER_L3_B, + "outer_l3", "enable", "disable"); + hclge_title_print(hdev, checksum->outer & HCLGE_DBG_OUTER_UDP_B, + "outer_udp", "enable", "disable"); + hclge_title_print(hdev, checksum->inner & HCLGE_DBG_INNER_L3_B, + "inner_l3", "enable", "disable"); + hclge_title_print(hdev, checksum->inner & HCLGE_DBG_INNER_TCP_B, + "inner_tcp", "enable", "disable"); + hclge_title_print(hdev, checksum->inner & HCLGE_DBG_INNER_UDP_B, + "inner_udp", "enable", "disable"); + hclge_title_print(hdev, checksum->inner & HCLGE_DBG_INNER_SCTP_B, + "inner_sctp", "enable", "disable"); +} + static void hclge_dbg_fd_tcam_read(struct hclge_dev *hdev, u8 stage, bool sel_x, u32 loc) { @@ -360,6 +408,8 @@ int hclge_dbg_run_cmd(struct hnae3_handle *handle, char *cmd_buf) hclge_dbg_dump_tc(hdev); } else if (strncmp(cmd_buf, "dump tm", 7) == 0) { hclge_dbg_dump_tm(hdev); + } else if (strncmp(cmd_buf, "dump checksum", 13) == 0) { + hclge_dbg_dump_checksum(hdev); } else { dev_info(&hdev->pdev->dev, "unknown command\n"); return -EINVAL; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h new file mode 100644 index 0000000..4ec9ced --- /dev/null +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +// Copyright (c) 2018-2019 Hisilicon Limited. + +#ifndef __HCLGE_DEBUGFS_H +#define __HCLGE_DEBUGFS_H + +struct hclge_checksum_cmd { + u8 outer; + u8 inner; +}; +#endif -- 2.7.4