From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0088.outbound.protection.outlook.com [104.47.37.88]) by dpdk.org (Postfix) with ESMTP id 4C20A5F51 for ; Sat, 29 Sep 2018 10:14:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2wt0onWHnrv10vF6tWSwAIMhL9f5A+CFA7uXCLUO6ME=; b=aLEJDnwBCPWHT8sKn2gMxLEN78Fq80buwl3zi6VyXL2TpK/ryZLrLjrtfW5cUOXiQIgwfEZ4QRsEACjEjG3tuKWweI/1p8oFuvzJFHYOsxYnfJ4KldaIMBQyWO4OlPjdGNhlzDn9f+24huIsQhZftTh5p1BlRyRyaIVh1tDdYQc= Received: from BYAPR07MB5365.namprd07.prod.outlook.com (20.177.125.18) by BYAPR07MB4806.namprd07.prod.outlook.com (20.176.248.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.20; Sat, 29 Sep 2018 08:14:38 +0000 Received: from BYAPR07MB5365.namprd07.prod.outlook.com ([fe80::2047:9647:f196:bde0]) by BYAPR07MB5365.namprd07.prod.outlook.com ([fe80::2047:9647:f196:bde0%6]) with mapi id 15.20.1143.022; Sat, 29 Sep 2018 08:14:38 +0000 From: "Mody, Rasesh" To: "dev@dpdk.org" CC: "Mody, Rasesh" , "ferruh.yigit@intel.com" , Dept-Eng DPDK Dev Thread-Topic: [PATCH 16/18] net/qede/base: add APIs for dscp priority map configuration Thread-Index: AQHUV8x2meBCeR8UEka8Vlb9yRPTmw== Date: Sat, 29 Sep 2018 08:14:37 +0000 Message-ID: <1538208822-9726-17-git-send-email-rasesh.mody@cavium.com> References: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> In-Reply-To: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR11CA0059.namprd11.prod.outlook.com (2603:10b6:a03:80::36) To BYAPR07MB5365.namprd07.prod.outlook.com (2603:10b6:a03:64::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [198.186.1.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB4806; 6:NDWLXavL2BuyOCjl2MaHnWkiN3+vjvJQ9Jypiq5Kp6spzpjaQKlAGerh+UTsXGTsK4zENnLgCddsK4calYC5gDtKm7OXYKyKyaqwcXO1EDCyxWkUnalExKDrt58fE0c+tIgLVC0jb+ASqDPrfTVZlH4Br1CTUTj853EfLXEXK9kYVSH9QgJHMbrXA4kuA9srt4GDmLYu4cvhMKWOJ/q9BCRVx3ZjmEp3pz9DzfPOMkxRVy6E5b3MaTvW0TGq9lFoKWTUie6ac68gq5nZYZ1sYs+yddzBz0tEeyaOyC5MiEpsATKvfXZQmkmjTrCgJNXIr1zYoloVm1sTuE+OzSWsLYKYpqt5KlOhVFEknRFWaDqRVvV8mw8+F0ruiigb9pmf8SgME9EEAaOzfcu/sKFZl6cLMaZfjB/RxWWhp+f2+Qxyxtga+jjS80KKbeb9hba4hPC+NS5AUGCbgXY2yZZ7HA==; 5:GRR4XptHgQGnzQUmD03T3eFCesSOTYTWNAS8wL0Fvjy4CarWUsXpUbWMVBJjREvyxgSM3R+afNDs/J7Wy0u74kPLFzg5WPM/ryMpWiPFE2KRKWbAVpxLc3aLCczHuRIVEPx/Uq/z2zcx0szghOmT0Euo2SXqE35mwH/zzKYlw2s=; 7:fZQMcbosgn0iuYkmsl0BJgSJGVyKvg7bcz4/9PhlHTij6nMwYvjll59VUHhPv1+AZKEVGLPYGDWGdzT3KjIcEt2h78UsS3idIoIblGuRpENNhAFYPRsg4dSFXZo8jOlYsKnmPQNPcoVQmzx+Im+0EhI+tS5PPb6/W1Ikj6CCRjSfbT5RcbxJMKVaBquHrtSZxa/0GdWjjR6MuJWYpNGQAtrw11w62rqDW1x8DycO86wXM5nQQ6Gzds0LaI1dlEGB x-ms-office365-filtering-correlation-id: 586f43b8-014e-4d2c-23d5-08d625e39826 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4806; x-ms-traffictypediagnostic: BYAPR07MB4806: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:BYAPR07MB4806; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4806; x-forefront-prvs: 0810818DA0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(366004)(136003)(39860400002)(199004)(189003)(26005)(4326008)(102836004)(14444005)(256004)(2616005)(66066001)(446003)(476003)(71190400001)(71200400001)(6116002)(11346002)(3846002)(316002)(5660300001)(36756003)(486006)(2906002)(107886003)(25786009)(8936002)(68736007)(6512007)(8676002)(106356001)(14454004)(5640700003)(81156014)(81166006)(105586002)(1730700003)(6436002)(6486002)(52116002)(76176011)(53936002)(72206003)(2351001)(7736002)(305945005)(478600001)(54906003)(6916009)(2501003)(186003)(575784001)(86362001)(6506007)(386003)(5250100002)(2900100001)(34290500001)(99286004)(97736004)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4806; H:BYAPR07MB5365.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: SxQ7+BEnD4FWPpG6/0OVI9n4Wg8CGLQDBSAI0H+d8LUH34rgft7ljNG3w2oHoX6BmeDYsy8Sc9NpKWewoA4KC6Holgw+O991YyYjk1gT+J+jxlpm5l3dFomV+BbJyeOjoxP1IUstyDGD0CCI5ZD4OaJEfEROrSj84HBkraYPLNgA2M7xFmJfm3VvTieLdTbozKQfM2/hFLi9pOyVfBHigdBmLShuzpnKLoABJcZsufoElbC5upkNjQdOD7rh9tBvmkxyMNaGWDYKRwgGHPVfikGLsPAwPcmYXY9p7Fmmu6nIyJv2jx/QNwGBExIvnmO/imWZ6KAUx1H//bkH4/ES6J1HDAEKOjSBsvyGEvyuszo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: 586f43b8-014e-4d2c-23d5-08d625e39826 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2018 08:14:38.0689 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4806 Subject: [dpdk-dev] [PATCH 16/18] net/qede/base: add APIs for dscp priority map configuration 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: Sat, 29 Sep 2018 08:14:41 -0000 Add APIs for dscp priority map configuration. APIs added are ecore_dcbx_get_dscp_priority(), ecore_dcbx_set_dscp_priority(). These base driver APIs can be used for dscp-map query/config. Configure the doorbell queue (DORQ) to use vlan-id/priority. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_dcbx.c | 85 +++++++++++++++++++++++++++-= ---- drivers/net/qede/base/ecore_dcbx_api.h | 10 ++++ drivers/net/qede/base/reg_addr.h | 1 + 3 files changed, 85 insertions(+), 11 deletions(-) diff --git a/drivers/net/qede/base/ecore_dcbx.c b/drivers/net/qede/base/eco= re_dcbx.c index 7668ad6..7981c42 100644 --- a/drivers/net/qede/base/ecore_dcbx.c +++ b/drivers/net/qede/base/ecore_dcbx.c @@ -129,7 +129,7 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) =20 static void ecore_dcbx_set_params(struct ecore_dcbx_results *p_data, - struct ecore_hwfn *p_hwfn, + struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, bool enable, u8 prio, u8 tc, enum dcbx_protocol_type type, enum ecore_pci_personality personality) @@ -154,12 +154,19 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwf= n, u8 pri) /* QM reconf data */ if (p_hwfn->hw_info.personality =3D=3D personality) p_hwfn->hw_info.offload_tc =3D tc; + + /* Configure dcbx vlan priority in doorbell block for roce EDPM */ + if (OSAL_TEST_BIT(ECORE_MF_UFP_SPECIFIC, &p_hwfn->p_dev->mf_bits) && + (type =3D=3D DCBX_PROTOCOL_ROCE)) { + ecore_wr(p_hwfn, p_ptt, DORQ_REG_TAG1_OVRD_MODE, 1); + ecore_wr(p_hwfn, p_ptt, DORQ_REG_PF_PCP_BB_K2, prio << 1); + } } =20 /* Update app protocol data and hw_info fields with the TLV info */ static void ecore_dcbx_update_app_info(struct ecore_dcbx_results *p_data, - struct ecore_hwfn *p_hwfn, + struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, bool enable, u8 prio, u8 tc, enum dcbx_protocol_type type) { @@ -175,7 +182,7 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) =20 personality =3D ecore_dcbx_app_update[i].personality; =20 - ecore_dcbx_set_params(p_data, p_hwfn, enable, + ecore_dcbx_set_params(p_data, p_hwfn, p_ptt, enable, prio, tc, type, personality); } } @@ -231,7 +238,7 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) * reconfiguring QM. Get protocol specific data for PF update ramrod comma= nd. */ static enum _ecore_status_t -ecore_dcbx_process_tlv(struct ecore_hwfn *p_hwfn, +ecore_dcbx_process_tlv(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct ecore_dcbx_results *p_data, struct dcbx_app_priority_entry *p_tbl, u32 pri_tc_tbl, int count, u8 dcbx_version) @@ -280,8 +287,8 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) enable =3D true; } =20 - ecore_dcbx_update_app_info(p_data, p_hwfn, enable, - priority, tc, type); + ecore_dcbx_update_app_info(p_data, p_hwfn, p_ptt, + enable, priority, tc, type); } } =20 @@ -302,8 +309,8 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) if (p_data->arr[type].update) continue; =20 - enable =3D (type =3D=3D DCBX_PROTOCOL_ETH) ? false : !!dcbx_version; - ecore_dcbx_update_app_info(p_data, p_hwfn, enable, + /* if no app tlv was present, don't override in FW */ + ecore_dcbx_update_app_info(p_data, p_hwfn, p_ptt, false, priority, tc, type); } =20 @@ -314,7 +321,7 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) * reconfiguring QM. Get protocol specific data for PF update ramrod comma= nd. */ static enum _ecore_status_t -ecore_dcbx_process_mib_info(struct ecore_hwfn *p_hwfn) +ecore_dcbx_process_mib_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p= _ptt) { struct dcbx_app_priority_feature *p_app; struct dcbx_app_priority_entry *p_tbl; @@ -338,7 +345,7 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) p_info =3D &p_hwfn->hw_info; num_entries =3D GET_MFW_FIELD(p_app->flags, DCBX_APP_NUM_ENTRIES); =20 - rc =3D ecore_dcbx_process_tlv(p_hwfn, &data, p_tbl, pri_tc_tbl, + rc =3D ecore_dcbx_process_tlv(p_hwfn, p_ptt, &data, p_tbl, pri_tc_tbl, num_entries, dcbx_version); if (rc !=3D ECORE_SUCCESS) return rc; @@ -879,7 +886,7 @@ enum _ecore_status_t if (type =3D=3D ECORE_DCBX_OPERATIONAL_MIB) { ecore_dcbx_get_dscp_params(p_hwfn, &p_hwfn->p_dcbx_info->get); =20 - rc =3D ecore_dcbx_process_mib_info(p_hwfn); + rc =3D ecore_dcbx_process_mib_info(p_hwfn, p_ptt); if (!rc) { /* reconfigure tcs of QM queues according * to negotiation results @@ -1540,3 +1547,59 @@ enum _ecore_status_t =20 return rc; } + +enum _ecore_status_t +ecore_dcbx_get_dscp_priority(struct ecore_hwfn *p_hwfn, + u8 dscp_index, u8 *p_dscp_pri) +{ + struct ecore_dcbx_get *p_dcbx_info; + enum _ecore_status_t rc; + + if (dscp_index >=3D ECORE_DCBX_DSCP_SIZE) { + DP_ERR(p_hwfn, "Invalid dscp index %d\n", dscp_index); + return ECORE_INVAL; + } + + p_dcbx_info =3D OSAL_ALLOC(p_hwfn->p_dev, GFP_KERNEL, + sizeof(*p_dcbx_info)); + if (!p_dcbx_info) + return ECORE_NOMEM; + + OSAL_MEMSET(p_dcbx_info, 0, sizeof(*p_dcbx_info)); + rc =3D ecore_dcbx_query_params(p_hwfn, p_dcbx_info, + ECORE_DCBX_OPERATIONAL_MIB); + if (rc) { + OSAL_FREE(p_hwfn->p_dev, p_dcbx_info); + return rc; + } + + *p_dscp_pri =3D p_dcbx_info->dscp.dscp_pri_map[dscp_index]; + OSAL_FREE(p_hwfn->p_dev, p_dcbx_info); + + return ECORE_SUCCESS; +} + +enum _ecore_status_t +ecore_dcbx_set_dscp_priority(struct ecore_hwfn *p_hwfn, struct ecore_ptt *= p_ptt, + u8 dscp_index, u8 pri_val) +{ + struct ecore_dcbx_set dcbx_set; + enum _ecore_status_t rc; + + if (dscp_index >=3D ECORE_DCBX_DSCP_SIZE || + pri_val >=3D ECORE_MAX_PFC_PRIORITIES) { + DP_ERR(p_hwfn, "Invalid dscp params: index =3D %d pri =3D %d\n", + dscp_index, pri_val); + return ECORE_INVAL; + } + + OSAL_MEMSET(&dcbx_set, 0, sizeof(dcbx_set)); + rc =3D ecore_dcbx_get_config_params(p_hwfn, &dcbx_set); + if (rc) + return rc; + + dcbx_set.override_flags =3D ECORE_DCBX_OVERRIDE_DSCP_CFG; + dcbx_set.dscp.dscp_pri_map[dscp_index] =3D pri_val; + + return ecore_dcbx_config_params(p_hwfn, p_ptt, &dcbx_set, 1); +} diff --git a/drivers/net/qede/base/ecore_dcbx_api.h b/drivers/net/qede/base= /ecore_dcbx_api.h index eaf8e08..6fad2ec 100644 --- a/drivers/net/qede/base/ecore_dcbx_api.h +++ b/drivers/net/qede/base/ecore_dcbx_api.h @@ -228,6 +228,16 @@ enum _ecore_status_t ecore_lldp_set_system_tlvs(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_= ptt, struct ecore_lldp_sys_tlvs *p_params); =20 +/* Returns priority value for a given dscp index */ +enum _ecore_status_t +ecore_dcbx_get_dscp_priority(struct ecore_hwfn *p_hwfn, + u8 dscp_index, u8 *p_dscp_pri); + +/* Sets priority value for a given dscp index */ +enum _ecore_status_t +ecore_dcbx_set_dscp_priority(struct ecore_hwfn *p_hwfn, struct ecore_ptt *= p_ptt, + u8 dscp_index, u8 pri_val); + static const struct ecore_dcbx_app_metadata ecore_dcbx_app_update[] =3D { {DCBX_PROTOCOL_ISCSI, "ISCSI", ECORE_PCI_ISCSI}, {DCBX_PROTOCOL_FCOE, "FCOE", ECORE_PCI_FCOE}, diff --git a/drivers/net/qede/base/reg_addr.h b/drivers/net/qede/base/reg_a= ddr.h index 612337f..be59f77 100644 --- a/drivers/net/qede/base/reg_addr.h +++ b/drivers/net/qede/base/reg_addr.h @@ -1233,6 +1233,7 @@ #define NIG_REG_LLH_FUNC_TAG_EN 0x5019b0UL #define NIG_REG_LLH_FUNC_TAG_VALUE 0x5019d0UL #define DORQ_REG_TAG1_OVRD_MODE 0x1008b4UL +#define DORQ_REG_PF_PCP_BB_K2 0x1008c4UL #define DORQ_REG_PF_EXT_VID_BB_K2 0x1008c8UL #define PRS_REG_SEARCH_NON_IP_AS_GFT 0x1f11c0UL #define NIG_REG_LLH_PPFID2PFID_TBL_0 0x501970UL --=20 1.7.10.3