From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiwei Bie Subject: Re: [PATCH v5 3/3] net/virtio: support GUEST ANNOUNCE Date: Sat, 6 Jan 2018 01:56:49 +0800 Message-ID: <20180105175649.cytuiz243nlemiwj@debian-xvivbkq.sh.intel.com> References: <1515081578-30649-3-git-send-email-xiao.w.wang@intel.com> <1515170817-136539-1-git-send-email-xiao.w.wang@intel.com> <1515170817-136539-4-git-send-email-xiao.w.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: dev@dpdk.org, yliu@fridaylinux.org, stephen@networkplumber.org To: Xiao Wang Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 055DD1D7 for ; Fri, 5 Jan 2018 18:57:18 +0100 (CET) Content-Disposition: inline In-Reply-To: <1515170817-136539-4-git-send-email-xiao.w.wang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Jan 05, 2018 at 08:46:57AM -0800, Xiao Wang wrote: [...] > +static int > +make_rarp_packet(struct rte_mbuf *rarp_mbuf, const struct ether_addr *mac) > +{ > + struct ether_hdr *eth_hdr; > + struct arp_hdr *rarp; Please just use one space between the type and var instead of two. > + [...] > +static void > +virtio_notify_peers(struct rte_eth_dev *dev) > +{ > + struct virtio_hw *hw = dev->data->dev_private; > + struct virtnet_rx *rxvq = dev->data->rx_queues[0]; > + struct rte_mbuf *rarp_mbuf; > + > + rarp_mbuf = rte_mbuf_raw_alloc(rxvq->mpool); It's not necessary to use rte_mbuf_raw_alloc() here and you forgot to initialize the allocated mbuf. I think you can use rte_pktmbuf_alloc() directly as what I showed in the example in my previous mail. > + if (rarp_mbuf == NULL) { > + PMD_DRV_LOG(ERR, "first mbuf allocate free_bufed"); Typos: first? free_bufed? > + return; > + } [...] > +static void > +virtio_ack_link_announce(struct rte_eth_dev *dev) > +{ > + struct virtio_hw *hw = dev->data->dev_private; > + struct virtio_pmd_ctrl ctrl; > + int len; > + > + ctrl.hdr.class = VIRTIO_NET_CTRL_ANNOUNCE; > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_ANNOUNCE_ACK; > + len = 0; > + > + virtio_send_command(hw->cvq, &ctrl, &len, 0); If the last param is 0, then the third param could be NULL, i.e. you don't need to define `len`. > +} > + [...] > diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h > index 4a2a2f0..04b6a37 100644 > --- a/drivers/net/virtio/virtio_ethdev.h > +++ b/drivers/net/virtio/virtio_ethdev.h > @@ -68,6 +68,7 @@ > 1u << VIRTIO_NET_F_HOST_TSO6 | \ > 1u << VIRTIO_NET_F_MRG_RXBUF | \ > 1u << VIRTIO_NET_F_MTU | \ > + 1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE | \ Please use one space before '|' instead of two. Thanks, Tiwei