This patch fixes the warnings and error reported by clang compiler on Linux.
Reported-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Sujith Sankar <ssujith@cisco.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
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_ */
#define _ENIC_COMPAT_H_
#include <stdio.h>
+#include <unistd.h>
#include <rte_atomic.h>
#include <rte_malloc.h>
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);
}
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);
}
&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;
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);
.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)
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)
{
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;
}
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" \
}
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;
}
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;
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,
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);
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);