Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4766623imm; Mon, 15 Oct 2018 22:46:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV61wytOTlC5toAubCA7K/fKiisZxLLv27xJKG9iRv27Qw8DrkS9hQzOPbQK3m9QTkfG8qo5n X-Received: by 2002:a62:4799:: with SMTP id p25-v6mr20600551pfi.197.1539668808202; Mon, 15 Oct 2018 22:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539668808; cv=none; d=google.com; s=arc-20160816; b=uRx/UwHwntNPbAiWaWnt2jAkaGYsf5oDyZ3yIeNbZSy07FDnLl79qHUH5QeqGiS9Zi XdtPbJuMyY/Mug3jbMGyUo/zrpzaZRkeIKcoXmazC4E4m1waYOGK6vpz7VxS3gZc9ARe GnE3C8fWHONezlql/+bCHnd+Ni70h4GFSxr8C6fKkT0WBvHJBP2gfhex1MlVKbEALE2D 1Dd4CnByFEbFVHRlVhEEe/JVDi2OR8FjT8DJkxd5R1JbedEmf/8fBHo8aYmdlPhUBb5z hKXa1ztptfNAjuZyg4FwMNtKoCrJ6S5shL+wVhGQWVUzqaJ8iCOn4U18YFrsBYLzng03 G4jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature:dkim-signature; bh=p7lDReh9Po24QTriDU3HF5iWU7vr2lFBTf6PhLTOehI=; b=D2lDs7FS6PHiXChcCdzWB9Pqwnlw9ojrhtqHPOkmNSBZzhDoFDOry+nlDvTaLAdnSQ 95W24SiYAkaVuJm+xCFLTYgcoj95CCdWJTbLFs4+k4+6253SosyYeGK6rXVkX3zd5nMt ESOLpJ8D8fR2Lb2SpdEclKZ84hQy97hP2HHkAH/yhkLc636StY3JW9WeGccAVolUpQ26 Ftgh7GMr7taYW3bFpQ9HnI1wToWueABpFjKkcZdiXQHBuG1jPu4U6PLevxEdzl5CrtyB C4lq8LeFOg9u6ibEFtUQ1p0aTcwruz4v3r1t2p3Oy5r7SSuuFplf+p2Xp6zuJt+LrekI gG3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mendozajonas.com header.s=fm1 header.b=t8Mnrfdv; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Q3nO8t97; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6-v6si12791887pgf.303.2018.10.15.22.46.31; Mon, 15 Oct 2018 22:46:48 -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=@mendozajonas.com header.s=fm1 header.b=t8Mnrfdv; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Q3nO8t97; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728029AbeJPNez (ORCPT + 99 others); Tue, 16 Oct 2018 09:34:55 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46593 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727438AbeJPNez (ORCPT ); Tue, 16 Oct 2018 09:34:55 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 72E7722239; Tue, 16 Oct 2018 01:46:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 16 Oct 2018 01:46:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=message-id:subject:from:to:cc:date :in-reply-to:references:content-type:mime-version :content-transfer-encoding; s=fm1; bh=p7lDReh9Po24QTriDU3HF5iWU7 vr2lFBTf6PhLTOehI=; b=t8Mnrfdv6GyjJq5y9er7qDWvx60NaXyDKn//yW+JHH EzVGrnkkO3/skLfQLMCrYc1q0e7oSs8/FL9pyTiau6hZ9DU8lIdPnYWm8NMz0k4m jKNoDA5JPyBwgqcsZ6UCPO2X3ph4MZwaCEm1lzOGAr+fEydl1STD9SCL2BwOWMSZ QeX6+yp76SfkbSq+6rWES6Q50wKAeG9AokdPl7e+pObASmzv9RLjfODb41OAAyPL soT+1vUALaBMXNdCrTdUu+U7pzllrGXjMWakuoCZpQ5/W1aeX1poa9JhlW+a6d3E d/ReGJ2UcBmUGMvYigUA9xpMw9q4PKBIBD6Qv91elOww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=p7lDReh9Po24QTriDU3HF5iWU7vr2lFBTf6PhLTOe hI=; b=Q3nO8t97MgEAXb2Y4OlNP6b1eVsvMRXzFl77nNz04Rog0bePRiA+SZlFj +cSczfmfYztiJxQp9YjtbAknm0v+wPjEqbkW+32zalY8LOStU53ZsZck59G+tj1n VAVO+6lcBula7rSzrID8sylE2DoE5BVHivXbhZhyEM1H/sfD24q9Yh7vRCH+U4hN 5deRHOAT7Rszyd5BhnmLhraSjzQsjmuZW46ojTg9XdHqw02s0L1Qynfpwa1GrNBO jA5RnCJX8VFrtkrnru5LgInaktbUdJH0CtQYFWqLS/DjbnpbNjdkwmnytEJuO1fh 2K4A5TLhGd3tFVheD+7s8+bREu+KA== X-ME-Sender: X-ME-Proxy: Received: from v4 (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 71B16E4439; Tue, 16 Oct 2018 01:46:05 -0400 (EDT) Message-ID: <337567b2936725686459bdba7ef76dc46dea748a.camel@mendozajonas.com> Subject: Re: [Potential Spoof] Re: [PATCH net-next v4] net/ncsi: Add NCSI Broadcom OEM command From: Samuel Mendoza-Jonas To: Vijay Khemka , "David S. Miller" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: "openbmc@lists.ozlabs.org" , "linux-aspeed@lists.ozlabs.org" Date: Tue, 16 Oct 2018 16:46:01 +1100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-10-15 at 17:38 +0000, Vijay Khemka wrote: > > On 10/15/18, 10:27 AM, "Linux-aspeed on behalf of Vijay Khemka" wrote: > > > > On 10/14/18, 8:51 PM, "Samuel Mendoza-Jonas" wrote: > > On Mon, 2018-10-15 at 13:08 +1100, Samuel Mendoza-Jonas wrote: > > On Fri, 2018-10-12 at 11:20 -0700, Vijay Khemka wrote: > > > This patch adds OEM Broadcom commands and response handling. It also > > > defines OEM Get MAC Address handler to get and configure the device. > > > > > > ncsi_oem_gma_handler_bcm: This handler send NCSI broadcom command for > > > getting mac address. > > > ncsi_rsp_handler_oem_bcm: This handles response received for all > > > broadcom OEM commands. > > > ncsi_rsp_handler_oem_bcm_gma: This handles get mac address response and > > > set it to device. > > > > > > Signed-off-by: Vijay Khemka > > > --- > > > v4: updated as per comment from Sam, I was just wondering if I can remove > > > NCSI_OEM_CMD_GET_MAC config option and let this code be valid always and > > > it will configure mac address if there is get mac address handler for given > > > manufacture id. > > > > Hi Vijay, > > > > We can look at handling this a different way, but I don't think we want > > to unconditionally set the system's MAC address based on the OEM GMA > > command. If the user wants to set a custom MAC address, or in the case of > > OpenBMC for example who have their MAC address saved in flash, this will > > override that value with whatever the Network Controller has saved. In > > particular as it is set up it will override any MAC address every time a > > channel is configured, such as during a failover event. > > > > We *could* always send the GMA command if it is available and move the > > decision whether to use the resulting address or not into the response > > handler. That would simplify the ncsi_configure_channel() logic a bit. > > Another idea may be to have a Netlink command to tell NCSI to ignore the > > GMA result; then we could drop the config option and the system can > > safely change the address if desired. > > > > Any thoughts? I'll also ping some of the OpenBMC people and see what > > their expectations are. > > After a bit of a think and an ask around, to quote a colleague: > > I think we'd want it handled (overall) like any other net device; the MAC > > address in the device's ROM provides a default, and is overridden by anything > > specified by userspace > > Which describes what I was thinking pretty well. > So if we can have it such that the NCSI driver only sets the MAC address > _once_, and then after then does not update it again, we should be able to call > the OEM GMA command without hiding it behind a config option. So the first time > a channel was configured we store and set the MAC address given, but then on > later configure events we don't continue to update it. What do you think? > > Cheers, > Sam > > I agree with you setting it only once. I gave a thought about config option and realize that > we should allow user to configure it. If user wants to set mac address through device tree > and not through ROM then we must not override mac set by device tree. So my proposal is > setting of mac address in response should be hidden under config option. Getting mac address > can still go without config option. Your thought? > > or simply guard following block under config and no other function declaration guard required. > And set static variable flag in function " ncsi_oem_handler" for calling this only once. > > #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC) > nca.type = NCSI_PKT_CMD_OEM; > nca.package = np->id; > nca.channel = nc->id; > ndp->pending_req_num = 1; > ret = ncsi_oem_handler(&nca, nc->version.mf_id); > #endif /* CONFIG_NCSI_OEM_CMD_GET_MAC */ > Hi Vijay, Either way is likely fine; although you might need to take care you don't get an unused function warning depending on how you guard ncsi_oem_handler(). Also a flag in the ncsi_dev_priv struct could be easier to keep track of than having a static variable in the handler function. Sam