From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by dpdk.org (Postfix) with ESMTP id 65B055A8D for ; Fri, 27 Mar 2015 09:58:38 +0100 (CET) Received: by wibbg6 with SMTP id bg6so18500700wib.0 for ; Fri, 27 Mar 2015 01:58:38 -0700 (PDT) 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:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=UlkRMLztkREAP9gH5zDB0fLndE0gQID8Z+QWdFZO944=; b=ECEoofcwa6TMZ4OtZKkPzSK4eJ5VKBSrKt5AmG9oDuOwQbIHltUlwRRr79U0scJv8m 6DooYHC8iswbZ9aocCxHx+4I0EuGw3rfHeY9mDRbwC1QVjr/Tc2D8blHf+tSuyJXOXD+ FOijwgQ4dRTzDZaF+7Wz8Cuk0Na5GZuN3MqOaVCMO51+IJANd7cht/5oBRX6jbMjnu87 3u9rgjGDMCajkn84DK5Fe5ZpT/hpTm4FFT6KG0j0sL04KmVz9/dpN/5HqVO0RnAsWAxP OU/GLOnUqP5D8BMUq6nYIdtFVlmacENvsqrnjsYxQupyDU9vCziQCW8QWjOQnNCA0hF8 aRRA== X-Gm-Message-State: ALoCoQnTxxO5caVBxYbRVb9lDcLsDNmgCOXqbnhSQWxdS/swn9gkkzxbo8Md00lh8QZUiMcYJiqw X-Received: by 10.180.88.42 with SMTP id bd10mr15985720wib.25.1427446718315; Fri, 27 Mar 2015 01:58:38 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id dm6sm1829232wib.22.2015.03.27.01.58.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2015 01:58:37 -0700 (PDT) From: Thomas Monjalon To: Ouyang Changchun Date: Fri, 27 Mar 2015 09:57:57 +0100 Message-ID: <1460294.FADgFl5tJd@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <1427438150-6673-1-git-send-email-changchun.ouyang@intel.com> References: <1426729537-24892-1-git-send-email-changchun.ouyang@intel.com> <1427438150-6673-1-git-send-email-changchun.ouyang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2] virtio: Fix crash issue for secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2015 08:58:38 -0000 2015-03-27 14:35, Ouyang Changchun: > It needs Rx function even in the case of secondary process, and it also needs check if > it supports mergeable feature or not. > > Signed-off-by: Changchun Ouyang > --- > > Changes in v2: > -- Check if it supports mergeable or not for the secondary process. > --- a/lib/librte_pmd_virtio/virtio_ethdev.c > +++ b/lib/librte_pmd_virtio/virtio_ethdev.c > @@ -1115,8 +1115,13 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) > eth_dev->dev_ops = &virtio_eth_dev_ops; > eth_dev->tx_pkt_burst = &virtio_xmit_pkts; > > - if (rte_eal_process_type() == RTE_PROC_SECONDARY) > + if (rte_eal_process_type() == RTE_PROC_SECONDARY) { > + if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) > + eth_dev->rx_pkt_burst = &virtio_recv_mergeable_pkts; > + else > + eth_dev->rx_pkt_burst = &virtio_recv_pkts; You are duplicating code, making it error prone for later maintenance. Please merge primary and secondary cases above the if() block. > return 0; > + } > > /* Allocate memory for storing MAC addresses */ > eth_dev->data->mac_addrs = rte_zmalloc("virtio", ETHER_ADDR_LEN, 0); >