From patchwork Sun May 15 13:49:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 9096441 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 63DB59F1D3 for ; Sun, 15 May 2016 13:54:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBFEB202A1 for ; Sun, 15 May 2016 13:54:58 +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 1920B20120 for ; Sun, 15 May 2016 13:54:58 +0000 (UTC) Received: from localhost ([::1]:40433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1wVV-00071n-F5 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 15 May 2016 09:54:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1wR1-0007Hw-CC for qemu-devel@nongnu.org; Sun, 15 May 2016 09:50:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1wQz-0007WO-72 for qemu-devel@nongnu.org; Sun, 15 May 2016 09:50:18 -0400 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:36864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1wQz-0007WK-06 for qemu-devel@nongnu.org; Sun, 15 May 2016 09:50:17 -0400 Received: by mail-wm0-x22a.google.com with SMTP id a17so98396567wme.0 for ; Sun, 15 May 2016 06:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravellosystems-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2uei3hJY3OysKyQ3sktAQvPJEHZqXI/y1MCuoE8C6jg=; b=P18ARJgNShxH8k+kbeMZsWk78YmcSEGu9FAlrH7bKRWLq44yOiIEo65qq3GuGVcuCz 8BFOm5kCOJ/n1fJTTRAbctix7X+d2tUzraC0cjpKKikfw0yLwKb/t/ym2DqH2rwrcnfu Qo7lMZyoiFoRvsEJfL/ZIfod29Lv219gIwr/Ga/X3SM4d1Pyq96djhxMAaLX6tuam2an lWOuOAEfcyi5ef8XVbAm6uLuwonVg4w/BtrQDebGUT20PczGimwyVjH6cNo76KT37prg UC/wSWrNjnXdk58W+bcozUMEjv0xdaysZHmUwk2wNJHFB+wYyYkhGKFGIcmD6IIikO0v ++oA== 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=2uei3hJY3OysKyQ3sktAQvPJEHZqXI/y1MCuoE8C6jg=; b=FtkOM7qJ50pCgnIESWPuP3LLedCFZgFCF9pmob4OiaSgKbA1hwoFQUKlcIPhiwZVIF oGtGxQGdiipsPsLpF04vxzCl6IwQIyJ3o6U+pW/t6X7FZDUK7EAlYcxkogEbmNLK2pvb CC6S2IeoiF1s00lQiCwESPVzRm1szklj1/XWZ/xctcyMzMrzDp9r/I71GNnfmMY1Co4P +kxWZcUT8XnMNGyUTWQ3YzCnYtolGnUzcsIVG7ZSh5jfVLRZVWdZkk11zM37JbiAY1IY 3muoB5+o0AUQ70DhJKZZ+0vshpLftFuN60cPygLqEeba6DaZOtLPx6C2ifuctAE5kJxy K+UQ== X-Gm-Message-State: AOPr4FWI5ZHzffAmr58/0S4+H4in+yNY8AbITaZx3H8BC4w4CshWqEOgOAoATfq/aLOj1BVZ X-Received: by 10.194.203.227 with SMTP id kt3mr24811082wjc.73.1463320216243; Sun, 15 May 2016 06:50:16 -0700 (PDT) Received: from bark.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id c4sm28742403wjm.24.2016.05.15.06.50.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 May 2016 06:50:15 -0700 (PDT) From: Leonid Bloch To: qemu-devel@nongnu.org Date: Sun, 15 May 2016 16:49:38 +0300 Message-Id: <1463320189-14108-6-git-send-email-leonid.bloch@ravellosystems.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1463320189-14108-1-git-send-email-leonid.bloch@ravellosystems.com> References: <1463320189-14108-1-git-send-email-leonid.bloch@ravellosystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22a Subject: [Qemu-devel] [PATCH v5 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: Dmitry Fleytman , 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,