From patchwork Wed Jun 1 08:23:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 9146355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB908607D8 for ; Wed, 1 Jun 2016 08:24:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAD052654B for ; Wed, 1 Jun 2016 08:24:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FB4D267EC; Wed, 1 Jun 2016 08:24:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 97AF12654B for ; Wed, 1 Jun 2016 08:24:47 +0000 (UTC) Received: from localhost ([::1]:40832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81SI-0000qD-KM for patchwork-qemu-devel@patchwork.kernel.org; Wed, 01 Jun 2016 04:24:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81Rg-0000iN-3q for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:24:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b81Re-00009c-4r for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:24:07 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81Rd-00009P-U6 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:24:06 -0400 Received: by mail-wm0-x241.google.com with SMTP id a136so4499827wme.0 for ; Wed, 01 Jun 2016 01:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3TQySyfe0GWkzMHZropYk2u1tMADoACtolriwdcY1vE=; b=v2EWagmFxURMJ3Bxu2asxlm9TBySUjyOoP8Ic+1icQ5X0UsXv0VeXpOt6IGWZUGMGA ZuNiGe/NZ67U6XIDwWQzCLXCrdvrYzI31R6K4yr12YaUbnGwYa0npFcki8vJ+4rIzXGZ 93ajHAlFeRovmKZOfTZa8Wl6bMaqdPbrMm+kDsehp1FwLJDahXyyhHpqaHpSqieqvngh authj2gPVLgSHq9yxyn7Hr45+S7/5Dp+YYAZGPUzCjzUUyF/38Ux55Mw30boLPHrqNe/ vCjUWNq6PotEXFEIw9spfcXyEuPS6DK5xXlVqUEAUg1rqOj9nUyWljFANckajbO2PD3M GAeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3TQySyfe0GWkzMHZropYk2u1tMADoACtolriwdcY1vE=; b=S6/FddCodGnOiVsv4WhqKFUGg2GbHmCWwUwbVzskD3OM07PT6syURpv8YzBLHOU8Rc M4KQLdEqhmp/WBFyPZMW29qiuSDyMNsAzL/dcgtLK+tlRK2DsjWvyu+f2m6Bno/socKJ S3qydBP3WG0uI9u5y3KfFKoIlChLlkDj+WnGjqeJLJIGMXeeAHPfg4KChWBcyXJFp3xA XtYpZNQcWywSFJOZhzOnkWvDEYT9DENFjgJor9748w4TJ7LNR3V2gF6atrmtKxdnfpF0 2RUfBZCVGHxb5uCVgfvoIwytu77HzTgjugcoQ1IdwKh5wtNxuXozGIC3o+lR3iQS4WMh F0KQ== X-Gm-Message-State: ALyK8tJHDEgN7NVDYQLMMSd3nkeQuvQ+2Tqz4GO8mkOfnWn5bwTCL3pjX+ReSrRw1OPI7w== X-Received: by 10.28.104.5 with SMTP id d5mr2315118wmc.82.1464769445405; Wed, 01 Jun 2016 01:24:05 -0700 (PDT) Received: from bark.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id o10sm29242719wjz.37.2016.06.01.01.24.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 01:24:04 -0700 (PDT) From: Dmitry Fleytman To: qemu-devel@nongnu.org Date: Wed, 1 Jun 2016 11:23:35 +0300 Message-Id: <1464769426-22276-7-git-send-email-dmitry@daynix.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464769426-22276-1-git-send-email-dmitry@daynix.com> References: <1464769426-22276-1-git-send-email-dmitry@daynix.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PATCH v8 06/17] vmxnet3: Use generic function for DSN capability definition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Jason Wang , Leonid Bloch , Shmulik Ladkani , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Dmitry Fleytman Signed-off-by: Dmitry Fleytman Signed-off-by: Leonid Bloch Reviewed-by: Michael S. Tsirkin --- hw/net/vmxnet3.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 20f26b7..586e915 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -2255,9 +2255,9 @@ static const MemoryRegionOps b1_ops = { }, }; -static uint8_t *vmxnet3_device_serial_num(VMXNET3State *s) +static uint64_t vmxnet3_device_serial_num(VMXNET3State *s) { - static uint64_t dsn_payload; + uint64_t dsn_payload; uint8_t *dsnp = (uint8_t *)&dsn_payload; dsnp[0] = 0xfe; @@ -2268,7 +2268,7 @@ static uint8_t *vmxnet3_device_serial_num(VMXNET3State *s) dsnp[5] = s->conf.macaddr.a[1]; dsnp[6] = s->conf.macaddr.a[2]; dsnp[7] = 0xff; - return dsnp; + return dsn_payload; } static void vmxnet3_pci_realize(PCIDevice *pci_dev, Error **errp) @@ -2313,10 +2313,8 @@ static void vmxnet3_pci_realize(PCIDevice *pci_dev, Error **errp) pcie_endpoint_cap_init(pci_dev, VMXNET3_EXP_EP_OFFSET); } - pcie_add_capability(pci_dev, PCI_EXT_CAP_ID_DSN, 0x1, - VMXNET3_DSN_OFFSET, PCI_EXT_CAP_DSN_SIZEOF); - memcpy(pci_dev->config + VMXNET3_DSN_OFFSET + 4, - vmxnet3_device_serial_num(s), sizeof(uint64_t)); + pcie_dev_ser_num_init(pci_dev, VMXNET3_DSN_OFFSET, + vmxnet3_device_serial_num(s)); } register_savevm(dev, "vmxnet3-msix", -1, 1,