From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com ([209.85.215.68]:40585 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752372AbeBZP6J (ORCPT ); Mon, 26 Feb 2018 10:58:09 -0500 Received: by mail-lf0-f68.google.com with SMTP id 37so22933847lfs.7 for ; Mon, 26 Feb 2018 07:58:08 -0800 (PST) Subject: Re: [PATCH iproute2-next v3 5/8] veth,vxcan: Save/reinitialize/restore whole @struct ifinfomsg To: David Ahern , netdev@vger.kernel.org References: <1519304526-18848-1-git-send-email-serhe.popovych@gmail.com> <1519304526-18848-6-git-send-email-serhe.popovych@gmail.com> <21860aaf-41a1-4a40-2f5f-01fc5ae033ea@gmail.com> From: Serhey Popovych Message-ID: <2c35ebea-2754-3220-8276-7a0a36fc9e66@gmail.com> Date: Mon, 26 Feb 2018 17:57:56 +0200 MIME-Version: 1.0 In-Reply-To: <21860aaf-41a1-4a40-2f5f-01fc5ae033ea@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Rih6tVg2w20pjd4JaNELY92U9kjTkhpgQ" Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Rih6tVg2w20pjd4JaNELY92U9kjTkhpgQ Content-Type: multipart/mixed; boundary="IKQ6GSNUyZQvnE18x9lTYiYaAsAWnXhOA"; protected-headers="v1" From: Serhey Popovych To: David Ahern , netdev@vger.kernel.org Message-ID: <2c35ebea-2754-3220-8276-7a0a36fc9e66@gmail.com> Subject: Re: [PATCH iproute2-next v3 5/8] veth,vxcan: Save/reinitialize/restore whole @struct ifinfomsg References: <1519304526-18848-1-git-send-email-serhe.popovych@gmail.com> <1519304526-18848-6-git-send-email-serhe.popovych@gmail.com> <21860aaf-41a1-4a40-2f5f-01fc5ae033ea@gmail.com> In-Reply-To: <21860aaf-41a1-4a40-2f5f-01fc5ae033ea@gmail.com> --IKQ6GSNUyZQvnE18x9lTYiYaAsAWnXhOA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable David Ahern wrote: > On 2/22/18 6:02 AM, Serhey Popovych wrote: >> Now in iplink_parse() we use ->ifi_change and ->ifi_flags fields and >> plan to use ->ifi_index with upcoming change. >> >> Saving, restoring and reinitializing individual fields is error prone:= >> using new field in iplink_parse() without updating callers in veth and= >> vxcan will overwrite main device ifinfomsg data. >> >> Since @struct ifinfomsg is small enough with known sizeof() compiler m= ay >> inline memcpy()/memset() with few load/store instructions. >> >> Signed-off-by: Serhey Popovych >> --- >> ip/iplink_vxcan.c | 22 ++++++++-------------- >> ip/link_veth.c | 22 ++++++++-------------- >> 2 files changed, 16 insertions(+), 28 deletions(-) >=20 > I don't agree that this change has any benefit. Only the flags and > change field are wanted; there is no need to save the entire struct, >=20 At the v0 (before submitted) I think so and just add ifi_index save/restore in addition to ifi_change and ifi_flags. But when look that memcpy() at 64-bit inlined to just two load/store instructions I decided to send memcpy()/memset() variant. If saving/restoring just ifi_index in addition to ifi_change and ifi_flags instead of full @struct ifinfomsg is preferred I will get rid of this change and add ifi_index to corresponding patch within series. --IKQ6GSNUyZQvnE18x9lTYiYaAsAWnXhOA-- --Rih6tVg2w20pjd4JaNELY92U9kjTkhpgQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJalC6NAAoJEBTawMmQ61bBUvwIAJKtwy25swnehTx4wUvkaauS wH2sm1jaGXRajNkuivxC+hYd8ieuxGARdvqOPhguPcnCRGTMOs3Ko7A60D0wiHII 953/ou0oPJ6gU3IvHkBia7GUi6YUyNamPOow0fEfPN1kkOozIZR5mT+uIsnBcQlw Y6jWXafUfs2rsKHuTvsPNDokOMZk8reVEH75Z7JPNZeQHTWkPSsteBalp4PYEncN EGSTE+eQ+MCjf9WFt8RziWHYlB1BA0sizFxNrA7DclktcFnqAXciN9chZAkgAxtw lQw7a2OU+by7mdBs+Z29nyHzHfOGDOQ6g4YwXW87vsgL/ExahgftNgDwaQBbIN8= =BgyT -----END PGP SIGNATURE----- --Rih6tVg2w20pjd4JaNELY92U9kjTkhpgQ--