From patchwork Mon Jul 20 18:08:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 11674407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F692618 for ; Mon, 20 Jul 2020 18:09:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07D4C22BF5 for ; Mon, 20 Jul 2020 18:09:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=marvell.com header.i=@marvell.com header.b="eAWLYzB2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730698AbgGTSJA (ORCPT ); Mon, 20 Jul 2020 14:09:00 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:14000 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729029AbgGTSI7 (ORCPT ); Mon, 20 Jul 2020 14:08:59 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06KHtqI6024225; Mon, 20 Jul 2020 11:08:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=DFDzUdDk0aHOGhfw7QO/TyfMEtyrZJIH/S5p8+Dvbk0=; b=eAWLYzB2UAMtOQuwgSwVit4okAEONym4Z/oSCdhhwFwE96APwSxKE6fQjNBO8bEv8fQT tPFdNfW7BXJnB+T7GTmtGEkUdNWWR1+cuedY9NSW4xYE57CboTtc5XSbn+4jvOkgiv9F vPG4BttBA+6RGJHxrEAThdsD4cAkj05FT0rlP4qEzHblVL4v7htMNmstVyuMmskP7GIe yc5q4FusN7by2zgKpUamdl3ftYfB+FY/uMSRa7Mv04131YffpWaaIJmoyCMvofhHFRtn h3OrOMPwXfvK/solMH+QtdwHCdo5IAcskFa6vP/cgWmRNWC7HH0fnD5LdpK+3UwZ56q5 cg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 32c0kkf8u4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2020 11:08:53 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 20 Jul 2020 11:08:51 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 20 Jul 2020 11:08:51 -0700 Received: from NN-LT0049.marvell.com (NN-LT0049.marvell.com [10.193.54.6]) by maili.marvell.com (Postfix) with ESMTP id 53F343F7043; Mon, 20 Jul 2020 11:08:47 -0700 (PDT) From: Alexander Lobakin To: "David S. Miller" , Jakub Kicinski CC: Alexander Lobakin , Igor Russkikh , Michal Kalderon , "Ariel Elior" , Denis Bolotin , "James E.J. Bottomley" , "Martin K. Petersen" , Andrew Lunn , , , , , Subject: [PATCH v3 net-next 01/16] linkmode: introduce linkmode_intersects() Date: Mon, 20 Jul 2020 21:08:00 +0300 Message-ID: <20200720180815.107-2-alobakin@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200720180815.107-1-alobakin@marvell.com> References: <20200720180815.107-1-alobakin@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-20_09:2020-07-20,2020-07-20 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add a new helper to find intersections between Ethtool link modes, linkmode_intersects(), similar to the other linkmode helpers. Signed-off-by: Alexander Lobakin Signed-off-by: Igor Russkikh Reviewed-by: Andrew Lunn --- include/linux/linkmode.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h index c664c27a29a0..f8397f300fcd 100644 --- a/include/linux/linkmode.h +++ b/include/linux/linkmode.h @@ -82,6 +82,12 @@ static inline int linkmode_equal(const unsigned long *src1, return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); } +static inline int linkmode_intersects(const unsigned long *src1, + const unsigned long *src2) +{ + return bitmap_intersects(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); +} + static inline int linkmode_subset(const unsigned long *src1, const unsigned long *src2) {