Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp353300yba; Wed, 24 Apr 2019 02:20:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAT/X8v61Jsw5hBQXZyHj+XFqDrL2lC5IygG0LqaLV2PH9D1SpAuo18fDPYAiAgJf4CZLp X-Received: by 2002:a63:d713:: with SMTP id d19mr29974878pgg.145.1556097612547; Wed, 24 Apr 2019 02:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556097612; cv=none; d=google.com; s=arc-20160816; b=DYyFBlabJDBFaX0p282y1j6DCNk1ClphE63lXyzsKmrwe1Prbn9Z7bsTqdk0W5gz8q liVvZpM73sLSbxmpE7iMmSgGNkurChve0YSux9Lt2hlD2XvtvtqL3wKm418kqaw/H9Xj 2rza6bt/0HnEbb4J2TYNsSAU1ant4zeNlEeZ2ioHAkpHPUYHzls1IZpS05m4RQvGP2hX UX/EGvJzP2A7489Os8tTdZc9BYSQiIWkVdOx7WhZWU1aFpvVC2oC0UZ7d4K+CPt1Ob0A R/Iw7AXeb+eALmDmtb2BnhHqUgH4q8KmXxvWjiZhwOSstv80DAF8crshAFKu7iXxGCgh aWJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject :smtp-origin-cluster:cc:to:smtp-origin-hostname:from :smtp-origin-hostprefix:dkim-signature; bh=Wjeih4drKxvCXgraFNPv3LrPtimhzFKHZMw/UQDDo9g=; b=acCcPqK2UV8vaIhDRBNmHTZwbvKIfot47aI0XslZ+7Qh/sxJK7ZdTtqkEq1JfuLaf+ DIvcuQLYnAzL/mpvC4xmgThmkayPbMuOBZOJlojqiq26fmG4nw6mXgH9VxeR6cNifisO wsO6EYGaQ78T10UzhyDW06foDTyIqPJ0G8j7jeE3SN31QkZWyxVtjqDuPo4SNWuYa5J+ uPLrP1ZkcxJSKTNR/J8HHrnlr+9H9dsZSkhYFXMtNx94TZF7sgUKi2G1zTn30bdKh4Tf dasxVW4Dk5A4du+gV4w9gvubIrEVss0SsgbymUnZrjXd4VI1GnE4JUJtSJHfn2psXqbo CReQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=MogJTY+s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 134si17641353pga.249.2019.04.24.02.19.57; Wed, 24 Apr 2019 02:20:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=MogJTY+s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729609AbfDXJRR (ORCPT + 99 others); Wed, 24 Apr 2019 05:17:17 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:49032 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728520AbfDXJQi (ORCPT ); Wed, 24 Apr 2019 05:16:38 -0400 Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3O9AKK1018404 for ; Wed, 24 Apr 2019 02:16:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=Wjeih4drKxvCXgraFNPv3LrPtimhzFKHZMw/UQDDo9g=; b=MogJTY+sxUi5Eixza1waPiWVNAgY9W50Ipk5t5x/0D1m7928+J0c4v6PCyYagX+WePbL rdORfdLL/dJAEVt2nqeQAmDpX4RgW9Uz0wOjuHcrvGxYHlN44ALd1ZWqKXZedmqkGyGR SEWTbVP0TvEVw4VHrdzn5ohFgcud6gEOfWw= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2s2k8f8emq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 24 Apr 2019 02:16:36 -0700 Received: from mx-out.facebook.com (2620:10d:c0a1:3::13) by mail.thefacebook.com (2620:10d:c021:18::176) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5; Wed, 24 Apr 2019 02:16:35 -0700 Received: by devvm24792.prn1.facebook.com (Postfix, from userid 150176) id AAAE013BA5DD3; Tue, 23 Apr 2019 14:20:38 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Tao Ren Smtp-Origin-Hostname: devvm24792.prn1.facebook.com To: "David S . Miller" , Maxim Mikityanskiy , Bartosz Golaszewski , , , Jakub Kicinski , Samuel Mendoza-Jonas , Joel Stanley , Andrew Jeffery , CC: Tao Ren Smtp-Origin-Cluster: prn1c35 Subject: [PATCH net 1/2] net: add eth_addr_inc in etherdevice.h Date: Tue, 23 Apr 2019 14:20:37 -0700 Message-ID: <20190423212037.1983760-1-taoren@fb.com> X-Mailer: git-send-email 2.17.1 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-24_07:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add eth_addr_inc function in etherdevice.h to increment MAC address. One of the use cases is in ncsi stack, where the host's MAC address needs to be incremented to get BMC's MAC address. Signed-off-by: Tao Ren --- include/linux/etherdevice.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index e2f3b21cd72a..d48e3a724c54 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -448,6 +448,19 @@ static inline void eth_addr_dec(u8 *addr) u64_to_ether_addr(u, addr); } +/** + * eth_addr_inc - Increment the given MAC address + * + * @addr: Pointer to a six-byte array containing Ethernet address to increment + */ +static inline void eth_addr_inc(u8 *addr) +{ + u64 u = ether_addr_to_u64(addr); + + u++; + u64_to_ether_addr(u, addr); +} + /** * is_etherdev_addr - Tell if given Ethernet address belongs to the device. * @dev: Pointer to a device structure -- 2.17.1