From: Sujith Sankar Date: Sat, 29 Nov 2014 07:17:37 +0000 (+0530) Subject: enic: fix build with clang X-Git-Tag: spdx-start~10006 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=91f7dd5d5e6e7dff7323206bd6cde106560f93f7;p=dpdk.git enic: fix build with clang This patch fixes the warnings and error reported by clang compiler on Linux. Reported-by: Bruce Richardson Signed-off-by: Sujith Sankar Acked-by: Bruce Richardson --- diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h index 6400d2497a..f128e6416a 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 b3738ee843..b1af838d27 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 853dd04b18..4bbf1e4144 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 485123fb8c..682c9c991d 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 63c26ddb14..8cc036b623 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);