From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77]) by dpdk.org (Postfix) with ESMTP id E2656803C for ; Mon, 1 Dec 2014 12:06:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=11640; q=dns/txt; s=iport; t=1417432007; x=1418641607; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=xJ9IlJ+Y9vUOK2XEXEch7bdOabCJgwDayPFaFX4ptXE=; b=JSZQ8qm4cjwkILZGR+pQWcrkhfS6keeHZ0HrpC/uWa3SbjuTudJf357a 8vC8ggWLjDMWrI9EKWAO27fCx/BQ8Lx9aQGc+dzXHutV5VncwUTOVH/k+ jAfEM9H2qL5R7/7iaz9cxz6/GuLvN1QcJMtWSf+FOw+x4GuJ1E+xEHCER 8=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhUFAPdKfFStJA2H/2dsb2JhbABbgwaBKQTNKwKBExYBAQEBAX2EAwEBBCcTPxACAQgYHhAyJQIEDgWIQNJeAQEBAQEBAQEBAQEBAQEBAQEBARmQSDMHhEgFhgOIeoIIi0KVQ4I3gURvgUaBAQEBAQ X-IronPort-AV: E=Sophos;i="5.07,493,1413244800"; d="scan'208";a="376513138" Received: from alln-core-2.cisco.com ([173.36.13.135]) by rcdn-iport-6.cisco.com with ESMTP; 01 Dec 2014 11:06:45 +0000 Received: from xhc-aln-x12.cisco.com (xhc-aln-x12.cisco.com [173.36.12.86]) by alln-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id sB1B6jHR009220 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 1 Dec 2014 11:06:45 GMT Received: from xmb-aln-x07.cisco.com ([169.254.2.173]) by xhc-aln-x12.cisco.com ([173.36.12.86]) with mapi id 14.03.0195.001; Mon, 1 Dec 2014 05:06:44 -0600 From: "Sujith Sankar (ssujith)" To: Bruce Richardson Thread-Topic: [dpdk-dev] [PATCH] enicpd: Warnings and one error when built using clang compiler Thread-Index: AQHQC6TH61xJC1VEqkWLHEvl40Gh/Jx6+J4AgABepYA= Date: Mon, 1 Dec 2014 11:06:43 +0000 Message-ID: References: <1417245457-19609-1-git-send-email-ssujith@cisco.com> <20141201105756.GB4856@bricha3-MOBL3> In-Reply-To: <20141201105756.GB4856@bricha3-MOBL3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.3.9.131030 x-originating-ip: [10.127.149.201] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 11:06:48 -0000 On 01/12/14 4:27 pm, "Bruce Richardson" wrote: >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. >>=20 >> 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? Yes. This patch has only the changes to fix compilation on clang, and it modifies enic code only. > >On the basis that this fixes the issue though: > >Acked-by: Bruce Richardson Thanks Bruce. > >> --- >> 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(-) >>=20 >> 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; >> } >> =20 >> +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_ >> =20 >> #include >> +#include >> =20 >> #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 =3D=3D PCI_DEVICE_ID_CISCO_VIC_ENET_VF= ; >> } >> =20 >> -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]); >> } >> =20 >> -static int is_mcast_addr(char *addr) >> +static int is_mcast_addr(uint8_t *addr) >> { >> return addr[0] & 1; >> } >> =20 >> -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; >> =20 >> - 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); >> } >> =20 >> @@ -430,14 +431,15 @@ static int enic_rq_indicate_buf(struct vnic_rq >>*rq, >> &ipv4_csum_ok, &ipv6, &ipv4, &ipv4_fragment, >> &fcs_ok); >> =20 >> - if (packet_error) { >> - dev_err(enic, "packet error\n"); >> - return; >> - } >> - >> rx_pkt =3D (struct rte_mbuf *)buf->os_buf; >> buf->os_buf =3D NULL; >> =20 >> + if (unlikely(packet_error)) { >> + dev_err(enic, "packet error\n"); >> + rx_pkt->data_len =3D 0; >> + return 0; >> + } >> + >> if (unlikely(skipped)) { >> rx_pkt->data_len =3D 0; >> return 0; >> @@ -563,7 +565,8 @@ void *enic_alloc_consistent(void *priv, size_t size, >> const struct rte_memzone *rz; >> *dma_handle =3D 0; >> =20 >> - rz =3D rte_memzone_reserve_aligned(name, size, 0, 0, ENIC_ALIGN); >> + rz =3D 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 =3D {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}, >> }; >> int err; >> - char name[NAME_MAX]; >> + u8 name[NAME_MAX]; >> =20 >> - 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 =3D 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 =3D NULL; >> unsigned int i; >> int err; >> - char name[NAME_MAX]; >> + u8 name[NAME_MAX]; >> =20 >> - 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 =3D 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 =3D 1000; >> - static instance; >> + static u32 instance; >> char name[NAME_MAX]; >> =20 >> if (!vdev->stats) { >> - snprintf(name, sizeof(name), "vnic_stats-%d", instance++); >> + snprintf((char *)name, sizeof(name), >> + "vnic_stats-%d", instance++); >> vdev->stats =3D 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; >> =20 >> 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) >> } >> =20 >> 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 =3D 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 =3D 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 =3D vdev->alloc_consistent(vdev->priv, >> - tlv_size, &tlv_pa, z_name); >> + tlv_size, &tlv_pa, (u8 *)z_name); >> if (!tlv_va) >> return -ENOMEM; >> tlv =3D 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); >> --=20 >> 1.9.1 >>=20