From patchwork Sun Apr 10 15:14:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 8789431 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A22779F39A for ; Sun, 10 Apr 2016 15:15:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F41FE201F4 for ; Sun, 10 Apr 2016 15:15:52 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 54FA7201CD for ; Sun, 10 Apr 2016 15:15:52 +0000 (UTC) Received: from localhost ([::1]:35233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apH5b-0007Yz-MZ for patchwork-qemu-devel@patchwork.kernel.org; Sun, 10 Apr 2016 11:15:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apH5J-0007Uz-BR for qemu-devel@nongnu.org; Sun, 10 Apr 2016 11:15:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apH5I-00085W-JT for qemu-devel@nongnu.org; Sun, 10 Apr 2016 11:15:33 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apH5I-00085N-C4 for qemu-devel@nongnu.org; Sun, 10 Apr 2016 11:15:32 -0400 Received: by mail-wm0-x234.google.com with SMTP id l6so116302589wml.1 for ; Sun, 10 Apr 2016 08:15:32 -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=uXQIZc1BncLin/lr7V4K00GHCZjQ43RDqd7pHxr1ReA=; b=lqf0dKqpzwrWBHb+UnEdcVrsLcRo2daWG+F6ZHEORnQNBsK2+ocie2ePTnciPlG18T Su4tS/K8aAFOXhsYXKj3aJPnBTHumBsGHmj+boOPXWK5uE6KkmZgOyOmCXG8scm46Wnu nAbI3X/71YOFwxeb8l4SnMWohzkuucOQhpXH6Cl4SFYbgv9KuwEZKSqpcy+liWjq2Wrl 1cdfMbolbajZLbSMfe4mY7T9eXoD+bUb12/MVMkktlviUWlZy1NE491aZiKsGg7gYRzd U6dBwy97fB0X4F6HjtHy+y3CmTCkYuQrQyMY4/N8SsuGfeOl76XBc6X6ymBmKM/AIopg VqQQ== 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=uXQIZc1BncLin/lr7V4K00GHCZjQ43RDqd7pHxr1ReA=; b=cOsd5tJ6AoSMBB5oaD5P8WMwIMJcCDA+InR6MFiSv/zUlI0lhfjvj1O2BRf+zg7ETE t7VJrUJx4MgeIdxWtp20nGfe1usRSydeRR+dhOgaG/me1gmzqs7WcRy797qaJJ+6NGVl a+NnoLeu/8fChxEwIeNaxXk1TxTpYnJijVk+4+QI+MDgZfjbYbKopjOJgraFBlslrU3Z G/fHdrAaH+/t/z8VFMQXD+zx0HA11xoNozX7rC/rFRgPyQ/NHsYhWMoj3Wn3YAiwuTd8 R/v8AC0KmPWjEvPR0RRy86Q9wYw0YMFhtQFmXU2NIEk4pfwNzSbvCZQdgGxDhFmfGNh8 bUAQ== X-Gm-Message-State: AD7BkJKGcEjCDEPEPSCUUyh1Wjge8spmRAOWk15GrgBtgrDeFzDLNhgBzeXmdc3RHMGaRw== X-Received: by 10.194.93.42 with SMTP id cr10mr19118366wjb.33.1460301331887; Sun, 10 Apr 2016 08:15:31 -0700 (PDT) Received: from bark.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id j71sm12685874wmj.21.2016.04.10.08.15.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Apr 2016 08:15:31 -0700 (PDT) From: Dmitry Fleytman To: qemu-devel@nongnu.org Date: Sun, 10 Apr 2016 18:14:54 +0300 Message-Id: <1460301305-5321-6-git-send-email-dmitry@daynix.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460301305-5321-1-git-send-email-dmitry@daynix.com> References: <1460301305-5321-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::234 Subject: [Qemu-devel] [PATCH v4 05/16] 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-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dmitry Fleytman Signed-off-by: Dmitry Fleytman Signed-off-by: Leonid Bloch --- 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 093a71e..0a4db4d 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,