From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4F82A803C for ; Mon, 1 Dec 2014 11:58:01 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 01 Dec 2014 02:54:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,493,1413270000"; d="scan'208";a="646137788" Received: from bricha3-mobl3.ger.corp.intel.com ([10.243.20.36]) by orsmga002.jf.intel.com with SMTP; 01 Dec 2014 02:57:57 -0800 Received: by (sSMTP sendmail emulation); Mon, 01 Dec 2014 10:57:56 +0025 Date: Mon, 1 Dec 2014 10:57:56 +0000 From: Bruce Richardson To: Sujith Sankar Message-ID: <20141201105756.GB4856@bricha3-MOBL3> References: <1417245457-19609-1-git-send-email-ssujith@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1417245457-19609-1-git-send-email-ssujith@cisco.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] enicpd: Warnings and one error when built using clang compiler 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: Mon, 01 Dec 2014 10:58:02 -0000 On Sat, Nov 29, 2014 at 12:47:37PM +0530, Sujith Sankar wrote: > This patch fixes the warnings and error reported by clang compiler on Linux. > > Reported-by: Bruce Richardson > Signed-off-by: Sujith Sankar This PMD now compiles up with clang on FreeBSD. The patch seems rather large though, are all these changes necessary for clang compilation? On the basis that this fixes the issue though: Acked-by: Bruce Richardson > --- > lib/librte_pmd_enic/enic.h | 40 +++++++++++++++++++++++++++++++++++++ > lib/librte_pmd_enic/enic_compat.h | 1 + > lib/librte_pmd_enic/enic_main.c | 31 +++++++++++++++------------- > lib/librte_pmd_enic/vnic/vnic_dev.c | 19 ++++++++++-------- > lib/librte_pmd_enic/vnic/vnic_dev.h | 9 +++++++++ > 5 files changed, 78 insertions(+), 22 deletions(-) > > diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h > index 6400d24..f128e64 100644 > --- a/lib/librte_pmd_enic/enic.h > +++ b/lib/librte_pmd_enic/enic.h > @@ -154,4 +154,44 @@ static inline struct enic *pmd_priv(struct rte_eth_dev *eth_dev) > return (struct enic *)eth_dev->data->dev_private; > } > > +extern int enic_fdir_add_fltr(struct enic *enic, > + struct rte_fdir_filter *params, u16 queue, u8 drop); > +extern int enic_fdir_del_fltr(struct enic *enic, > + struct rte_fdir_filter *params); > +extern void enic_free_wq(void *txq); > +extern int enic_alloc_intr_resources(struct enic *enic); > +extern int enic_setup_finish(struct enic *enic); > +extern int enic_alloc_wq(struct enic *enic, uint16_t queue_idx, > + unsigned int socket_id, uint16_t nb_desc); > +extern void enic_start_wq(struct enic *enic, uint16_t queue_idx); > +extern int enic_stop_wq(struct enic *enic, uint16_t queue_idx); > +extern void enic_start_rq(struct enic *enic, uint16_t queue_idx); > +extern int enic_stop_rq(struct enic *enic, uint16_t queue_idx); > +extern void enic_free_rq(void *rxq); > +extern int enic_alloc_rq(struct enic *enic, uint16_t queue_idx, > + unsigned int socket_id, struct rte_mempool *mp, > + uint16_t nb_desc); > +extern int enic_set_rss_nic_cfg(struct enic *enic); > +extern int enic_set_vnic_res(struct enic *enic); > +extern void enic_set_hdr_split_size(struct enic *enic, u16 split_hdr_size); > +extern int enic_enable(struct enic *enic); > +extern int enic_disable(struct enic *enic); > +extern void enic_remove(struct enic *enic); > +extern int enic_get_link_status(struct enic *enic); > +extern void enic_dev_stats_get(struct enic *enic, > + struct rte_eth_stats *r_stats); > +extern void enic_dev_stats_clear(struct enic *enic); > +extern void enic_add_packet_filter(struct enic *enic); > +extern void enic_set_mac_address(struct enic *enic, uint8_t *mac_addr); > +extern void enic_del_mac_address(struct enic *enic); > +extern unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq); > +extern int enic_send_pkt(struct enic *enic, struct vnic_wq *wq, > + struct rte_mbuf *tx_pkt, unsigned short len, > + uint8_t sop, uint8_t eop, > + uint16_t ol_flags, uint16_t vlan_tag); > +extern int enic_poll(struct vnic_rq *rq, struct rte_mbuf **rx_pkts, > + unsigned int budget, unsigned int *work_done); > +extern int enic_probe(struct enic *enic); > +extern int enic_clsf_init(struct enic *enic); > +extern void enic_clsf_destroy(struct enic *enic); > #endif /* _ENIC_H_ */ > diff --git a/lib/librte_pmd_enic/enic_compat.h b/lib/librte_pmd_enic/enic_compat.h > index b3738ee..b1af838 100644 > --- a/lib/librte_pmd_enic/enic_compat.h > +++ b/lib/librte_pmd_enic/enic_compat.h > @@ -37,6 +37,7 @@ > #define _ENIC_COMPAT_H_ > > #include > +#include > > #include > #include > diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.c > index 853dd04..4bbf1e4 100644 > --- a/lib/librte_pmd_enic/enic_main.c > +++ b/lib/librte_pmd_enic/enic_main.c > @@ -65,17 +65,17 @@ static inline int enic_is_sriov_vf(struct enic *enic) > return enic->pdev->id.device_id == PCI_DEVICE_ID_CISCO_VIC_ENET_VF; > } > > -static int is_zero_addr(char *addr) > +static int is_zero_addr(uint8_t *addr) > { > return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); > } > > -static int is_mcast_addr(char *addr) > +static int is_mcast_addr(uint8_t *addr) > { > return addr[0] & 1; > } > > -static int is_eth_addr_valid(char *addr) > +static int is_eth_addr_valid(uint8_t *addr) > { > return !is_mcast_addr(addr) && !is_zero_addr(addr); > } > @@ -105,7 +105,8 @@ static const struct rte_memzone *ring_dma_zone_reserve( > if (mz) > return mz; > > - return rte_memzone_reserve_aligned(z_name, (uint64_t) ring_size, > + return rte_memzone_reserve_aligned((const char *)z_name, > + (uint64_t) ring_size, > socket_id, RTE_MEMZONE_1GB, ENIC_ALIGN); > } > > @@ -430,14 +431,15 @@ static int enic_rq_indicate_buf(struct vnic_rq *rq, > &ipv4_csum_ok, &ipv6, &ipv4, &ipv4_fragment, > &fcs_ok); > > - if (packet_error) { > - dev_err(enic, "packet error\n"); > - return; > - } > - > rx_pkt = (struct rte_mbuf *)buf->os_buf; > buf->os_buf = NULL; > > + if (unlikely(packet_error)) { > + dev_err(enic, "packet error\n"); > + rx_pkt->data_len = 0; > + return 0; > + } > + > if (unlikely(skipped)) { > rx_pkt->data_len = 0; > return 0; > @@ -563,7 +565,8 @@ void *enic_alloc_consistent(void *priv, size_t size, > const struct rte_memzone *rz; > *dma_handle = 0; > > - rz = rte_memzone_reserve_aligned(name, size, 0, 0, ENIC_ALIGN); > + rz = rte_memzone_reserve_aligned((const char *)name, > + size, 0, 0, ENIC_ALIGN); > if (!rz) { > pr_err("%s : Failed to allocate memory requested for %s", > __func__, name); > @@ -873,9 +876,9 @@ static int enic_set_rsskey(struct enic *enic) > .key[3].b = {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}, > }; > int err; > - char name[NAME_MAX]; > + u8 name[NAME_MAX]; > > - snprintf(name, NAME_MAX, "rss_key-%s", enic->bdf_name); > + snprintf((char *)name, NAME_MAX, "rss_key-%s", enic->bdf_name); > rss_key_buf_va = enic_alloc_consistent(enic, sizeof(union vnic_rss_key), > &rss_key_buf_pa, name); > if (!rss_key_buf_va) > @@ -899,9 +902,9 @@ static int enic_set_rsscpu(struct enic *enic, u8 rss_hash_bits) > union vnic_rss_cpu *rss_cpu_buf_va = NULL; > unsigned int i; > int err; > - char name[NAME_MAX]; > + u8 name[NAME_MAX]; > > - snprintf(name, NAME_MAX, "rss_cpu-%s", enic->bdf_name); > + snprintf((char *)name, NAME_MAX, "rss_cpu-%s", enic->bdf_name); > rss_cpu_buf_va = enic_alloc_consistent(enic, sizeof(union vnic_rss_cpu), > &rss_cpu_buf_pa, name); > if (!rss_cpu_buf_va) > diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c b/lib/librte_pmd_enic/vnic/vnic_dev.c > index 485123f..682c9c9 100644 > --- a/lib/librte_pmd_enic/vnic/vnic_dev.c > +++ b/lib/librte_pmd_enic/vnic/vnic_dev.c > @@ -517,13 +517,14 @@ int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats) > { > u64 a0, a1; > int wait = 1000; > - static instance; > + static u32 instance; > char name[NAME_MAX]; > > if (!vdev->stats) { > - snprintf(name, sizeof(name), "vnic_stats-%d", instance++); > + snprintf((char *)name, sizeof(name), > + "vnic_stats-%d", instance++); > vdev->stats = vdev->alloc_consistent(vdev->priv, > - sizeof(struct vnic_stats), &vdev->stats_pa, name); > + sizeof(struct vnic_stats), &vdev->stats_pa, (u8 *)name); > if (!vdev->stats) > return -ENOMEM; > } > @@ -763,7 +764,7 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) > void *notify_addr; > dma_addr_t notify_pa; > char name[NAME_MAX]; > - static int instance; > + static u32 instance; > > if (vdev->notify || vdev->notify_pa) { > pr_warn("notify block %p still allocated.\n" \ > @@ -772,10 +773,11 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) > } > > if (!vnic_dev_in_reset(vdev)) { > - snprintf(name, sizeof(name), "vnic_notify-%d", instance++); > + snprintf((char *)name, sizeof(name), > + "vnic_notify-%d", instance++); > notify_addr = vdev->alloc_consistent(vdev->priv, > sizeof(struct vnic_devcmd_notify), > - ¬ify_pa, name); > + ¬ify_pa, (u8 *)name); > if (!notify_addr) > return -ENOMEM; > } > @@ -1028,9 +1030,10 @@ int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry, > tlv_size = sizeof(struct filter) + > sizeof(struct filter_action) + > 2*sizeof(struct filter_tlv); > - snprintf(z_name, sizeof(z_name), "vnic_clsf_%d", unique_id++); > + snprintf((char *)z_name, sizeof(z_name), > + "vnic_clsf_%d", unique_id++); > tlv_va = vdev->alloc_consistent(vdev->priv, > - tlv_size, &tlv_pa, z_name); > + tlv_size, &tlv_pa, (u8 *)z_name); > if (!tlv_va) > return -ENOMEM; > tlv = tlv_va; > diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.h b/lib/librte_pmd_enic/vnic/vnic_dev.h > index 63c26dd..8cc036b 100644 > --- a/lib/librte_pmd_enic/vnic/vnic_dev.h > +++ b/lib/librte_pmd_enic/vnic/vnic_dev.h > @@ -100,6 +100,12 @@ struct vnic_stats; > void *vnic_dev_priv(struct vnic_dev *vdev); > unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev, > enum vnic_res_type type); > +void vnic_register_cbacks(struct vnic_dev *vdev, > + void *(*alloc_consistent)(void *priv, size_t size, > + dma_addr_t *dma_handle, u8 *name), > + void (*free_consistent)(struct rte_pci_device *hwdev, > + size_t size, void *vaddr, > + dma_addr_t dma_handle)); > void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type, > unsigned int index); > dma_addr_t vnic_dev_get_res_bus_addr(struct vnic_dev *vdev, > @@ -113,6 +119,8 @@ unsigned long vnic_dev_get_res_type_len(struct vnic_dev *vdev, > unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring, > unsigned int desc_count, unsigned int desc_size); > void vnic_dev_clear_desc_ring(struct vnic_dev_ring *ring); > +void vnic_set_hdr_split_size(struct vnic_dev *vdev, u16 size); > +u16 vnic_get_hdr_split_size(struct vnic_dev *vdev); > int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, > unsigned int desc_count, unsigned int desc_size, unsigned int socket_id, > char *z_name); > @@ -142,6 +150,7 @@ int vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr); > int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr); > int vnic_dev_raise_intr(struct vnic_dev *vdev, u16 intr); > int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr); > +void vnic_dev_set_reset_flag(struct vnic_dev *vdev, int state); > int vnic_dev_notify_unset(struct vnic_dev *vdev); > int vnic_dev_notify_setcmd(struct vnic_dev *vdev, > void *notify_addr, dma_addr_t notify_pa, u16 intr); > -- > 1.9.1 >