From nobody Mon Jan 09 20:55:03 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NrR601620z2qmk2; Mon, 9 Jan 2023 20:55:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NrR5z631tz4bjd; Mon, 9 Jan 2023 20:55:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673297703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AjgsVPcHJv/j/dI/onkL7mkzQuBDKslM/Fv+fcqU9uk=; b=xgkYcumo1fdVWykzjaErCkY0lzFRN0g991nwo89vXnqf9Gj3jFCLi54hmBLxmh6Pls5UPT ZqAt5t6Nw05N4jttu8S7LvgcznUx5imYxRGqqqzsdlKgR/LsX8jr6JGjcWygxC5c95c/yz GbHnvpUQgcb2tP2hqbpqB/koSamEscb+wRqpCVCVsV4xdB5z77YsJl1czpDhZ9wCegn7JC 5MUOvkmYeTPElll0urpXSvnr3upZoX1ZVvzvsktv6h9bJTdvgDZqMDSm92lal4QvaJjzdb rmOKjljJEL8QEWkZDH1qVpNb6IvX0+b6refumVShf9ogRReFWpdcvNux9YB60A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673297703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AjgsVPcHJv/j/dI/onkL7mkzQuBDKslM/Fv+fcqU9uk=; b=azNKRh6HsEI/xtAVPxn4Zu8Q0dJ675foWGRNm1vwhfFmJPUrhSVD6osOMYgxpi+pckuQec N6f4rqjx7N0XkwQsK5VbfniPGtvnb4O/WB6U3X3iGEiwKBce/K57E159ecySv9crvR5vnn qCBOQwvo+K5ueFnP0hwCZvSe5EGBOKwelT0PDrW+MO1uf49ruNSAgfcfXGtxwklzjJRe2Y VAoTsUL3N6SgJcMuHkN53/fFW0Q5A7p9MLfW3uufLs9DYRhtw5XOMlC68OIxVwU9VeCgrO 6tm78o4VjxzdWqe9/eWj1eK2hhpk8g6TlEy2DYx6XlCYVg2KkJyJ9FbGDKENjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673297703; a=rsa-sha256; cv=none; b=hXwf3AVx0hX+VBoRkIcnnD7bZqqpO9HnPD379KEAWuOwCeVvB5/BZTGl/D1lRWunE5gASn NxipRaGn4tR9O5wbTmTN1P5loYeUZNQJFaVKzIUSaPwyPzKVyVARoMRzseEipLTPyzsN7m fYM3wmOKqvLAtUtdDEKSDuJ4CuPDeZ5YzR41mKZyfvyj/VXfXNLfVcwjl0rCpO4cbeTUoj cvzSrmtYvIkn72kAVp2mAtjqxzOB46s1++xKz9WjRkX+znXqol6ewBe+htCXRsP0k1TAOr 9lMB5DguDVfJRSppHjTBc9bhjjbwXlJXBngV65to37w8LULGHMLr0sP1yvA7Kg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NrR5z4qBqzj6m; Mon, 9 Jan 2023 20:55:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 309Kt3dq040014; Mon, 9 Jan 2023 20:55:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 309Kt3UF040013; Mon, 9 Jan 2023 20:55:03 GMT (envelope-from git) Date: Mon, 9 Jan 2023 20:55:03 GMT Message-Id: <202301092055.309Kt3UF040013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: d34678395f3f - main - ifnet/API: Change if_set*bit accessors to clear first List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d34678395f3f24df6cee899fcfe7f76b99cae426 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=d34678395f3f24df6cee899fcfe7f76b99cae426 commit d34678395f3f24df6cee899fcfe7f76b99cae426 Author: Justin Hibbits AuthorDate: 2023-01-09 19:24:08 +0000 Commit: Justin Hibbits CommitDate: 2023-01-09 21:00:22 +0000 ifnet/API: Change if_set*bit accessors to clear first Summary: A common pattern has been to: if (foo) caps = IFCAP_FOO; ifp->if_capenable &= ~IFCAP_FOO; ifp->if_capenable |= caps; which in the new order of things would be: if (foo) caps = IF_FOO; if_setcapenablebits(ifp, 0, IFCAP_FOO); if_setcapenablebits(ifp, caps, 0); This change streamlines this into: if (foo) caps = IF_FOO; if_setcapenablebits(ifp, caps, IFCAP_FOO); Reviewed by: melifaro Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37993 --- sys/net/if.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 3b2256bd94ff..c7b7d1f6d9d4 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4211,8 +4211,8 @@ if_setcapabilities(if_t ifp, int capabilities) int if_setcapabilitiesbit(if_t ifp, int setbit, int clearbit) { - ((struct ifnet *)ifp)->if_capabilities |= setbit; ((struct ifnet *)ifp)->if_capabilities &= ~clearbit; + ((struct ifnet *)ifp)->if_capabilities |= setbit; return (0); } @@ -4233,10 +4233,10 @@ if_setcapenable(if_t ifp, int capabilities) int if_setcapenablebit(if_t ifp, int setcap, int clearcap) { - if(setcap) - ((struct ifnet *)ifp)->if_capenable |= setcap; if(clearcap) ((struct ifnet *)ifp)->if_capenable &= ~clearcap; + if(setcap) + ((struct ifnet *)ifp)->if_capenable |= setcap; return (0); } @@ -4339,8 +4339,8 @@ if_setdev(if_t ifp, void *dev) int if_setdrvflagbits(if_t ifp, int set_flags, int clear_flags) { - ((struct ifnet *)ifp)->if_drv_flags |= set_flags; ((struct ifnet *)ifp)->if_drv_flags &= ~clear_flags; + ((struct ifnet *)ifp)->if_drv_flags |= set_flags; return (0); } @@ -4369,8 +4369,8 @@ if_setflags(if_t ifp, int flags) int if_setflagbits(if_t ifp, int set, int clear) { - ((struct ifnet *)ifp)->if_flags |= set; ((struct ifnet *)ifp)->if_flags &= ~clear; + ((struct ifnet *)ifp)->if_flags |= set; return (0); } @@ -4391,8 +4391,8 @@ if_clearhwassist(if_t ifp) int if_sethwassistbits(if_t ifp, int toset, int toclear) { - ((struct ifnet *)ifp)->if_hwassist |= toset; ((struct ifnet *)ifp)->if_hwassist &= ~toclear; + ((struct ifnet *)ifp)->if_hwassist |= toset; return (0); }