From patchwork Wed Apr 6 08:37:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 606889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3qfzgq2dJ4z9t3t for ; Wed, 6 Apr 2016 18:40:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=daynix-com.20150623.gappssmtp.com header.i=@daynix-com.20150623.gappssmtp.com header.b=WH52lguT; dkim-atps=neutral Received: from localhost ([::1]:41687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anj0f-0001tQ-7j for incoming@patchwork.ozlabs.org; Wed, 06 Apr 2016 04:40:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aniyU-0005cE-Sx for qemu-devel@nongnu.org; Wed, 06 Apr 2016 04:38:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aniyU-0000KP-3m for qemu-devel@nongnu.org; Wed, 06 Apr 2016 04:38:06 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aniyT-0000KI-TW for qemu-devel@nongnu.org; Wed, 06 Apr 2016 04:38:06 -0400 Received: by mail-wm0-x244.google.com with SMTP id a140so11074471wma.2 for ; Wed, 06 Apr 2016 01:38: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=uXQIZc1BncLin/lr7V4K00GHCZjQ43RDqd7pHxr1ReA=; b=WH52lguTEU/O82rRD37lJAztmNhxIirROt5TmJOrxpFkSKtBxPaSNXl23RLwkLOwjL An32UU6bGXePtdGpRiAhjhyJHGN9aMWCXbAwLWJGwt05sRhU/Oj6kMUQfvIugz4qyE0e vY9QGUF8sloG6dpDn+4iKxtvBIYEbAKBnjavampjwiNL3T4Ox+BvbK9x64vLhjt4YtFN sHOOFI4vgPVcuBwT30e6MCRzscFStP+FLJq3LdT8lDwm3+gKHrpzR/kRHw06x4TXz0Hz 3j9S1deSs3uMXoTSYT+mPOLSPF0cZS2/QgPYz7S7ysIiGAhW8DM4fd26oTJNApRN/NR+ M2EQ== 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=YMUpMmHOSR1VYft1f7mpxND14UFdAJt/wFn5lJ8klkIJu0hkhvidSa5r6uYhq7b7Cv p8gdaPHybAtj0M628qe5tntfThSoUijDKvpLtD3XdCKdYoQ5Sd3dlIK5a8u6mbG2vdFA heLtqirDQZqbj2Ydner9ZYrBxdHpdRA/aTZy89ZIrndl/kyH6Ipuxg2KbsX2HB729dIB GLtJqZ3pBzbmJc+PiRdeEY2ltD6Ixaky3xEm3M6tUg/6jl/j5UZME0OIa8Y7QeJhqfTg xG06Ch3pqXXAcSY33lQaQ2lptW5li1yufCHMRlM61oFmjgdveg+cfBxMvMWKDyoJQkX7 q3ag== X-Gm-Message-State: AD7BkJJZyRfZd1JVmw6WGV2dqhm4Lb1RcSn2XVwi7juobldt0F0+L9B3tpjPa45jmSiuqQ== X-Received: by 10.194.175.196 with SMTP id cc4mr19849725wjc.109.1459931885314; Wed, 06 Apr 2016 01:38:05 -0700 (PDT) Received: from bark.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id w186sm2436154wmd.20.2016.04.06.01.38.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Apr 2016 01:38:04 -0700 (PDT) From: Dmitry Fleytman To: qemu-devel@nongnu.org Date: Wed, 6 Apr 2016 11:37:18 +0300 Message-Id: <1459931849-29336-6-git-send-email-dmitry@daynix.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459931849-29336-1-git-send-email-dmitry@daynix.com> References: <1459931849-29336-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::244 Cc: Yan Vugenfirer , Jason Wang , Leonid Bloch , Shmulik Ladkani , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v3 05/16] vmxnet3: Use generic function for DSN capability definition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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,