From patchwork Thu Jan 11 15:03:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Malz X-Patchwork-Id: 1885655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T9ny50f2Rz1yPm for ; Fri, 12 Jan 2024 02:04:29 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rNwbB-0002Ec-DF; Thu, 11 Jan 2024 15:04:13 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rNwac-0002CL-E4 for kernel-team@lists.ubuntu.com; Thu, 11 Jan 2024 15:03:26 +0000 Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 17CBB3F286 for ; Thu, 11 Jan 2024 15:03:26 +0000 (UTC) Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-50e81d186e2so5487835e87.0 for ; Thu, 11 Jan 2024 07:03:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704985404; x=1705590204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=esarWvsDj5LOM3kQ0m+k3G1XC/hi4tUbGxf84zJYUzc=; b=HbYEKlPWG+rJdjejOiT+frvUt6WpOxl3XQjOYLDnh6Ce4Y361Zo8QwodkAksDxospD N54JD9SdkhzK2fIzs9Tx5P8/bdbNevEG0oG02dbMCA5cPg1p79LQNN0pEtrhlvM72mPN ln97ual6Mll5pgxzKClOC6kZXuwmbUpnmVFHPWlTerb1qLhuQV9JPMLMEVhyriIZfiGx Tmq3VjbnaQbIAwBS1kQokC2JTULp1t07kaF+dgrGdMhlqkU5ILG00lmaylBSU50ZNHhU wM1lPUGquA+Q25obhZRG8tbQHK9YL1OYTKJSqmAH7pQINQ2HcvTeX0QCLPbKTfC+GQ6p JGrw== X-Gm-Message-State: AOJu0YxBtfEi+o0v6Z/gmxbPjPWjndwdJv/29hjxXkkfKgX6PMF2mSEH Zf/lHKuMh0AGlaAVt5INro4tNN+4qaOduFWzDEWUIosmxhKQDxEHyhrkd5DGCHtHrIcs+yH1FMk 4eSVpQBPb/DYYgYatXOeBRTJPC3hjNgOpAtRgQiO+CckMlEAcixZXhdLX X-Received: by 2002:ac2:4e52:0:b0:50e:74f0:810e with SMTP id f18-20020ac24e52000000b0050e74f0810emr699554lfr.137.1704985403900; Thu, 11 Jan 2024 07:03:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHF/vAYM0F283nc+RNoQqQrRiE+boIjKSm9uEApkUBDQVO3fhpWuBp8LH5yzduBPVS8R80fSQ== X-Received: by 2002:ac2:4e52:0:b0:50e:74f0:810e with SMTP id f18-20020ac24e52000000b0050e74f0810emr699548lfr.137.1704985403594; Thu, 11 Jan 2024 07:03:23 -0800 (PST) Received: from rmalz.. (89-64-27-150.dynamic.chello.pl. [89.64.27.150]) by smtp.gmail.com with ESMTPSA id t14-20020ac243ae000000b0050e3b654751sm211329lfl.199.2024.01.11.07.03.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 07:03:23 -0800 (PST) From: Robert Malz To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 1/3][SRU][J] ice: Add feature bitmap, helpers and a check for DSCP Date: Thu, 11 Jan 2024 16:03:19 +0100 Message-Id: <20240111150321.760930-2-robert.malz@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240111150321.760930-1-robert.malz@canonical.com> References: <20240111150321.760930-1-robert.malz@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Anirudh Venkataramanan BugLink: https://bugs.launchpad.net/bugs/2036239 DSCP a.k.a L3 QoS is only supported on certain devices. To enforce this, this patch introduces a bitmap of features and helper functions. The feature bitmap is set based on device IDs on driver init. Currently, DSCP is the only feature in this bitmap, but there will be more in the future. In the DCB netlink flow, check if the feature bit is set before exercising DSCP. Signed-off-by: Anirudh Venkataramanan Tested-by: Gurucharan G Signed-off-by: Tony Nguyen (backported from commit 40b247608bc50b5c046dfb1073c0ee7f57769c86) [rmalz: backported feature bitmap implementation, ignored check for DSCP] Signed-off-by: Robert Malz --- drivers/net/ethernet/intel/ice/ice.h | 6 +++ drivers/net/ethernet/intel/ice/ice_lib.c | 47 +++++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_lib.h | 2 + drivers/net/ethernet/intel/ice/ice_main.c | 2 + 4 files changed, 57 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index 43fe91213aa5..d08b0d3479b8 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -155,6 +155,11 @@ #define ice_pf_to_dev(pf) (&((pf)->pdev->dev)) +enum ice_feature { + ICE_F_DSCP, + ICE_F_MAX +}; + struct ice_txq_meta { u32 q_teid; /* Tx-scheduler element identifier */ u16 q_id; /* Entry in VSI's txq_map bitmap */ @@ -442,6 +447,7 @@ struct ice_pf { /* used to ratelimit the MDD event logging */ unsigned long last_printed_mdd_jiffies; DECLARE_BITMAP(malvfs, ICE_MAX_VF_COUNT); + DECLARE_BITMAP(features, ICE_F_MAX); DECLARE_BITMAP(state, ICE_STATE_NBITS); DECLARE_BITMAP(flags, ICE_PF_FLAGS_NBITS); unsigned long *avail_txqs; /* bitmap to track PF Tx queue usage */ diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 4417238b0e64..f2addcb4c6cc 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -3597,3 +3597,50 @@ int ice_set_link(struct ice_vsi *vsi, bool ena) return 0; } + +/** + * ice_is_feature_supported + * @pf: pointer to the struct ice_pf instance + * @f: feature enum to be checked + * + * returns true if feature is supported, false otherwise + */ +bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f) +{ + if (f < 0 || f >= ICE_F_MAX) + return false; + + return test_bit(f, pf->features); +} + +/** + * ice_set_feature_support + * @pf: pointer to the struct ice_pf instance + * @f: feature enum to set + */ +static void ice_set_feature_support(struct ice_pf *pf, enum ice_feature f) +{ + if (f < 0 || f >= ICE_F_MAX) + return; + + set_bit(f, pf->features); +} + +/** + * ice_init_feature_support + * @pf: pointer to the struct ice_pf instance + * + * called during init to setup supported feature + */ +void ice_init_feature_support(struct ice_pf *pf) +{ + switch (pf->hw.device_id) { + case ICE_DEV_ID_E810C_BACKPLANE: + case ICE_DEV_ID_E810C_QSFP: + case ICE_DEV_ID_E810C_SFP: + ice_set_feature_support(pf, ICE_F_DSCP); + break; + default: + break; + } +} diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h index d5a28bf0fc2c..4512c8513178 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_lib.h @@ -116,4 +116,6 @@ bool ice_is_vsi_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi); int ice_set_dflt_vsi(struct ice_sw *sw, struct ice_vsi *vsi); int ice_clear_dflt_vsi(struct ice_sw *sw); +bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f); +void ice_init_feature_support(struct ice_pf *pf); #endif /* !_ICE_LIB_H_ */ diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 15dc29a7a52c..3c671a03889c 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4346,6 +4346,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) goto err_exit_unroll; } + ice_init_feature_support(pf); + ice_request_fw(pf); /* if ice_request_fw fails, ICE_FLAG_ADV_FEATURES bit won't be