Message ID | 20230206102759.669838-9-srinivas.kandagatla@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2158775wrn; Mon, 6 Feb 2023 02:34:21 -0800 (PST) X-Google-Smtp-Source: AK7set+QgEZxSxz47G2nrm38xlMX+hjwxXp9jVUIEh8b3uYJx4d2tEFJguiz8xH7KvdRKvHp1Dtb X-Received: by 2002:a05:6402:181:b0:4a2:6660:8fbc with SMTP id r1-20020a056402018100b004a266608fbcmr19435000edv.40.1675679661401; Mon, 06 Feb 2023 02:34:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675679661; cv=none; d=google.com; s=arc-20160816; b=b9aFLpJ8LmPRJ1NtnxiElPa44OvuhRFuW6rkV8JB0/7vwEIWSnTt4gpOih67zjgMf3 0Z/yUgnnY1jRX/GFHvpkwZMpye3xZ1agwswHLjTrae0xtu5rM9737SEQNrImCt9hwG8q /goHlePP2ryfYY36qKgIaDzOZCby48k2dbroie33YLbyW/NSZzpIXEaYskVECdqLgqzr /pTMUb71Wf9EA3wuH0T0b/yxPbaDcBWS4OV9IeKE4R4jJVtNPeFQJCHv6woBocWAQriD Jd+LyiAS252cr5ufLI1PBuglRZ5MUQ0PVonOtzQ5bZq6I9NF6T0xVGqPo8ZMm61fijpe 3Fug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y+cl5Ym56wJ7OQnEfR1Yodsc3crTZ07l528z+P6rSd8=; b=i/IJEfGhhJxsZRzVGozeBaIxRXQrKLsE48wwUG5Kqebs4Ioz/v5UgXBJw9bpQxewkr BM3oChLyxAzAWIZJz7pyzJAITav2k6D+WQKBazStX9hsZ3Dc14v/ROVcNTWp1YFqhEWq QnbkW/UQDo2LsX3lHEVH5VbP8sOOegwDwd1ahZ4LHms/1Szqw8xTCd0MdyVhYyIRhlBM 27kwwSsU5CZnLX8JjMG68CI27T9/lgUIMEpWDIHuBK7aPVKUs2CDy/G8ZDl+GlFpYpo1 Ba0K+BPAWHcCSDKfM+MqU2q+SGJvigZSFdmjOXURpCOTDELJtE9Agwu9VGckH4v2Vjs6 0IcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rYAmi04i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 28-20020a170906011c00b0087976827fb5si14974184eje.778.2023.02.06.02.33.58; Mon, 06 Feb 2023 02:34:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rYAmi04i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230491AbjBFK2n (ORCPT <rfc822;kmanaouilinux@gmail.com> + 99 others); Mon, 6 Feb 2023 05:28:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbjBFK20 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Feb 2023 05:28:26 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8AC21EBC8 for <linux-kernel@vger.kernel.org>; Mon, 6 Feb 2023 02:28:24 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so8371184wms.1 for <linux-kernel@vger.kernel.org>; Mon, 06 Feb 2023 02:28:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y+cl5Ym56wJ7OQnEfR1Yodsc3crTZ07l528z+P6rSd8=; b=rYAmi04ikihq2pYTYtal+Kbg/qcy9Xlw1eH5vh8/eoAQqryD3KK82Rqdcvb5XbfqEF TUJ8i5DPNRoKCym4B9NeR8i1vkLlYC4Bl506EyJDhyGJBNE7SjChymjYlN5Xc+treSh1 nncFp4RbeihZ4Idxf2RzQ/NwRM0CWRAwYwKWasbF08SuW0Ya4/WuQ6r2fBjURHDZo1nC M3wCa1Xk8SJjjWA7CN2DFBmZmofwaXZ9o7VJ19rRdpxEdro3Bz2idQajuDHntgtCIMIp Ivz0DJFInnUDz5vQHoIueDWo/kJA5dVhtZC0ABYKEXzdBDTl82StvyHG19hn4eH9tU3W 2BQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y+cl5Ym56wJ7OQnEfR1Yodsc3crTZ07l528z+P6rSd8=; b=TvxYASKSBfdrSd5GM4pIlagx0U1UoHZ6R78qPDCuNLG4iCu14bS8yoIFnsmO99XOjc +PACt0LRuWBFSZCskYnrTSl7TpypWlZPlDUjwnNhH+80PyXaoKprtmU76qkMqaEsBQZF pGq+PLS84QcEOsSn1QO+s7ChJeI41jvr60yxkcpcjXFaw7DpdmRyWx0Y3RBGTHzVO2cp zMNuRbC8CALibldhLkkO8trC7iRQ3Cxlvaj7XBAiPU1/V15roRGzPIulmERnJnLMVum3 jrwSqbtKEwucck8zKW87avzJG+VbRFtXL+zVXZaL59yCWrMdBd4EaGXl34svUs0zp2lc T72Q== X-Gm-Message-State: AO0yUKU0oAtj8n2Z/sKqh1lKI+fSU/r08jFpWNJfwtoXk8Retu1TBYlb N3Lh6EUWr7eB7ds1fCZt3qNQyw== X-Received: by 2002:a05:600c:3110:b0:3df:ee64:4814 with SMTP id g16-20020a05600c311000b003dfee644814mr9845095wmo.20.1675679303345; Mon, 06 Feb 2023 02:28:23 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id g10-20020a05600c310a00b003de77597f16sm11002446wmo.21.2023.02.06.02.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 02:28:22 -0800 (PST) From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Michael Walle <michael@walle.cc>, Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Subject: [RESEND PATCH 08/37] net: add helper eth_addr_add() Date: Mon, 6 Feb 2023 10:27:30 +0000 Message-Id: <20230206102759.669838-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206102759.669838-1-srinivas.kandagatla@linaro.org> References: <20230206102759.669838-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757077476785770837?= X-GMAIL-MSGID: =?utf-8?q?1757077476785770837?= |
Series |
nvmem: patches for 6.3
|
|
Commit Message
Srinivas Kandagatla
Feb. 6, 2023, 10:27 a.m. UTC
From: Michael Walle <michael@walle.cc> Add a helper to add an offset to a ethernet address. This comes in handy if you have a base ethernet address for multiple interfaces. Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- include/linux/etherdevice.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index a541f0c4f146..224645f17c33 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -507,6 +507,20 @@ static inline void eth_addr_inc(u8 *addr) u64_to_ether_addr(u, addr); } +/** + * eth_addr_add() - Add (or subtract) an offset to/from the given MAC address. + * + * @offset: Offset to add. + * @addr: Pointer to a six-byte array containing Ethernet address to increment. + */ +static inline void eth_addr_add(u8 *addr, long offset) +{ + u64 u = ether_addr_to_u64(addr); + + u += offset; + u64_to_ether_addr(u, addr); +} + /** * is_etherdev_addr - Tell if given Ethernet address belongs to the device. * @dev: Pointer to a device structure