From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com ([209.85.215.68]:37425 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752015AbeBZPsU (ORCPT ); Mon, 26 Feb 2018 10:48:20 -0500 Received: by mail-lf0-f68.google.com with SMTP id y19so22899862lfd.4 for ; Mon, 26 Feb 2018 07:48:19 -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: <0a97556a-d678-21d4-e028-35077b317a71@gmail.com> Date: Mon, 26 Feb 2018 17:48:16 +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="drPn2HP8ip6TqGtSZ0LoMEmpsYNP39kVI" Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --drPn2HP8ip6TqGtSZ0LoMEmpsYNP39kVI Content-Type: multipart/mixed; boundary="u2IWZnh3rMZJTUvigMxrvjpGc2ZBofxmM"; protected-headers="v1" From: Serhey Popovych To: David Ahern , netdev@vger.kernel.org Message-ID: <0a97556a-d678-21d4-e028-35077b317a71@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> --u2IWZnh3rMZJTUvigMxrvjpGc2ZBofxmM 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 Struct is small enough, only ifi_change and ifi_flags being used right now, but next patch also changes ifi_index. Remaining values are fit in single u32 (ifi_family, ifi_type and pad). So we copy only one extra u32 at the moment. Later if something gets changed and iplink_parse() starts using ifi_family, ifi_type, ifi_pad... we do not need to modify vxcan and veth modules. --u2IWZnh3rMZJTUvigMxrvjpGc2ZBofxmM-- --drPn2HP8ip6TqGtSZ0LoMEmpsYNP39kVI 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) iQEcBAEBAgAGBQJalCxAAAoJEBTawMmQ61bBGcoH/08DzHs0VhTRQubbmNBoAGh+ UKItze9ZM89xPh4J3dXkeHk84hMW659j9TGaiA8rBjplIqFDbOkYTRGSRkaZVL/k 8yR9BK1tGVTn9liwpWsEZD1Sh/3MaGniyufLFDtP3jA+nx7WhOmcdmxZ9R7wVKTq VRmOk60PRxVEyTQp9nDR+/Mun1EsaR316VOhF9aAu/1T3QjKIgBFcCSxp0mHb69l HQsuFYIIecnuMfd9L94WfkxpZLHaXsUgxnRnrLVqj6y8vi0QTaAA6LaOik3Qqiwi FXE7TYxexH4iafGebWTOUojXXrj8zbopvF/Gfhz/i5njPkY4xB0mkEmtC9s11CI= =9jrf -----END PGP SIGNATURE----- --drPn2HP8ip6TqGtSZ0LoMEmpsYNP39kVI--