{"id":2231240,"url":"http://patchwork.ozlabs.org/api/patches/2231240/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260430122602.126722-6-aleksandr.loktionov@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/projects/46/?format=json","name":"Intel Wired Ethernet development","link_name":"intel-wired-lan","list_id":"intel-wired-lan.osuosl.org","list_email":"intel-wired-lan@osuosl.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260430122602.126722-6-aleksandr.loktionov@intel.com>","list_archive_url":null,"date":"2026-04-30T12:26:02","name":"[5/5] ice: use element-by-element comparison for DCB config changes","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"ae417a1ac86875fe9a6fb55e7194e11c4df1861a","submitter":{"id":75597,"url":"http://patchwork.ozlabs.org/api/people/75597/?format=json","name":"Aleksandr Loktionov","email":"aleksandr.loktionov@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260430122602.126722-6-aleksandr.loktionov@intel.com/mbox/","series":[{"id":502294,"url":"http://patchwork.ozlabs.org/api/series/502294/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=502294","date":"2026-04-30T12:25:58","name":"ice: five small fixes and cleanups","version":1,"mbox":"http://patchwork.ozlabs.org/series/502294/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231240/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231240/checks/","tags":{},"related":[],"headers":{"Return-Path":"<intel-wired-lan-bounces@osuosl.org>","X-Original-To":["incoming@patchwork.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=Kp95tewM;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5tgv4GK0z1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 22:26:19 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 1EFD261C28;\n\tThu, 30 Apr 2026 12:26:15 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id ts6o3RkGK4qO; Thu, 30 Apr 2026 12:26:14 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 657F5617A0;\n\tThu, 30 Apr 2026 12:26:14 +0000 (UTC)","from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by lists1.osuosl.org (Postfix) with ESMTP id 7C12E18F\n for <intel-wired-lan@lists.osuosl.org>; Thu, 30 Apr 2026 12:26:13 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id 626264073C\n for <intel-wired-lan@lists.osuosl.org>; Thu, 30 Apr 2026 12:26:13 +0000 (UTC)","from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id CEcdafi22ykt for <intel-wired-lan@lists.osuosl.org>;\n Thu, 30 Apr 2026 12:26:12 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.16])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 6D6FE403D6\n for <intel-wired-lan@lists.osuosl.org>; Thu, 30 Apr 2026 12:26:12 +0000 (UTC)","from orviesa006.jf.intel.com ([10.64.159.146])\n by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 30 Apr 2026 05:26:12 -0700","from amlin-019-225.igk.intel.com ([10.102.19.225])\n by orviesa006.jf.intel.com with ESMTP; 30 Apr 2026 05:26:11 -0700"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp3.osuosl.org 657F5617A0","OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6D6FE403D6"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1777551974;\n\tbh=jNGxF2l+R9CnVMp6l4YalRL/JZPvQonlHrBei6o9HUg=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=Kp95tewM1SUvLk0PIYkhUrziHtdZbixaw+egNku1OMXcAnsM1Gs0JkymNEASy3fDf\n\t KFAJhyzINXyFzWp9kN53LFVa8VGeLp/n/2h6XjS42XMLaBgDQ3aictOwMGeGX2k4JK\n\t OhwTwK5oNWNqmTHuqxNnvDzdqbxOBuIPeTfMGeiTdU6sx5Izn5IX3QhvkndK1jU23e\n\t UVMGcXN95VZeVZgvpSdwDxrEMbEdKfUdmxbRnE/NnnAxKQJc3GOfXnTsaMssSHDHcY\n\t Y0zkiDg3Mv6Oh3tSlbB+7MZe++TAQ0N9P6SjRg/q0NTYwvgEVmZOVkHmcBVs6/Ewsk\n\t VnPlHUuR7XZ/w==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.16;\n helo=mgamail.intel.com; envelope-from=aleksandr.loktionov@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp2.osuosl.org 6D6FE403D6","X-CSE-ConnectionGUID":["puUSZFeZQOWWbTYSRXoIRw==","W7cWY3E6TSePxZt18iY4cQ=="],"X-CSE-MsgGUID":["6UQD1SonR1ybEWSq1SKa5Q==","tNm2NjxQQ021EbHCdHcCkg=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11771\"; a=\"78689196\"","E=Sophos;i=\"6.23,208,1770624000\"; d=\"scan'208\";a=\"78689196\"","E=Sophos;i=\"6.23,208,1770624000\"; d=\"scan'208\";a=\"233538439\""],"X-ExtLoop1":"1","From":"Aleksandr Loktionov <aleksandr.loktionov@intel.com>","To":"intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,\n aleksandr.loktionov@intel.com","Cc":"netdev@vger.kernel.org","Date":"Thu, 30 Apr 2026 14:26:02 +0200","Message-ID":"<20260430122602.126722-6-aleksandr.loktionov@intel.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260430122602.126722-1-aleksandr.loktionov@intel.com>","References":"<20260430122602.126722-1-aleksandr.loktionov@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1777551972; x=1809087972;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=yPN+lmUC+V9SjMLQPhkRnt+TgdSTwYMAW5C7MIsny0I=;\n b=MJpume7lGMpHRDqaGA+vIeoYA0+ITGcGAlUhCmbv9pnE7qY0ZadmwskH\n tNPaGigR5kkMkzF1xSa4wHdlraOSxT/j509G39OcEhUBGBPJ4eHiHJ6N9\n uREdvrZrsgWn2fN8HzINQZbgQ00stBEXblWN7sjJ9cTpQNG+2EZEt+Rxo\n 7BbLsC/uNEBohIk2+3samK6GNW/2hy3nSQqoTlXyzOFVE4VKiCcPtNDPM\n fSu2gf20uQ8GozYMNt8I+UBdk0lrHPF/7uTCWv2AYrHlwVWkZA/I4Zeub\n 2BnOqoSLT0j6uPmeRxt/3f5oaKipwDSU5TnTHCfCuU6qJBuvBfzczPriK\n Q==;","X-Mailman-Original-Authentication-Results":["smtp2.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp2.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=MJpume7l"],"Subject":"[Intel-wired-lan] [PATCH 5/5] ice: use element-by-element\n comparison for DCB config changes","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>","List-Archive":"<http://lists.osuosl.org/pipermail/intel-wired-lan/>","List-Post":"<mailto:intel-wired-lan@osuosl.org>","List-Help":"<mailto:intel-wired-lan-request@osuosl.org?subject=help>","List-Subscribe":"<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"Comparing two ice_dcbx_cfg structs with memcmp() is unreliable on\nnon-packed structs due to uninitialised padding bytes.  The HW DCB\npath already has ice_dcb_need_recfg() that compares fields\nindividually; export it and use it in the SW DCB netlink setters\n(setets, setpfc, setapp, cee_set_all) instead of the unsafe memcmp.\n\nRemove the now-redundant memcmp check from ice_pf_dcb_cfg() so that\nfunction always attempts the HW reconfiguration when called.\n\nSigned-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 13 ++-------\n drivers/net/ethernet/intel/ice/ice_dcb_lib.h |  2 ++\n drivers/net/ethernet/intel/ice/ice_dcb_nl.c  | 30 ++++++++++++++++++--\n 3 files changed, 32 insertions(+), 13 deletions(-)","diff":"diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\nindex bd77f1c..2e85fae 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -353,15 +353,11 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)\n \tstruct ice_dcbx_cfg *old_cfg, *curr_cfg;\n \tstruct device *dev = ice_pf_to_dev(pf);\n \tstruct iidc_rdma_event *event;\n-\tint ret = ICE_DCB_NO_HW_CHG;\n \tstruct ice_vsi *pf_vsi;\n+\tint ret;\n \n \tcurr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;\n \n-\t/* FW does not care if change happened */\n-\tif (!pf->hw.port_info->qos_cfg.is_sw_lldp)\n-\t\tret = ICE_DCB_HW_CHG_RST;\n-\n \t/* Enable DCB tagging only when more than one TC */\n \tif (ice_dcb_get_num_tc(new_cfg) > 1) {\n \t\tdev_dbg(dev, \"DCB tagging enabled (num TC > 1)\\n\");\n@@ -377,11 +373,6 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)\n \t\tclear_bit(ICE_FLAG_DCB_ENA, pf->flags);\n \t}\n \n-\tif (!memcmp(new_cfg, curr_cfg, sizeof(*new_cfg))) {\n-\t\tdev_dbg(dev, \"No change in DCB config required\\n\");\n-\t\treturn ret;\n-\t}\n-\n \tif (ice_dcb_bwchk(pf, new_cfg))\n \t\treturn -EINVAL;\n \n@@ -481,7 +472,7 @@ static void ice_cfg_etsrec_defaults(struct ice_port_info *pi)\n  * @old_cfg: current DCB config\n  * @new_cfg: new DCB config\n  */\n-static bool\n+bool\n ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg,\n \t\t   struct ice_dcbx_cfg *new_cfg)\n {\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\nindex da9ba81..a7eaa2f9 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n@@ -20,6 +20,8 @@ u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);\n void ice_vsi_set_dcb_tc_cfg(struct ice_vsi *vsi);\n bool ice_is_pfc_causing_hung_q(struct ice_pf *pf, unsigned int txqueue);\n u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index);\n+bool ice_dcb_need_recfg(struct ice_pf *pf, struct ice_dcbx_cfg *old_cfg,\n+\t\t\tstruct ice_dcbx_cfg *new_cfg);\n int\n ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked);\n int ice_dcb_bwchk(struct ice_pf *pf, struct ice_dcbx_cfg *dcbcfg);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c\nindex a10c1c8d..13a52c1 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c\n@@ -108,11 +108,17 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)\n \tif (!bwrec)\n \t\tnew_cfg->etsrec.tcbwtable[0] = 100;\n \n+\tif (!ice_dcb_need_recfg(pf, &pf->hw.port_info->qos_cfg.local_dcbx_cfg,\n+\t\t\t\tnew_cfg)) {\n+\t\terr = ICE_DCB_NO_HW_CHG;\n+\t\tgoto ets_out;\n+\t}\n+\n \terr = ice_pf_dcb_cfg(pf, new_cfg, true);\n \t/* return of zero indicates new cfg applied */\n-\tif (err == ICE_DCB_HW_CHG_RST)\n+\tif (!err)\n \t\tice_dcbnl_devreset(netdev);\n-\tif (err == ICE_DCB_NO_HW_CHG)\n+\telse if (err == ICE_DCB_NO_HW_CHG)\n \t\terr = ICE_DCB_HW_CHG_RST;\n \n ets_out:\n@@ -287,11 +293,18 @@ static int ice_dcbnl_setpfc(struct net_device *netdev, struct ieee_pfc *pfc)\n \n \tnew_cfg->pfc.pfcena = pfc->pfc_en;\n \n+\tif (!ice_dcb_need_recfg(pf, &pf->hw.port_info->qos_cfg.local_dcbx_cfg,\n+\t\t\t\tnew_cfg)) {\n+\t\terr = ICE_DCB_NO_HW_CHG;\n+\t\tgoto pfc_out;\n+\t}\n+\n \terr = ice_pf_dcb_cfg(pf, new_cfg, true);\n \tif (err == ICE_DCB_HW_CHG_RST)\n \t\tice_dcbnl_devreset(netdev);\n \tif (err == ICE_DCB_NO_HW_CHG)\n \t\terr = ICE_DCB_HW_CHG_RST;\n+pfc_out:\n \tmutex_unlock(&pf->tc_mutex);\n \treturn err;\n }\n@@ -845,6 +858,12 @@ static int ice_dcbnl_setapp(struct net_device *netdev, struct dcb_app *app)\n \tnew_cfg->dscp_map[app->protocol] = app->priority;\n \tnew_cfg->app[new_cfg->numapps++] = new_app;\n \n+\tif (!ice_dcb_need_recfg(pf, &pf->hw.port_info->qos_cfg.local_dcbx_cfg,\n+\t\t\t\tnew_cfg)) {\n+\t\tret = ICE_DCB_NO_HW_CHG;\n+\t\tgoto setapp_out;\n+\t}\n+\n \tret = ice_pf_dcb_cfg(pf, new_cfg, true);\n \t/* return of zero indicates new cfg applied */\n \tif (ret == ICE_DCB_HW_CHG_RST)\n@@ -991,8 +1010,15 @@ static u8 ice_dcbnl_cee_set_all(struct net_device *netdev)\n \n \tmutex_lock(&pf->tc_mutex);\n \n+\tif (!ice_dcb_need_recfg(pf, &pf->hw.port_info->qos_cfg.local_dcbx_cfg,\n+\t\t\t\tnew_cfg)) {\n+\t\terr = ICE_DCB_NO_HW_CHG;\n+\t\tgoto out;\n+\t}\n+\n \terr = ice_pf_dcb_cfg(pf, new_cfg, true);\n \n+out:\n \tmutex_unlock(&pf->tc_mutex);\n \treturn (err != ICE_DCB_HW_CHG_RST) ? ICE_DCB_NO_HW_CHG : err;\n }\n","prefixes":["5/5"]}