From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2] virtio: Fix crash issue for secondary process Date: Fri, 27 Mar 2015 09:57:57 +0100 Message-ID: <1460294.FADgFl5tJd@xps13> 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Ouyang Changchun Return-path: In-Reply-To: <1427438150-6673-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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); >