net/enic: use standard RTE defines
PATCH 1/1 net/enic: use standard RTE defines
Use the memzone namesize, Ethernet address length defines from the RTE header files instead of locally defined versions.
Use the RTE byte swap functions instead of the x86 specific locally defined versions.
--- drivers/net/enic/base/cq_desc.h | 9 ++++--- drivers/net/enic/base/cq_enet_desc.h | 39 ++++++++++++++-------------- drivers/net/enic/base/rq_enet_desc.h | 12 +++++---- drivers/net/enic/base/vnic_cq.c | 3 ++- drivers/net/enic/base/vnic_dev.c | 21 ++++++++------- drivers/net/enic/base/vnic_rq.c | 3 ++- drivers/net/enic/base/vnic_wq.c | 2 +- drivers/net/enic/base/wq_enet_desc.h | 36 +++++++++++++------------ drivers/net/enic/enic.h | 4 +-- drivers/net/enic/enic_compat.h | 8 ------ drivers/net/enic/enic_fm_flow.c | 5 ++-- drivers/net/enic/enic_main.c | 10 +++---- drivers/net/enic/enic_rxtx_common.h | 17 +++++++----- 13 files changed, 87 insertions(+), 82 deletions(-)
drivers/net/enic/base/cq_desc.h +5 -4
@@ -5,6 +5,7 @@#ifndef _CQ_DESC_H_#define _CQ_DESC_H_ +#include <rte_byteorder.h> /* * Completion queue descriptor types
@@ -58,8 +59,8 @@ static inline void cq_desc_enc(struct cq_desc *desc, { desc->type_color = (type &CQ_DESC_TYPE_MASK ) | ((color &CQ_DESC_COLOR_MASK ) <<CQ_DESC_COLOR_SHIFT ); - desc->q_number =cpu_to_le16 (q_number &CQ_DESC_Q_NUM_MASK ); - desc->completed_index =cpu_to_le16 (completed_index & + desc->q_number =rte_cpu_to_le_16 (q_number &CQ_DESC_Q_NUM_MASK ); + desc->completed_index =rte_cpu_to_le_16 (completed_index &CQ_DESC_COMP_NDX_MASK ); }
@@ -82,8 +83,8 @@ static inline void cq_desc_dec(const struct cq_desc *desc_arg,rmb (); *type = type_color &CQ_DESC_TYPE_MASK ; - *q_number =le16_to_cpu (desc->q_number) &CQ_DESC_Q_NUM_MASK ; - *completed_index =le16_to_cpu (desc->completed_index) & + *q_number =rte_le_to_cpu_16 (desc->q_number) &CQ_DESC_Q_NUM_MASK ; + *completed_index =rte_le_to_cpu_16 (desc->completed_index) &CQ_DESC_COMP_NDX_MASK ; }
drivers/net/enic/base/cq_enet_desc.h +20 -19
@@ -6,6 +6,7 @@#ifndef _CQ_ENET_DESC_H_#define _CQ_ENET_DESC_H_ +#include <rte_byteorder.h> #include "cq_desc.h" /* Ethernet completion queue descriptor: 16B */
@@ -118,33 +119,33 @@ static inline void cq_enet_rq_desc_enc(struct cq_enet_rq_desc *desc,cq_desc_enc ((struct cq_desc *)desc, type, color, q_number, completed_index); - desc->completed_index_flags |=cpu_to_le16 ( - (ingress_port ?CQ_ENET_RQ_DESC_FLAGS_INGRESS_PORT :0 ) | + desc->completed_index_flags |=rte_cpu_to_le_16 + ((ingress_port ?CQ_ENET_RQ_DESC_FLAGS_INGRESS_PORT :0 ) | (fcoe ?CQ_ENET_RQ_DESC_FLAGS_FCOE :0 ) | (eop ?CQ_ENET_RQ_DESC_FLAGS_EOP :0 ) | (sop ?CQ_ENET_RQ_DESC_FLAGS_SOP :0 )); - desc->q_number_rss_type_flags |=cpu_to_le16 ( - ((rss_type &CQ_ENET_RQ_DESC_RSS_TYPE_MASK ) << + desc->q_number_rss_type_flags |=rte_cpu_to_le_16 + (((rss_type &CQ_ENET_RQ_DESC_RSS_TYPE_MASK ) <<CQ_DESC_Q_NUM_BITS ) | (csum_not_calc ?CQ_ENET_RQ_DESC_FLAGS_CSUM_NOT_CALC :0 )); - desc->rss_hash =cpu_to_le32 (rss_hash); + desc->rss_hash =rte_cpu_to_le_32 (rss_hash); - desc->bytes_written_flags =cpu_to_le16 ( - (bytes_written &CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK ) | + desc->bytes_written_flags =rte_cpu_to_le_16 + ((bytes_written &CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK ) | (packet_error ?CQ_ENET_RQ_DESC_FLAGS_TRUNCATED :0 ) | (vlan_stripped ?CQ_ENET_RQ_DESC_FLAGS_VLAN_STRIPPED :0 )); - desc->vlan =cpu_to_le16 (vlan); + desc->vlan =rte_cpu_to_le_16 (vlan);if (fcoe) { - desc->checksum_fcoe =cpu_to_le16 ( - (fcoe_sof &CQ_ENET_RQ_DESC_FCOE_SOF_MASK ) | + desc->checksum_fcoe =rte_cpu_to_le_16 + ((fcoe_sof &CQ_ENET_RQ_DESC_FCOE_SOF_MASK ) | ((fcoe_eof &CQ_ENET_RQ_DESC_FCOE_EOF_MASK ) <<CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT )); }else { - desc->checksum_fcoe =cpu_to_le16 (checksum); + desc->checksum_fcoe =rte_cpu_to_le_16 (checksum); } desc->flags =
@@ -176,10 +177,10 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc,cq_desc_dec ((struct cq_desc *)desc, type, color, q_number, completed_index); - completed_index_flags =le16_to_cpu (desc->completed_index_flags); + completed_index_flags =rte_le_to_cpu_16 (desc->completed_index_flags); q_number_rss_type_flags = -le16_to_cpu (desc->q_number_rss_type_flags); - bytes_written_flags =le16_to_cpu (desc->bytes_written_flags); +rte_le_to_cpu_16 (desc->q_number_rss_type_flags); + bytes_written_flags =rte_le_to_cpu_16 (desc->bytes_written_flags); *ingress_port = (completed_index_flags &CQ_ENET_RQ_DESC_FLAGS_INGRESS_PORT ) ?1 :0 ;
@@ -195,7 +196,7 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc, *csum_not_calc = (q_number_rss_type_flags &CQ_ENET_RQ_DESC_FLAGS_CSUM_NOT_CALC ) ?1 :0 ; - *rss_hash =le32_to_cpu (desc->rss_hash); + *rss_hash =rte_le_to_cpu_32 (desc->rss_hash); *bytes_written = bytes_written_flags &CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK ;
@@ -207,16 +208,16 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc,/* * Tag Control Information(16) = user_priority(3) + cfi(1) + vlan(12) */ - *vlan_tci =le16_to_cpu (desc->vlan); + *vlan_tci =rte_le_to_cpu_16 (desc->vlan);if (*fcoe) { - *fcoe_sof = (u8)(le16_to_cpu (desc->checksum_fcoe) & + *fcoe_sof = (u8)(rte_le_to_cpu_16 (desc->checksum_fcoe) &CQ_ENET_RQ_DESC_FCOE_SOF_MASK ); *fcoe_fc_crc_ok = (desc->flags &CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK ) ?1 :0 ; *fcoe_enc_error = (desc->flags &CQ_ENET_RQ_DESC_FCOE_ENC_ERROR ) ?1 :0 ; - *fcoe_eof = (u8)((le16_to_cpu (desc->checksum_fcoe) >> + *fcoe_eof = (u8)((rte_le_to_cpu_16 (desc->checksum_fcoe) >>CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT ) &CQ_ENET_RQ_DESC_FCOE_EOF_MASK ); *checksum =0 ;
@@ -225,7 +226,7 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc, *fcoe_fc_crc_ok =0 ; *fcoe_enc_error =0 ; *fcoe_eof =0 ; - *checksum =le16_to_cpu (desc->checksum_fcoe); + *checksum =rte_le_to_cpu_16 (desc->checksum_fcoe); } *tcp_udp_csum_ok =
drivers/net/enic/base/rq_enet_desc.h +7 -5
@@ -6,6 +6,8 @@ #ifndef _RQ_ENET_DESC_H_ #define _RQ_ENET_DESC_H_ +#include <rte_byteorder.h> + /* Ethernet receive queue descriptor: 16B */ struct rq_enet_desc { __le64 address;
@@ -29,17 +31,17 @@ enum rq_enet_type_types {static inline void rq_enet_desc_enc (volatile struct rq_enet_desc *desc,u64 address,u8 type,u16 length) { - desc->address =cpu_to_le64 (address); - desc->length_type =cpu_to_le16 ((length &RQ_ENET_LEN_MASK ) | + desc->address =rte_cpu_to_le_64 (address); + desc->length_type =rte_cpu_to_le_16 ((length &RQ_ENET_LEN_MASK ) | ((type &RQ_ENET_TYPE_MASK ) <<RQ_ENET_LEN_BITS )); }static inline void rq_enet_desc_dec (struct rq_enet_desc *desc,u64 *address,u8 *type,u16 *length) { - *address =le64_to_cpu (desc->address); - *length =le16_to_cpu (desc->length_type) &RQ_ENET_LEN_MASK ; - *type = (u8)((le16_to_cpu (desc->length_type) >>RQ_ENET_LEN_BITS ) & + *address =rte_le_to_cpu_64 (desc->address); + *length =rte_le_to_cpu_16 (desc->length_type) &RQ_ENET_LEN_MASK ; + *type = (u8)((rte_le_to_cpu_16 (desc->length_type) >>RQ_ENET_LEN_BITS ) &RQ_ENET_TYPE_MASK ); }
drivers/net/enic/base/vnic_cq.c +2 -1
@@ -5,6 +5,7 @@#include "vnic_dev.h" #include "vnic_cq.h" +#include <rte_memzone.h> void vnic_cq_free (struct vnic_cq *cq) {
@@ -18,7 +19,7 @@ int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index, unsigned int desc_count, unsigned int desc_size) { int err; -char res_name[NAME_MAX ]; +char res_name[RTE_MEMZONE_NAMESIZE ];static int instance; cq->index = index;
drivers/net/enic/base/vnic_dev.c +11 -10
@@ -6,6 +6,7 @@#include <rte_memzone.h> #include <rte_memcpy.h> #include <rte_string_fns.h> +#include <rte_ether.h> #include "vnic_dev.h" #include "vnic_resource.h"
@@ -461,7 +462,7 @@ int vnic_dev_cmd_args(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,int vnic_dev_fw_info (struct vnic_dev *vdev,struct vnic_devcmd_fw_info **fw_info) { -char name[NAME_MAX ]; +char name[RTE_MEMZONE_NAMESIZE ];u64 a0, a1 =0 ;int wait =1000 ;int err =0 ;
@@ -515,7 +516,7 @@ int vnic_dev_flowman_cmd(struct vnic_dev *vdev, u64 *args, int nargs)static int vnic_dev_flowman_enable (struct vnic_dev *vdev,u32 *mode,u8 *filter_actions) { -char name[NAME_MAX ]; +char name[RTE_MEMZONE_NAMESIZE ];u64 args[3 ];u64 ops;static u32 instance;
@@ -536,7 +537,7 @@ static int vnic_dev_flowman_enable(struct vnic_dev *vdev, u32 *mode,return 0 ;/* Can we get fm_info? */ if (!vdev->flowman_info) { -snprintf ((char *)name,sizeof (name),"vnic_flowman_info-%u" , +snprintf ((char *)name,sizeof (name),"vnic_fm_info-%u" , instance++); vdev->flowman_info = vdev->alloc_consistent(vdev->priv, sizeof(struct fm_info),
@@ -770,14 +771,14 @@ int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)int wait =1000 ;int err, i; -for (i =0 ; i <ETH_ALEN ; i++) +for (i =0 ; i <RTE_ETHER_ADDR_LEN ; i++) mac_addr[i] =0 ; err =vnic_dev_cmd (vdev,CMD_GET_MAC_ADDR , &a0, &a1, wait);if (err)return err; -for (i =0 ; i <ETH_ALEN ; i++) +for (i =0 ; i <RTE_ETHER_ADDR_LEN ; i++) mac_addr[i] = ((u8 *)&a0)[i];return 0 ;
@@ -810,7 +811,7 @@ int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr)int err;int i; -for (i =0 ; i <ETH_ALEN ; i++) +for (i =0 ; i <RTE_ETHER_ADDR_LEN ; i++) ((u8 *)&a0)[i] = addr[i]; err =vnic_dev_cmd (vdev,CMD_ADDR_ADD , &a0, &a1, wait);
@@ -829,7 +830,7 @@ int vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr)int err;int i; -for (i =0 ; i <ETH_ALEN ; i++) +for (i =0 ; i <RTE_ETHER_ADDR_LEN ; i++) ((u8 *)&a0)[i] = addr[i]; err =vnic_dev_cmd (vdev,CMD_ADDR_DEL , &a0, &a1, wait);
@@ -892,7 +893,7 @@ int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) {void *notify_addr =NULL ;dma_addr_t notify_pa =0 ; -char name[NAME_MAX ]; +char name[RTE_MEMZONE_NAMESIZE ];static u32 instance;if (vdev->notify || vdev->notify_pa) {
@@ -1030,7 +1031,7 @@ u32 vnic_dev_get_intr_coal_timer_max(struct vnic_dev *vdev)int vnic_dev_alloc_stats_mem (struct vnic_dev *vdev) { -char name[NAME_MAX ]; +char name[RTE_MEMZONE_NAMESIZE ];static u32 instance;snprintf ((char *)name,sizeof (name),"vnic_stats-%u" , instance++);
@@ -1069,7 +1070,7 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev, unsigned int num_bars) {if (!vdev) { -char name[NAME_MAX ]; +char name[RTE_MEMZONE_NAMESIZE ];snprintf ((char *)name,sizeof (name),"%s-vnic" , pdev->device.name); vdev = (struct vnic_dev *)rte_zmalloc_socket(name,
drivers/net/enic/base/vnic_rq.c +2 -1
@@ -3,6 +3,7 @@* Copyright 2007 Nuova Systems, Inc. All rights reserved. */ +#include <rte_memzone.h> #include "vnic_dev.h" #include "vnic_rq.h"
@@ -21,7 +22,7 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index, unsigned int desc_count, unsigned int desc_size) { int rc; -char res_name[NAME_MAX ]; +char res_name[RTE_MEMZONE_NAMESIZE ];static int instance; rq->index = index;
drivers/net/enic/base/vnic_wq.c +1 -1
@@ -20,7 +20,7 @@ static inlineint vnic_wq_alloc_ring (struct vnic_dev *vdev,struct vnic_wq *wq,unsigned int desc_count,unsigned int desc_size) { -char res_name[NAME_MAX ]; +char res_name[RTE_MEMZONE_NAMESIZE ];static int instance;snprintf (res_name,sizeof (res_name),"%d-wq-%u" , instance++, wq->index);
drivers/net/enic/base/wq_enet_desc.h +19 -17
@@ -6,6 +6,8 @@ #ifndef _WQ_ENET_DESC_H_ #define _WQ_ENET_DESC_H_ +#include <rte_byteorder.h> + /* Ethernet work queue descriptor: 16B */ struct wq_enet_desc { __le64 address;
@@ -41,18 +43,18 @@ static inline void wq_enet_desc_enc(struct wq_enet_desc *desc, u8 offload_mode, u8 eop, u8 cq_entry, u8 fcoe_encap, u8 vlan_tag_insert, u16 vlan_tag, u8 loopback) { - desc->address = cpu_to_le64(address); - desc->length =cpu_to_le16 (length &WQ_ENET_LEN_MASK ); - desc->mss_loopback =cpu_to_le16 ((mss &WQ_ENET_MSS_MASK ) << + desc->address = rte_cpu_to_le_64(address); + desc->length =rte_cpu_to_le_16 (length &WQ_ENET_LEN_MASK ); + desc->mss_loopback =rte_cpu_to_le_16 ((mss &WQ_ENET_MSS_MASK ) <<WQ_ENET_MSS_SHIFT | (loopback &1 ) <<WQ_ENET_LOOPBACK_SHIFT ); - desc->header_length_flags =cpu_to_le16 ( - (header_length &WQ_ENET_HDRLEN_MASK ) | + desc->header_length_flags =rte_cpu_to_le_16 + ((header_length &WQ_ENET_HDRLEN_MASK ) | (offload_mode &WQ_ENET_FLAGS_OM_MASK ) <<WQ_ENET_HDRLEN_BITS | (eop &1 ) <<WQ_ENET_FLAGS_EOP_SHIFT | (cq_entry &1 ) <<WQ_ENET_FLAGS_CQ_ENTRY_SHIFT | (fcoe_encap &1 ) <<WQ_ENET_FLAGS_FCOE_ENCAP_SHIFT | (vlan_tag_insert &1 ) <<WQ_ENET_FLAGS_VLAN_TAG_INSERT_SHIFT ); - desc->vlan_tag =cpu_to_le16 (vlan_tag); + desc->vlan_tag =rte_cpu_to_le_16 (vlan_tag); } static inline void wq_enet_desc_dec(struct wq_enet_desc *desc,
@@ -60,25 +62,25 @@ static inline void wq_enet_desc_dec(struct wq_enet_desc *desc, u8 *offload_mode, u8 *eop, u8 *cq_entry, u8 *fcoe_encap, u8 *vlan_tag_insert, u16 *vlan_tag, u8 *loopback) { - *address =le64_to_cpu (desc->address); - *length =le16_to_cpu (desc->length) &WQ_ENET_LEN_MASK ; - *mss = (le16_to_cpu (desc->mss_loopback) >>WQ_ENET_MSS_SHIFT ) & + *address =rte_le_to_cpu_64 (desc->address); + *length =rte_le_to_cpu_16 (desc->length) &WQ_ENET_LEN_MASK ; + *mss = (rte_le_to_cpu_16 (desc->mss_loopback) >>WQ_ENET_MSS_SHIFT ) &WQ_ENET_MSS_MASK ; - *loopback = (u8)((le16_to_cpu (desc->mss_loopback) >> + *loopback = (u8)((rte_le_to_cpu_16 (desc->mss_loopback) >>WQ_ENET_LOOPBACK_SHIFT ) &1 ); - *header_length =le16_to_cpu (desc->header_length_flags) & + *header_length =rte_le_to_cpu_16 (desc->header_length_flags) &WQ_ENET_HDRLEN_MASK ; - *offload_mode = (u8)((le16_to_cpu (desc->header_length_flags) >> + *offload_mode = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_HDRLEN_BITS ) &WQ_ENET_FLAGS_OM_MASK ); - *eop = (u8)((le16_to_cpu (desc->header_length_flags) >> + *eop = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_EOP_SHIFT ) &1 ); - *cq_entry = (u8)((le16_to_cpu (desc->header_length_flags) >> + *cq_entry = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_CQ_ENTRY_SHIFT ) &1 ); - *fcoe_encap = (u8)((le16_to_cpu (desc->header_length_flags) >> + *fcoe_encap = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_FCOE_ENCAP_SHIFT ) &1 ); - *vlan_tag_insert = (u8)((le16_to_cpu (desc->header_length_flags) >> + *vlan_tag_insert = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_VLAN_TAG_INSERT_SHIFT ) &1 ); - *vlan_tag =le16_to_cpu (desc->vlan_tag); + *vlan_tag =rte_le_to_cpu_16 (desc->vlan_tag); }#endif /* _WQ_ENET_DESC_H_ */
drivers/net/enic/enic.h +2 -2
@@ -7,7 +7,7 @@#define _ENIC_H_#include <rte_vxlan.h> - +#include <rte_ether.h> #include "vnic_enet.h" #include "vnic_dev.h" #include "vnic_flowman.h"
@@ -126,7 +126,7 @@ struct enic {int iommu_group_fd;int iommu_groupid;int eventfd; -uint8_t mac_addr[ETH_ALEN ]; +uint8_t mac_addr[RTE_ETHER_ADDR_LEN ];pthread_t err_intr_thread;int promisc;int allmulti;
drivers/net/enic/enic_compat.h +0 -8
@@ -16,7 +16,6 @@#define ENIC_PAGE_ALIGN 4096UL#define ENIC_ALIGN ENIC_PAGE_ALIGN -#define NAME_MAX 255#define ETH_ALEN 6#define __iomem
@@ -24,13 +23,6 @@#define rmb () rte_rmb()/* dpdk rte provided rmb */ #define wmb () rte_wmb()/* dpdk rte provided wmb */ -#define le16_to_cpu -#define le32_to_cpu -#define le64_to_cpu -#define cpu_to_le16 -#define cpu_to_le32 -#define cpu_to_le64 -#ifndef offsetof#define offsetof (t, m) ((size_t) &((t *)0)->m)#endif
drivers/net/enic/enic_fm_flow.c +3 -2
@@ -10,6 +10,7 @@#include <rte_ether.h> #include <rte_ip.h> #include <rte_udp.h> +#include <rte_memzone.h> #include "enic_compat.h" #include "enic.h"
@@ -2353,7 +2354,7 @@ int enic_fm_init(struct enic *enic) {struct enic_flowman *fm; -u8 name[NAME_MAX ]; +u8 name[RTE_MEMZONE_NAMESIZE ];int rc;if (enic->flow_filter_mode !=FILTER_FLOWMAN )
@@ -2368,7 +2369,7 @@ enic_fm_init(struct enic *enic)TAILQ_INIT (&fm->fet_list);TAILQ_INIT (&fm->jump_list);/* Allocate host memory for flowman commands */ -snprintf ((char *)name,NAME_MAX ,"fm-cmd-%s" , enic->bdf_name); +snprintf ((char *)name,sizeof (name),"fm-cmd-%s" , enic->bdf_name); fm->cmd.va =enic_alloc_consistent (enic,sizeof (union enic_flowman_cmd_mem ), &fm->cmd.pa, name);if (!fm->cmd.va) {
drivers/net/enic/enic_main.c +5 -5
@@ -1010,7 +1010,7 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx,int err;struct vnic_wq *wq = &enic->wq[queue_idx];unsigned int cq_index =enic_cq_wq (enic, queue_idx); -char name[NAME_MAX ]; +char name[RTE_MEMZONE_NAMESIZE ];static int instance; wq->socket_id = socket_id;
@@ -1154,10 +1154,10 @@ static int enic_set_rsskey(struct enic *enic, uint8_t *user_key)dma_addr_t rss_key_buf_pa;union vnic_rss_key *rss_key_buf_va =NULL ;int err, i; -u8 name[NAME_MAX ]; +u8 name[RTE_MEMZONE_NAMESIZE ];RTE_ASSERT (user_key !=NULL ); -snprintf ((char *)name,NAME_MAX ,"rss_key-%s" , enic->bdf_name); +snprintf ((char *)name,sizeof (name),"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)
@@ -1186,9 +1186,9 @@ int enic_set_rss_reta(struct enic *enic, union vnic_rss_cpu *rss_cpu)dma_addr_t rss_cpu_buf_pa;union vnic_rss_cpu *rss_cpu_buf_va =NULL ;int err; -u8 name[NAME_MAX ]; +u8 name[RTE_MEMZONE_NAMESIZE ]; -snprintf ((char *)name,NAME_MAX ,"rss_cpu-%s" , enic->bdf_name); +snprintf ((char *)name,sizeof (name),"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)
drivers/net/enic/enic_rxtx_common.h +10 -7
@@ -6,16 +6,19 @@#ifndef _ENIC_RXTX_COMMON_H_#define _ENIC_RXTX_COMMON_H_ +#include <rte_byteorder.h> +static inline uint16_t enic_cq_rx_desc_ciflags (struct cq_enet_rq_desc *crd) { -return le16_to_cpu (crd->completed_index_flags) & ~CQ_DESC_COMP_NDX_MASK ; +return rte_le_to_cpu_16 (crd->completed_index_flags) & + ~CQ_DESC_COMP_NDX_MASK ; }static inline uint16_t enic_cq_rx_desc_bwflags (struct cq_enet_rq_desc *crd) { -return le16_to_cpu (crd->bytes_written_flags) & +return rte_le_to_cpu_16 (crd->bytes_written_flags) & ~CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK ; }
@@ -36,7 +39,7 @@ enic_cq_rx_desc_eop(uint16_t ciflags)static inline uint8_t enic_cq_rx_desc_csum_not_calc (struct cq_enet_rq_desc *cqrd) { -return (le16_to_cpu (cqrd->q_number_rss_type_flags) & +return (rte_le_to_cpu_16 (cqrd->q_number_rss_type_flags) &CQ_ENET_RQ_DESC_FLAGS_CSUM_NOT_CALC ) ==CQ_ENET_RQ_DESC_FLAGS_CSUM_NOT_CALC ; }
@@ -58,27 +61,27 @@ enic_cq_rx_desc_tcp_udp_csum_ok(struct cq_enet_rq_desc *cqrd)static inline uint8_t enic_cq_rx_desc_rss_type (struct cq_enet_rq_desc *cqrd) { -return (uint8_t )((le16_to_cpu (cqrd->q_number_rss_type_flags) >> +return (uint8_t )((rte_le_to_cpu_16 (cqrd->q_number_rss_type_flags) >>CQ_DESC_Q_NUM_BITS ) &CQ_ENET_RQ_DESC_RSS_TYPE_MASK ); }static inline uint32_t enic_cq_rx_desc_rss_hash (struct cq_enet_rq_desc *cqrd) { -return le32_to_cpu (cqrd->rss_hash); +return rte_le_to_cpu_32 (cqrd->rss_hash); }static inline uint16_t enic_cq_rx_desc_vlan (struct cq_enet_rq_desc *cqrd) { -return le16_to_cpu (cqrd->vlan); +return rte_le_to_cpu_16 (cqrd->vlan); }static inline uint16_t enic_cq_rx_desc_n_bytes (struct cq_desc *cqd) {struct cq_enet_rq_desc *cqrd = (struct cq_enet_rq_desc *)cqd; -return le16_to_cpu (cqrd->bytes_written_flags) & +return rte_le_to_cpu_16 (cqrd->bytes_written_flags) &CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK ; }
Signature · 1 line
2.22.0
PATCH 1/1 net/enic: consolidate and remove some defines
There were defines which originally allowed sharing of some code with the enic kernel driver. The code has long since diverged and now the abstraction just makes the code harder to read. Mostly mechanical replacement of defines and reformatting.
--- drivers/net/enic/base/cq_desc.h | 25 +- drivers/net/enic/base/cq_enet_desc.h | 91 +++--- drivers/net/enic/base/rq_enet_desc.h | 14 +- drivers/net/enic/base/vnic_cq.c | 6 +- drivers/net/enic/base/vnic_cq.h | 48 +-- drivers/net/enic/base/vnic_dev.c | 215 ++++++------- drivers/net/enic/base/vnic_dev.h | 83 ++--- drivers/net/enic/base/vnic_devcmd.h | 436 ++++++++++++++------------ drivers/net/enic/base/vnic_enet.h | 36 +-- drivers/net/enic/base/vnic_intr.c | 4 +- drivers/net/enic/base/vnic_intr.h | 36 +-- drivers/net/enic/base/vnic_nic.h | 10 +- drivers/net/enic/base/vnic_resource.h | 22 +- drivers/net/enic/base/vnic_rq.c | 10 +- drivers/net/enic/base/vnic_rq.h | 62 ++-- drivers/net/enic/base/vnic_rss.h | 12 +- drivers/net/enic/base/vnic_stats.h | 68 ++-- drivers/net/enic/base/vnic_wq.c | 6 +- drivers/net/enic/base/vnic_wq.h | 45 +-- drivers/net/enic/base/wq_enet_desc.h | 37 ++- drivers/net/enic/enic.h | 22 +- drivers/net/enic/enic_clsf.c | 14 +- drivers/net/enic/enic_compat.h | 22 -- drivers/net/enic/enic_flow.c | 26 +- drivers/net/enic/enic_fm_flow.c | 28 +- drivers/net/enic/enic_main.c | 25 +- drivers/net/enic/enic_res.c | 33 +- drivers/net/enic/enic_res.h | 11 +- drivers/net/enic/enic_rxtx.c | 5 +- 29 files changed, 737 insertions(+), 715 deletions(-)
drivers/net/enic/base/cq_desc.h +13 -12
@@ -25,14 +25,14 @@ enum cq_desc_types {/* Completion queue descriptor: 16B * * All completion queues have this basic layout. The -* type_specfic area is unique for each completion +* type_specific area is unique for each completion * queue type. */ struct cq_desc { -__le16 completed_index; -__le16 q_number; -u8 type_specfic[11 ]; -u8 type_color; +uint16_t completed_index; +uint16_t q_number; +uint8_t type_specific[11 ]; +uint8_t type_color; };#define CQ_DESC_TYPE_BITS 4
@@ -45,7 +45,7 @@ struct cq_desc {#define CQ_DESC_COMP_NDX_BITS 12#define CQ_DESC_COMP_NDX_MASK ((1 << CQ_DESC_COMP_NDX_BITS) - 1) -static inline void cq_color_enc (struct cq_desc *desc,const u8 color) +static inline void cq_color_enc (struct cq_desc *desc,const uint8_t color) {if (color) desc->type_color |= (1 <<CQ_DESC_COLOR_SHIFT );
@@ -54,8 +54,8 @@ static inline void cq_color_enc(struct cq_desc *desc, const u8 color) }static inline void cq_desc_enc (struct cq_desc *desc, -const u8 type,const u8 color,const u16 q_number, -const u16 completed_index) +const uint8_t type,const uint8_t color,const uint16_t q_number, +const uint16_t completed_index) { desc->type_color = (type &CQ_DESC_TYPE_MASK ) | ((color &CQ_DESC_COLOR_MASK ) <<CQ_DESC_COLOR_SHIFT );
@@ -65,10 +65,11 @@ static inline void cq_desc_enc(struct cq_desc *desc, }static inline void cq_desc_dec (const struct cq_desc *desc_arg, -u8 *type,u8 *color,u16 *q_number,u16 *completed_index) +uint8_t *type,uint8_t *color,uint16_t *q_number, +uint16_t *completed_index) {const struct cq_desc *desc = desc_arg; -const u8 type_color = desc->type_color; +const uint8_t type_color = desc->type_color; *color = (type_color >>CQ_DESC_COLOR_SHIFT ) &CQ_DESC_COLOR_MASK ;
@@ -80,7 +81,7 @@ static inline void cq_desc_dec(const struct cq_desc *desc_arg,* result in reading stale values. */ -rmb (); +rte_rmb (); *type = type_color &CQ_DESC_TYPE_MASK ; *q_number =rte_le_to_cpu_16 (desc->q_number) &CQ_DESC_Q_NUM_MASK ;
@@ -88,7 +89,7 @@ static inline void cq_desc_dec(const struct cq_desc *desc_arg,CQ_DESC_COMP_NDX_MASK ; } -static inline void cq_color_dec (const struct cq_desc *desc_arg,u8 *color) +static inline void cq_color_dec (const struct cq_desc *desc_arg,uint8_t *color) {volatile const struct cq_desc *desc = desc_arg;
drivers/net/enic/base/cq_enet_desc.h +49 -42
146 lines not on this page · raw message
drivers/net/enic/base/rq_enet_desc.h +7 -7
@@ -10,9 +10,9 @@/* Ethernet receive queue descriptor: 16B */ struct rq_enet_desc { -__le64 address; -__le16 length_type; -u8 reserved[6 ]; +uint64_t address; +uint16_t length_type; +uint8_t reserved[6 ]; };enum rq_enet_type_types {
@@ -29,7 +29,7 @@ enum rq_enet_type_types {#define RQ_ENET_TYPE_MASK ((1 << RQ_ENET_TYPE_BITS) - 1)static inline void rq_enet_desc_enc (volatile struct rq_enet_desc *desc, -u64 address,u8 type,u16 length) +uint64_t address,uint8_t type,uint16_t length) { desc->address =rte_cpu_to_le_64 (address); desc->length_type = rte_cpu_to_le_16((length & RQ_ENET_LEN_MASK) |
@@ -37,12 +37,12 @@ static inline void rq_enet_desc_enc(volatile struct rq_enet_desc *desc, }static inline void rq_enet_desc_dec (struct rq_enet_desc *desc, -u64 *address,u8 *type,u16 *length) +uint64_t *address,uint8_t *type,uint16_t *length) { *address =rte_le_to_cpu_64 (desc->address); *length =rte_le_to_cpu_16 (desc->length_type) &RQ_ENET_LEN_MASK ; - *type = (u8)((rte_le_to_cpu_16 (desc->length_type) >>RQ_ENET_LEN_BITS ) & -RQ_ENET_TYPE_MASK ); + *type = (uint8_t )((rte_le_to_cpu_16 (desc->length_type) >> +RQ_ENET_LEN_BITS ) &RQ_ENET_TYPE_MASK ); }#endif /* _RQ_ENET_DESC_H_ */
drivers/net/enic/base/vnic_cq.c +3 -3
@@ -44,11 +44,11 @@ void vnic_cq_init(struct vnic_cq *cq, unsigned int flow_control_enable, unsigned int color_enable, unsigned int cq_head, unsigned int cq_tail, unsigned int cq_tail_color, unsigned int interrupt_enable, unsigned int cq_entry_enable, unsigned int cq_message_enable, - unsigned int interrupt_offset, u64 cq_message_addr) + unsigned int interrupt_offset, uint64_t cq_message_addr) { - u64 paddr; + uint64_t paddr; - paddr = (u64 )cq->ring.base_addr |VNIC_PADDR_TARGET ; + paddr = (uint64_t )cq->ring.base_addr |VNIC_PADDR_TARGET ;writeq (paddr, &cq->ctrl->ring_base);iowrite32 (cq->ring.desc_count, &cq->ctrl->ring_size);iowrite32 (flow_control_enable, &cq->ctrl->flow_control_enable);
drivers/net/enic/base/vnic_cq.h +24 -24
60 lines not on this page · raw message
drivers/net/enic/base/vnic_dev.c +109 -106
644 lines not on this page · raw message
drivers/net/enic/base/vnic_dev.h +43 -40
150 lines not on this page · raw message
drivers/net/enic/base/vnic_devcmd.h +229 -207
838 lines not on this page · raw message
drivers/net/enic/base/vnic_enet.h +18 -18
@@ -12,25 +12,25 @@/* Device-specific region: enet configuration */ struct vnic_enet_config { -u32 flags; -u32 wq_desc_count; -u32 rq_desc_count; -u16 mtu; -u16 intr_timer_deprecated; -u8 intr_timer_type; -u8 intr_mode; +uint32_t flags; +uint32_t wq_desc_count; +uint32_t rq_desc_count; +uint16_t mtu; +uint16_t intr_timer_deprecated; +uint8_t intr_timer_type; +uint8_t intr_mode;char devname[16 ]; -u32 intr_timer_usec; -u16 loop_tag; -u16 vf_rq_count; -u16 num_arfs; -u64 mem_paddr; -u16 rdma_qp_id; -u16 rdma_qp_count; -u16 rdma_resgrp; -u32 rdma_mr_id; -u32 rdma_mr_count; -u32 max_pkt_size; +uint32_t intr_timer_usec; +uint16_t loop_tag; +uint16_t vf_rq_count; +uint16_t num_arfs; +uint64_t mem_paddr; +uint16_t rdma_qp_id; +uint16_t rdma_qp_count; +uint16_t rdma_resgrp; +uint32_t rdma_mr_id; +uint32_t rdma_mr_count; +uint32_t max_pkt_size; };#define VENETF_TSO 0x1/* TSO enabled */
drivers/net/enic/base/vnic_intr.c +2 -2
@@ -26,7 +26,7 @@ int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr,return 0 ; } -void vnic_intr_init (struct vnic_intr *intr,u32 coalescing_timer, +void vnic_intr_init (struct vnic_intr *intr,uint32_t coalescing_timer,unsigned int coalescing_type,unsigned int mask_on_assertion) {vnic_intr_coalescing_timer_set (intr, coalescing_timer);
@@ -36,7 +36,7 @@ void vnic_intr_init(struct vnic_intr *intr, u32 coalescing_timer, }void vnic_intr_coalescing_timer_set (struct vnic_intr *intr, -u32 coalescing_timer) +uint32_t coalescing_timer) {iowrite32 (vnic_dev_intr_coal_timer_usec_to_hw (intr->vdev, coalescing_timer), &intr->ctrl->coalescing_timer);
drivers/net/enic/base/vnic_intr.h +18 -18
@@ -14,20 +14,20 @@/* Interrupt control */ struct vnic_intr_ctrl { -u32 coalescing_timer;/* 0x00 */ -u32 pad0; -u32 coalescing_value;/* 0x08 */ -u32 pad1; -u32 coalescing_type;/* 0x10 */ -u32 pad2; -u32 mask_on_assertion;/* 0x18 */ -u32 pad3; -u32 mask;/* 0x20 */ -u32 pad4; -u32 int_credits;/* 0x28 */ -u32 pad5; -u32 int_credit_return;/* 0x30 */ -u32 pad6; +uint32_t coalescing_timer;/* 0x00 */ +uint32_t pad0; +uint32_t coalescing_value;/* 0x08 */ +uint32_t pad1; +uint32_t coalescing_type;/* 0x10 */ +uint32_t pad2; +uint32_t mask_on_assertion;/* 0x18 */ +uint32_t pad3; +uint32_t mask;/* 0x20 */ +uint32_t pad4; +uint32_t int_credits;/* 0x28 */ +uint32_t pad5; +uint32_t int_credit_return;/* 0x30 */ +uint32_t pad6; };struct vnic_intr {
@@ -57,7 +57,7 @@ static inline void vnic_intr_return_credits(struct vnic_intr *intr,#define VNIC_INTR_UNMASK_SHIFT 16#define VNIC_INTR_RESET_TIMER_SHIFT 17 -u32 int_credit_return = (credits &0xffff ) | +uint32_t int_credit_return = (credits &0xffff ) | (unmask ? (1 <<VNIC_INTR_UNMASK_SHIFT ) :0 ) | (reset_timer ? (1 <<VNIC_INTR_RESET_TIMER_SHIFT ) :0 );
@@ -78,7 +78,7 @@ static inline void vnic_intr_return_all_credits(struct vnic_intr *intr)vnic_intr_return_credits (intr, credits, unmask, reset_timer); } -static inline u32 vnic_intr_legacy_pba (u32 __iomem *legacy_pba) +static inline uint32_t vnic_intr_legacy_pba (uint32_t __iomem *legacy_pba) {/* read PBA without clearing */ return ioread32 (legacy_pba);
@@ -87,10 +87,10 @@ static inline u32 vnic_intr_legacy_pba(u32 __iomem *legacy_pba)void vnic_intr_free (struct vnic_intr *intr);int vnic_intr_alloc (struct vnic_dev *vdev,struct vnic_intr *intr,unsigned int index); -void vnic_intr_init (struct vnic_intr *intr,u32 coalescing_timer, +void vnic_intr_init (struct vnic_intr *intr,uint32_t coalescing_timer,unsigned int coalescing_type,unsigned int mask_on_assertion);void vnic_intr_coalescing_timer_set (struct vnic_intr *intr, -u32 coalescing_timer); +uint32_t coalescing_timer);void vnic_intr_clean (struct vnic_intr *intr);#endif /* _VNIC_INTR_H_ */
drivers/net/enic/base/vnic_nic.h +5 -5
@@ -36,11 +36,11 @@#define NIC_CFG_RSS_HASH_TYPE_RSVD2 (1 << 6)#define NIC_CFG_RSS_HASH_TYPE_UDP_IPV6 (1 << 7) -static inline void vnic_set_nic_cfg (u32 *nic_cfg, -u8 rss_default_cpu,u8 rss_hash_type, -u8 rss_hash_bits,u8 rss_base_cpu, -u8 rss_enable,u8 tso_ipid_split_en, -u8 ig_vlan_strip_en) +static inline void vnic_set_nic_cfg (uint32_t *nic_cfg, +uint8_t rss_default_cpu,uint8_t rss_hash_type, +uint8_t rss_hash_bits,uint8_t rss_base_cpu, +uint8_t rss_enable,uint8_t tso_ipid_split_en, +uint8_t ig_vlan_strip_en) { *nic_cfg = (rss_default_cpu &NIC_CFG_RSS_DEFAULT_CPU_MASK_FIELD ) | ((rss_hash_type & NIC_CFG_RSS_HASH_TYPE_MASK_FIELD)
drivers/net/enic/base/vnic_resource.h +11 -11
@@ -44,24 +44,24 @@ enum vnic_res_type { };struct vnic_resource_header { -u32 magic; -u32 version; +uint32_t magic; +uint32_t version; };struct mgmt_barmap_hdr { -u32 magic;/* magic number */ -u32 version;/* header format version */ -u16 lif;/* loopback lif for mgmt frames */ -u16 pci_slot;/* installed pci slot */ +uint32_t magic;/* magic number */ +uint32_t version;/* header format version */ +uint16_t lif;/* loopback lif for mgmt frames */ +uint16_t pci_slot;/* installed pci slot */ char serial[16 ];/* card serial number */ };struct vnic_resource { -u8 type; -u8 bar; -u8 pad[2 ]; -u32 bar_offset; -u32 count; +uint8_t type; +uint8_t bar; +uint8_t pad[2 ]; +uint32_t bar_offset; +uint32_t count; };#endif /* _VNIC_RESOURCE_H_ */
drivers/net/enic/base/vnic_rq.c +5 -5
@@ -47,10 +47,10 @@ void vnic_rq_init_start(struct vnic_rq *rq, unsigned int cq_index,unsigned int error_interrupt_enable, unsigned int error_interrupt_offset) { - u64 paddr; + uint64_t paddr;unsigned int count = rq->ring.desc_count; - paddr = (u64 )rq->ring.base_addr |VNIC_PADDR_TARGET ; + paddr = (uint64_t )rq->ring.base_addr |VNIC_PADDR_TARGET ;writeq (paddr, &rq->ctrl->ring_base);iowrite32 (count, &rq->ctrl->ring_size);iowrite32 (cq_index, &rq->ctrl->cq_index);
@@ -70,7 +70,7 @@ void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,unsigned int error_interrupt_enable, unsigned int error_interrupt_offset) { - u32 fetch_index = 0; + uint32_t fetch_index = 0;/* Use current fetch_index as the ring starting point */ fetch_index =ioread32 (&rq->ctrl->fetch_index);
@@ -110,7 +110,7 @@ int vnic_rq_disable(struct vnic_rq *rq)for (wait =0 ; wait <1000 ; wait++) {if (!(ioread32 (&rq->ctrl->running)))return 0 ; -udelay (10 ); +usleep (10 ); }pr_err ("Failed to disable RQ[%d]\n" , rq->index);
@@ -122,7 +122,7 @@ void vnic_rq_clean(struct vnic_rq *rq, void (*buf_clean)(struct rte_mbuf **buf)) {struct rte_mbuf **buf; -u32 fetch_index, i; +uint32_t fetch_index, i;unsigned int count = rq->ring.desc_count; buf = &rq->mbuf_ring[0 ];
drivers/net/enic/base/vnic_rq.h +31 -31
68 lines not on this page · raw message
drivers/net/enic/base/vnic_rss.h +6 -6
@@ -9,19 +9,19 @@/* RSS key array */ union vnic_rss_key {struct { -u8 b[10 ]; -u8 b_pad[6 ]; +uint8_t b[10 ]; +uint8_t b_pad[6 ]; } key[4 ]; -u64 raw[8 ]; +uint64_t raw[8 ]; };/* RSS cpu array */ union vnic_rss_cpu {struct { -u8 b[4 ]; -u8 b_pad[4 ]; +uint8_t b[4 ]; +uint8_t b_pad[4 ]; } cpu[32 ]; -u64 raw[32 ]; +uint64_t raw[32 ]; };#endif /* _VNIC_RSS_H_ */
drivers/net/enic/base/vnic_stats.h +34 -34
78 lines not on this page · raw message
drivers/net/enic/base/vnic_wq.c +3 -3
@@ -89,10 +89,10 @@ void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,unsigned int error_interrupt_enable, unsigned int error_interrupt_offset) { - u64 paddr; + uint64_t paddr;unsigned int count = wq->ring.desc_count; - paddr = (u64 )wq->ring.base_addr |VNIC_PADDR_TARGET ; + paddr = (uint64_t )wq->ring.base_addr |VNIC_PADDR_TARGET ;writeq (paddr, &wq->ctrl->ring_base);iowrite32 (count, &wq->ctrl->ring_size);iowrite32 (fetch_index, &wq->ctrl->fetch_index);
@@ -137,7 +137,7 @@ int vnic_wq_disable(struct vnic_wq *wq)for (wait =0 ; wait <1000 ; wait++) {if (!(ioread32 (&wq->ctrl->running)))return 0 ; -udelay (10 ); +usleep (10 ); }pr_err ("Failed to disable WQ[%d]\n" , wq->index);
drivers/net/enic/base/vnic_wq.h +23 -22
57 lines not on this page · raw message
drivers/net/enic/base/wq_enet_desc.h +20 -17
@@ -10,11 +10,11 @@/* Ethernet work queue descriptor: 16B */ struct wq_enet_desc { -__le64 address; -__le16 length; -__le16 mss_loopback; -__le16 header_length_flags; -__le16 vlan_tag; +uint64_t address; +uint16_t length; +uint16_t mss_loopback; +uint16_t header_length_flags; +uint16_t vlan_tag; };#define WQ_ENET_ADDR_BITS 64
@@ -39,9 +39,9 @@ struct wq_enet_desc {#define WQ_ENET_OFFLOAD_MODE_TSO 3static inline void wq_enet_desc_enc (struct wq_enet_desc *desc, -u64 address,u16 length,u16 mss,u16 header_length, -u8 offload_mode,u8 eop,u8 cq_entry,u8 fcoe_encap, -u8 vlan_tag_insert,u16 vlan_tag,u8 loopback) +uint64_t address,uint16_t length,uint16_t mss,uint16_t header_length, +uint8_t offload_mode,uint8_t eop,uint8_t cq_entry,uint8_t fcoe_encap, +uint8_t vlan_tag_insert,uint16_t vlan_tag,uint8_t loopback) { desc->address =rte_cpu_to_le_64 (address); desc->length =rte_cpu_to_le_16 (length &WQ_ENET_LEN_MASK );
@@ -58,27 +58,30 @@ static inline void wq_enet_desc_enc(struct wq_enet_desc *desc, }static inline void wq_enet_desc_dec (struct wq_enet_desc *desc, -u64 *address,u16 *length,u16 *mss,u16 *header_length, -u8 *offload_mode,u8 *eop,u8 *cq_entry,u8 *fcoe_encap, -u8 *vlan_tag_insert,u16 *vlan_tag,u8 *loopback) +uint64_t *address,uint16_t *length,uint16_t *mss, +uint16_t *header_length,uint8_t *offload_mode,uint8_t *eop, +uint8_t *cq_entry,uint8_t *fcoe_encap,uint8_t *vlan_tag_insert, +uint16_t *vlan_tag,uint8_t *loopback) { *address =rte_le_to_cpu_64 (desc->address); *length =rte_le_to_cpu_16 (desc->length) &WQ_ENET_LEN_MASK ; *mss = (rte_le_to_cpu_16 (desc->mss_loopback) >>WQ_ENET_MSS_SHIFT ) &WQ_ENET_MSS_MASK ; - *loopback = (u8)((rte_le_to_cpu_16 (desc->mss_loopback) >> + *loopback = (uint8_t )((rte_le_to_cpu_16 (desc->mss_loopback) >>WQ_ENET_LOOPBACK_SHIFT ) &1 ); *header_length =rte_le_to_cpu_16 (desc->header_length_flags) &WQ_ENET_HDRLEN_MASK ; - *offload_mode = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >> + *offload_mode = + (uint8_t )((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_HDRLEN_BITS ) &WQ_ENET_FLAGS_OM_MASK ); - *eop = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >> + *eop = (uint8_t )((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_EOP_SHIFT ) &1 ); - *cq_entry = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >> + *cq_entry = (uint8_t )((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_CQ_ENTRY_SHIFT ) &1 ); - *fcoe_encap = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >> + *fcoe_encap = (uint8_t )((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_FCOE_ENCAP_SHIFT ) &1 ); - *vlan_tag_insert = (u8)((rte_le_to_cpu_16 (desc->header_length_flags) >> + *vlan_tag_insert = + (uint8_t )((rte_le_to_cpu_16 (desc->header_length_flags) >>WQ_ENET_FLAGS_VLAN_TAG_INSERT_SHIFT ) &1 ); *vlan_tag =rte_le_to_cpu_16 (desc->vlan_tag); }
drivers/net/enic/enic.h +11 -11
@@ -64,16 +64,16 @@struct enic_fdir_node {struct rte_eth_fdir_filter filter; -u16 fltr_id; -u16 rq_index; +uint16_t fltr_id; +uint16_t rq_index; };struct enic_fdir {struct rte_eth_fdir_stats stats;struct rte_hash *hash;struct enic_fdir_node *nodes[ENICPMD_FDIR_MAX ]; -u32 modes; -u32 types_mask; +uint32_t modes; +uint32_t types_mask;void (*copy_fltr_fn)(struct filter_v2 *filt,const struct rte_eth_fdir_input *input,const struct rte_eth_fdir_masks *masks);
@@ -130,13 +130,13 @@ struct enic {pthread_t err_intr_thread;int promisc;int allmulti; -u8 ig_vlan_strip_en; +uint8_t ig_vlan_strip_en;int link_status; -u8 hw_ip_checksum; -u16 max_mtu; -u8 adv_filters; -u32 flow_filter_mode; -u8 filter_actions;/* HW supported actions */ +uint8_t hw_ip_checksum; +uint16_t max_mtu; +uint8_t adv_filters; +uint32_t flow_filter_mode; +uint8_t filter_actions;/* HW supported actions */ bool vxlan;bool disable_overlay;/* devargs disable_overlay=1 */ uint8_t enable_avx2_rx;/* devargs enable-avx2-rx=1 */
@@ -339,7 +339,7 @@ void enic_clsf_destroy(struct enic *enic);int enic_fm_init (struct enic *enic);void enic_fm_destroy (struct enic *enic);void *enic_alloc_consistent (void *priv,size_t size,dma_addr_t *dma_handle, -u8 *name); +uint8_t *name);void enic_free_consistent (void *priv,size_t size,void *vaddr,dma_addr_t dma_handle); uint16_t enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/enic/enic_clsf.c +7 -7
@@ -55,7 +55,7 @@ void enic_fdir_info_get(struct enic *enic, struct rte_eth_fdir_info *info)void enic_fdir_info (struct enic *enic) { - enic->fdir.modes = (u32 )RTE_FDIR_MODE_PERFECT ; + enic->fdir.modes = (uint32_t )RTE_FDIR_MODE_PERFECT ; enic->fdir.types_mask =1 <<RTE_ETH_FLOW_NONFRAG_IPV4_UDP |1 <<RTE_ETH_FLOW_NONFRAG_IPV4_TCP ;if (enic->adv_filters) {
@@ -337,11 +337,11 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)struct enic_fdir_node *key;struct filter_v2 fltr;int32_t pos; -u8 do_free =0 ; -u16 old_fltr_id =0 ; -u32 flowtype_supported; -u16 flex_bytes; -u16 queue; +uint8_t do_free =0 ; +uint16_t old_fltr_id =0 ; +uint32_t flowtype_supported; +uint16_t flex_bytes; +uint16_t queue;struct filter_action_v2 action;memset (&fltr,0 ,sizeof (fltr));
@@ -464,7 +464,7 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params)void enic_clsf_destroy (struct enic *enic) { -u32 index; +uint32_t index;struct enic_fdir_node *key;/* delete classifier entries */ for (index =0 ; index <ENICPMD_FDIR_MAX ; index++) {
drivers/net/enic/enic_compat.h +0 -22
@@ -14,30 +14,16 @@#include <rte_log.h> #include <rte_io.h> -#define ENIC_PAGE_ALIGN 4096UL -#define ENIC_ALIGN ENIC_PAGE_ALIGN#define ETH_ALEN 6#define __iomem -#define rmb () rte_rmb()/* dpdk rte provided rmb */ -#define wmb () rte_wmb()/* dpdk rte provided wmb */ - -#ifndef offsetof -#define offsetof (t, m) ((size_t) &((t *)0)->m) -#endif - #define pr_err(y, args...) dev_err(0, y, ##args) #define pr_warn(y, args...) dev_warning(0, y, ##args)#define BUG () pr_err("BUG at %s:%d", __func__, __LINE__)#define VNIC_ALIGN (x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)#define __ALIGN_MASK (x, mask) (((x)+(mask))&~(mask)) -#define udelay usleep -#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) - -#define kzalloc (size, flags) calloc(1, size) -#define kfree (x) free(x)extern int enic_pmd_logtype;
@@ -55,14 +41,6 @@ extern int enic_pmd_logtype; "%s " fmt "\n", __func__, ##args)#define ENICPMD_FUNC_TRACE () ENICPMD_LOG(DEBUG, ">>") -#define __le16 u16 -#define __le32 u32 -#define __le64 u64 - -typedef unsigned char u8 ; -typedef unsigned short u16 ; -typedef unsigned int u32 ; -typedef unsigned long long u64 ;typedef unsigned long long dma_addr_t ;static inline uint32_t ioread32 (volatile void *addr)
drivers/net/enic/enic_flow.c +13 -13
@@ -47,7 +47,7 @@ struct enic_items {/** True if it's OK for this item to be the first item. For some NIC * versions, it's invalid to start the stack above layer 3. */ -const u8 valid_start_item; +const uint8_t valid_start_item;/* Inner packet version of copy_item. */ enic_copy_item_fn *inner_copy_item; };
@@ -370,7 +370,7 @@ static const struct enic_action_cap enic_action_cap[] = { };static int -mask_exact_match (const u8 *supported,const u8 *supplied, +mask_exact_match (const uint8_t *supported,const uint8_t *supplied,unsigned int size) {unsigned int i;
@@ -406,8 +406,8 @@ enic_copy_item_ipv4_v1(struct copy_item_args *arg) }/* check that the suppied mask exactly matches capabilty */ -if (!mask_exact_match ((const u8 *)&supported_mask, - (const u8 *)item->mask,sizeof (*mask))) { +if (!mask_exact_match ((const uint8_t *)&supported_mask, + (const uint8_t *)item->mask,sizeof (*mask))) {ENICPMD_LOG (ERR ,"IPv4 exact match mask" );return ENOTSUP ; }
@@ -444,8 +444,8 @@ enic_copy_item_udp_v1(struct copy_item_args *arg) }/* check that the suppied mask exactly matches capabilty */ -if (!mask_exact_match ((const u8 *)&supported_mask, - (const u8 *)item->mask,sizeof (*mask))) { +if (!mask_exact_match ((const uint8_t *)&supported_mask, + (const uint8_t *)item->mask,sizeof (*mask))) {ENICPMD_LOG (ERR ,"UDP exact match mask" );return ENOTSUP ; }
@@ -483,8 +483,8 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg) }/* check that the suppied mask exactly matches capabilty */ -if (!mask_exact_match ((const u8 *)&supported_mask, - (const u8 *)item->mask,sizeof (*mask))) { +if (!mask_exact_match ((const uint8_t *)&supported_mask, + (const uint8_t *)item->mask,sizeof (*mask))) {ENICPMD_LOG (ERR ,"TCP exact match mask" );return ENOTSUP ; }
@@ -995,7 +995,7 @@ enic_copy_item_raw_v2(struct copy_item_args *arg)*/ static int item_stacking_valid (enum rte_flow_item_type prev_item, -const struct enic_items *item_info,u8 is_first_item) +const struct enic_items *item_info,uint8_t is_first_item) {enum rte_flow_item_type const *allowed_items = item_info->prev_items;
@@ -1063,12 +1063,12 @@ enic_copy_filter(const struct rte_flow_item pattern[], {int ret;const struct rte_flow_item *item = pattern; -u8 inner_ofst =0 ;/* If encapsulated, ofst into L5 */ +uint8_t inner_ofst =0 ;/* If encapsulated, ofst into L5 */ enum rte_flow_item_type prev_item;const struct enic_items *item_info;struct copy_item_args args;enic_copy_item_fn *copy_fn; -u8 is_first_item =1 ; +uint8_t is_first_item =1 ;ENICPMD_FUNC_TRACE ();
@@ -1618,7 +1618,7 @@ enic_flow_add_filter(struct enic *enic, struct filter_v2 *enic_filter, {struct rte_flow *flow;int err; -u16 entry; +uint16_t entry;ENICPMD_FUNC_TRACE ();
@@ -1660,7 +1660,7 @@ static int enic_flow_del_filter(struct enic *enic, struct rte_flow *flow, struct rte_flow_error *error) { - u16 filter_id; + uint16_t filter_id;int err;ENICPMD_FUNC_TRACE ();
drivers/net/enic/enic_fm_flow.c +14 -14
@@ -631,7 +631,7 @@ enic_fet_alloc(struct enic_flowman *fm, uint8_t ingress,struct fm_exact_match_table *cmd;struct fm_header_set *hdr;struct enic_fm_fet *fet; -u64 args[3 ]; +uint64_t args[3 ];int ret;ENICPMD_FUNC_TRACE ();
@@ -1068,7 +1068,7 @@ enic_fm_find_vnic(struct enic *enic, const struct rte_pci_addr *addr, uint64_t *handle) {uint32_t bdf; -u64 args[2 ]; +uint64_t args[2 ];int rc;ENICPMD_FUNC_TRACE ();
@@ -1602,7 +1602,7 @@ enic_fm_more_counters(struct enic_flowman *fm)struct enic_fm_counter *ctrs;struct enic *enic;int i, rc; -u64 args[2 ]; +uint64_t args[2 ];ENICPMD_FUNC_TRACE (); enic = fm->enic;
@@ -1638,7 +1638,7 @@ static int enic_fm_counter_zero(struct enic_flowman *fm, struct enic_fm_counter *c) { struct enic *enic; -u64 args[3 ]; +uint64_t args[3 ];int ret;ENICPMD_FUNC_TRACE ();
@@ -1680,7 +1680,7 @@ enic_fm_counter_alloc(struct enic_flowman *fm, struct rte_flow_error *error,static int enic_fm_action_free (struct enic_flowman *fm,uint64_t handle) { -u64 args[2 ]; +uint64_t args[2 ];int rc;ENICPMD_FUNC_TRACE ();
@@ -1696,7 +1696,7 @@ enic_fm_action_free(struct enic_flowman *fm, uint64_t handle)static int enic_fm_entry_free (struct enic_flowman *fm,uint64_t handle) { -u64 args[2 ]; +uint64_t args[2 ];int rc;ENICPMD_FUNC_TRACE ();
@@ -1795,7 +1795,7 @@ enic_fm_add_tcam_entry(struct enic_flowman *fm, struct rte_flow_error *error) {struct fm_tcam_match_entry *ftm; -u64 args[3 ]; +uint64_t args[3 ];int ret;ENICPMD_FUNC_TRACE ();
@@ -1828,7 +1828,7 @@ enic_fm_add_exact_entry(struct enic_flowman *fm, struct rte_flow_error *error) {struct fm_exact_match_entry *fem; -u64 args[3 ]; +uint64_t args[3 ];int ret;ENICPMD_FUNC_TRACE ();
@@ -1886,7 +1886,7 @@ __enic_fm_flow_add_entry(struct enic_flowman *fm,struct fm_action *fma;uint64_t action_h;uint64_t entry_h; -u64 args[3 ]; +uint64_t args[3 ];int ret;ENICPMD_FUNC_TRACE ();
@@ -2088,7 +2088,7 @@ enic_fm_flow_query_count(struct rte_eth_dev *dev,struct rte_flow_query_count *query;struct enic_fm_flow *fm_flow;struct enic *enic; -u64 args[3 ]; +uint64_t args[3 ];int rc;ENICPMD_FUNC_TRACE ();
@@ -2252,7 +2252,7 @@ enic_fm_flow_flush(struct rte_eth_dev *dev,static int enic_fm_tbl_free (struct enic_flowman *fm,uint64_t handle) { -u64 args[2 ]; +uint64_t args[2 ];int rc; args[0 ] =FM_MATCH_TABLE_FREE ;
@@ -2270,7 +2270,7 @@ enic_fm_tcam_tbl_alloc(struct enic_flowman *fm, uint32_t direction, {struct fm_tcam_match_table *tcam_tbl;struct enic *enic; -u64 args[2 ]; +uint64_t args[2 ];int rc;ENICPMD_FUNC_TRACE ();
@@ -2305,7 +2305,7 @@ static void enic_fm_free_all_counters(struct enic_flowman *fm) {struct enic *enic; -u64 args[2 ]; +uint64_t args[2 ];int rc; enic = fm->enic;
@@ -2354,7 +2354,7 @@ int enic_fm_init(struct enic *enic) {struct enic_flowman *fm; -u8 name[RTE_MEMZONE_NAMESIZE ]; +uint8_t name[RTE_MEMZONE_NAMESIZE ];int rc;if (enic->flow_filter_mode !=FILTER_FLOWMAN )
drivers/net/enic/enic_main.c +13 -12
@@ -79,7 +79,7 @@ static void enic_free_wq_buf(struct rte_mbuf **buf)static void enic_log_q_error (struct enic *enic) {unsigned int i; -u32 error_status; +uint32_t error_status;for (i =0 ; i < enic->wq_count; i++) { error_status =vnic_wq_error_status (&enic->wq[i]);
@@ -264,7 +264,7 @@ void enic_init_vnic_resources(struct enic *enic)0 /* cq_entry_enable */ ,1 /* cq_message_enable */ ,0 /* interrupt offset */ , - (u64)enic->wq[index].cqmsg_rz->iova); + (uint64_t)enic->wq[index].cqmsg_rz->iova); }for (index =0 ; index < enic->intr_count; index++) {
@@ -359,7 +359,7 @@ enic_initial_post_rx(struct enic *enic, struct vnic_rq *rq)void *enic_alloc_consistent (void *priv,size_t size, -dma_addr_t *dma_handle,u8 *name) +dma_addr_t *dma_handle,uint8_t *name) {void *vaddr;const struct rte_memzone *rz;
@@ -368,7 +368,7 @@ enic_alloc_consistent(void *priv, size_t size,struct enic_memzone_entry *mze; rz =rte_memzone_reserve_aligned ((const char *)name, size, -SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG ,ENIC_ALIGN ); +SOCKET_ID_ANY ,RTE_MEMZONE_IOVA_CONTIG ,ENIC_PAGE_SIZE );if (!rz) {pr_err ("%s : Failed to allocate memory requested for %s\n" , __func__, name);
@@ -1044,7 +1044,7 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx, wq->cqmsg_rz =rte_memzone_reserve_aligned ((const char *)name,sizeof (uint32_t ),SOCKET_ID_ANY , -RTE_MEMZONE_IOVA_CONTIG ,ENIC_ALIGN ); +RTE_MEMZONE_IOVA_CONTIG ,ENIC_PAGE_SIZE );if (!wq->cqmsg_rz)return -ENOMEM ;
@@ -1154,7 +1154,7 @@ static int enic_set_rsskey(struct enic *enic, uint8_t *user_key)dma_addr_t rss_key_buf_pa;union vnic_rss_key *rss_key_buf_va =NULL ;int err, i; -u8 name[RTE_MEMZONE_NAMESIZE ]; +uint8_t name[RTE_MEMZONE_NAMESIZE ];RTE_ASSERT (user_key !=NULL );snprintf ((char *)name,sizeof (name),"rss_key-%s" , enic->bdf_name);
@@ -1186,7 +1186,7 @@ int enic_set_rss_reta(struct enic *enic, union vnic_rss_cpu *rss_cpu)dma_addr_t rss_cpu_buf_pa;union vnic_rss_cpu *rss_cpu_buf_va =NULL ;int err; -u8 name[RTE_MEMZONE_NAMESIZE ]; +uint8_t name[RTE_MEMZONE_NAMESIZE ];snprintf ((char *)name,sizeof (name),"rss_cpu-%s" , enic->bdf_name); rss_cpu_buf_va = enic_alloc_consistent(enic, sizeof(union vnic_rss_cpu),
@@ -1209,10 +1209,11 @@ int enic_set_rss_reta(struct enic *enic, union vnic_rss_cpu *rss_cpu)return err; } -static int enic_set_niccfg (struct enic *enic,u8 rss_default_cpu, -u8 rss_hash_type,u8 rss_hash_bits,u8 rss_base_cpu,u8 rss_enable) +static int enic_set_niccfg (struct enic *enic,uint8_t rss_default_cpu, +uint8_t rss_hash_type,uint8_t rss_hash_bits,uint8_t rss_base_cpu, +uint8_t rss_enable) { -const u8 tso_ipid_split_en =0 ; +const uint8_t tso_ipid_split_en =0 ;int err; err = enic_set_nic_cfg(enic,
@@ -1308,8 +1309,8 @@ int enic_set_rss_conf(struct enic *enic, struct rte_eth_rss_conf *rss_conf) {struct rte_eth_dev *eth_dev;uint64_t rss_hf; -u8 rss_hash_type; -u8 rss_enable; +uint8_t rss_hash_type; +uint8_t rss_enable;int ret;RTE_ASSERT (rss_conf !=NULL );
drivers/net/enic/enic_res.c +17 -16
@@ -68,8 +68,8 @@ int enic_get_vnic_config(struct enic *enic)if (c->mtu ==0 ) c->mtu =1500 ; - enic->rte_dev->data->mtu =min_t (u16, enic->max_mtu, -max_t (u16,ENIC_MIN_MTU , c->mtu)); + enic->rte_dev->data->mtu =min_t (uint16_t, enic->max_mtu, +max_t (uint16_t,ENIC_MIN_MTU , c->mtu)); enic->adv_filters =vnic_dev_capable_adv_filters (enic->vdev); dev_info(enic, "Advanced Filters %savailable\n", ((enic->adv_filters)
@@ -101,18 +101,18 @@ int enic_get_vnic_config(struct enic *enic) "count " : "")); c->wq_desc_count = -min_t (u32,ENIC_MAX_WQ_DESCS , -max_t (u32,ENIC_MIN_WQ_DESCS , +min_t (uint32_t,ENIC_MAX_WQ_DESCS , +max_t (uint32_t,ENIC_MIN_WQ_DESCS , c->wq_desc_count)); c->wq_desc_count &=0xffffffe0 ;/* must be aligned to groups of 32 */ c->rq_desc_count = -min_t (u32,ENIC_MAX_RQ_DESCS , -max_t (u32,ENIC_MIN_RQ_DESCS , +min_t (uint32_t,ENIC_MAX_RQ_DESCS , +max_t (uint32_t,ENIC_MIN_RQ_DESCS , c->rq_desc_count)); c->rq_desc_count &=0xffffffe0 ;/* must be aligned to groups of 32 */ - c->intr_timer_usec =min_t (u32, c->intr_timer_usec, + c->intr_timer_usec =min_t (uint32_t, c->intr_timer_usec,vnic_dev_get_intr_coal_timer_max (enic->vdev)); dev_info(enic_get_dev(enic),
@@ -218,13 +218,14 @@ int enic_get_vnic_config(struct enic *enic)return 0 ; } -int enic_set_nic_cfg (struct enic *enic,u8 rss_default_cpu,u8 rss_hash_type, -u8 rss_hash_bits,u8 rss_base_cpu,u8 rss_enable,u8 tso_ipid_split_en, -u8 ig_vlan_strip_en) +int enic_set_nic_cfg (struct enic *enic,uint8_t rss_default_cpu, +uint8_t rss_hash_type,uint8_t rss_hash_bits, +uint8_t rss_base_cpu,uint8_t rss_enable, +uint8_t tso_ipid_split_en,uint8_t ig_vlan_strip_en) {enum vnic_devcmd_cmd cmd; -u64 a0, a1; -u32 nic_cfg; +uint64_t a0, a1; +uint32_t nic_cfg;int wait =1000 ; vnic_set_nic_cfg(&nic_cfg, rss_default_cpu,
@@ -237,17 +238,17 @@ int enic_set_nic_cfg(struct enic *enic, u8 rss_default_cpu, u8 rss_hash_type,return vnic_dev_cmd (enic->vdev, cmd, &a0, &a1, wait); } -int enic_set_rss_key (struct enic *enic,dma_addr_t key_pa,u64 len) +int enic_set_rss_key (struct enic *enic,dma_addr_t key_pa,uint64_t len) { -u64 a0 = (u64 )key_pa, a1 = len; +uint64_t a0 = (uint64_t )key_pa, a1 = len;int wait =1000 ;return vnic_dev_cmd (enic->vdev,CMD_RSS_KEY , &a0, &a1, wait); } -int enic_set_rss_cpu (struct enic *enic,dma_addr_t cpu_pa,u64 len) +int enic_set_rss_cpu (struct enic *enic,dma_addr_t cpu_pa,uint64_t len) { -u64 a0 = (u64 )cpu_pa, a1 = len; +uint64_t a0 = (uint64_t )cpu_pa, a1 = len;int wait =1000 ;return vnic_dev_cmd (enic->vdev,CMD_RSS_CPU , &a0, &a1, wait);
drivers/net/enic/enic_res.h +6 -5
@@ -59,11 +59,12 @@struct enic ;int enic_get_vnic_config (struct enic *); -int enic_set_nic_cfg (struct enic *enic,u8 rss_default_cpu,u8 rss_hash_type, -u8 rss_hash_bits,u8 rss_base_cpu,u8 rss_enable,u8 tso_ipid_split_en, -u8 ig_vlan_strip_en); -int enic_set_rss_key (struct enic *enic,dma_addr_t key_pa,u64 len); -int enic_set_rss_cpu (struct enic *enic,dma_addr_t cpu_pa,u64 len); +int enic_set_nic_cfg (struct enic *enic,uint8_t rss_default_cpu, +uint8_t rss_hash_type,uint8_t rss_hash_bits, +uint8_t rss_base_cpu,uint8_t rss_enable, +uint8_t tso_ipid_split_en,uint8_t ig_vlan_strip_en); +int enic_set_rss_key (struct enic *enic,dma_addr_t key_pa,uint64_t len); +int enic_set_rss_cpu (struct enic *enic,dma_addr_t cpu_pa,uint64_t len);void enic_get_res_counts (struct enic *enic);void enic_init_vnic_resources (struct enic *enic);int enic_alloc_vnic_resources (struct enic *);
drivers/net/enic/enic_rxtx.c +3 -2
@@ -329,7 +329,8 @@ enic_noscatter_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,return rx - rx_pkts; } -static inline void enic_free_wq_bufs (struct vnic_wq *wq,u16 completed_index) +static inline void enic_free_wq_bufs (struct vnic_wq *wq, +uint16_t completed_index) {struct rte_mbuf *buf;struct rte_mbuf *m, *free[ENIC_MAX_WQ_DESCS ];
@@ -371,7 +372,7 @@ static inline void enic_free_wq_bufs(struct vnic_wq *wq, u16 completed_index) unsigned int enic_cleanup_wq(__rte_unused struct enic *enic, struct vnic_wq *wq) { -u16 completed_index; +uint16_t completed_index; completed_index = *((uint32_t *)wq->cqmsg_rz->addr) &0xffff ;
Signature · 1 line
2.22.0
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH] net/enic: consolidate and remove some defines
Quoted 7 lines · John Daley
There were defines which originally allowed sharing of some code with the enic kernel driver. The code has long since diverged and now the abstraction just makes the code harder to read. Mostly mechanical replacement of defines and reformatting.
Signed-off-by John Daley <[email protected]>Reviewed-by Hyong Youb Kim <[email protected]>
Applied to dpdk-next-net/master, thanks.
PATCH 1/1 net/enic: move macro to the correct file
In reply to John DaleyMove a macro from a widely included header file to a header file used only by the one caller of the macro.
--- drivers/net/enic/enic_compat.h | 10 ---------- drivers/net/enic/enic_res.h | 11 ++++++++++- 2 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/enic/enic_compat.h +0 -10
@@ -73,14 +73,4 @@ static inline void writel(unsigned int val, volatile void __iomem *addr) rte_write32(val, addr); } -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) -#endif /* _ENIC_COMPAT_H_ */
drivers/net/enic/enic_res.h +10 -1
@@ -11,6 +11,16 @@#include "vnic_wq.h" #include "vnic_rq.h" +#define min_t (type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1 : __min2; }) + +#define max_t (type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1 : __max2; }) +#define ENIC_MIN_WQ_DESCS 64#define ENIC_MAX_WQ_DESCS 4096#define ENIC_MIN_RQ_DESCS 64
@@ -55,7 +65,6 @@#define ENIC_SETTING (enic, f) ((enic->config.flags & VENETF_##f) ? 1 : 0) -struct enic ;int enic_get_vnic_config (struct enic *);
Signature · 1 line
2.22.0
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH] net/enic: move macro to the correct file
Quoted 5 lines · John Daley
Move a macro from a widely included header file to a header file used only by the one caller of the macro.
Signed-off-by John Daley <[email protected]>Reviewed-by Hyong Youb Kim <[email protected]>
Applied to dpdk-next-net/master, thanks.
Re: [dpdk-dev] [PATCH] net/enic: move macro to the correct file
In reply to John Daley14/01/2020 01:24, John Daley:
drivers/net/enic/enic_res.h line 22
Quoted 9 lines
drivers/net/enic/enic_res.h +9
-0+#define min_t (type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1 : __min2; }) + +#define max_t (type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1 : __max2; })
Why not using RTE_MIN/RTE_MAX which use typeof?
You need to specify a type?
Re: [dpdk-dev] [PATCH] net/enic: move macro to the correct file
You are right, just need to cast #define parameters, then can use the RTE_MIN and MAX. Will do a patch.
Thanks,
john
Quoted 22 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Sunday, January 19, 2020 12:24 PM
To: John Daley (johndale) <[email protected]>; Hyong Youb Kim (hyonkim) <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/enic: move macro to the correct file14/01/2020 01:24, John Daley:
drivers/net/enic/enic_res.h line 22
Quoted 9 lines
drivers/net/enic/enic_res.h +9
-0+#define min_t (type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1 : __min2; }) + +#define max_t (type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1 : __max2; })Why not using RTE_MIN/RTE_MAX which use typeof? You need to specify a type?
PATCH v2 1/1 net/enic: use RTE min and max macros
In reply to John DaleyUse the RTE_MIN and RTE_MAX macros instead of private macros.
---
v2 - remove the min_t and max_t macros all together
drivers/net/enic/enic_compat.h | 10 ---------- drivers/net/enic/enic_res.c | 20 ++++++++------------ 2 files changed, 8 insertions(+), 22 deletions(-)
drivers/net/enic/enic_compat.h +0 -10
@@ -73,14 +73,4 @@ static inline void writel(unsigned int val, volatile void __iomem *addr) rte_write32(val, addr); } -#define min_t (type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t (type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) -#endif /* _ENIC_COMPAT_H_ */
drivers/net/enic/enic_res.c +8 -12
@@ -68,8 +68,8 @@ int enic_get_vnic_config(struct enic *enic)if (c->mtu ==0 ) c->mtu =1500 ; - enic->rte_dev->data->mtu =min_t (uint16_t, enic->max_mtu, -max_t (uint16_t,ENIC_MIN_MTU , c->mtu)); + enic->rte_dev->data->mtu =RTE_MIN (enic->max_mtu, +RTE_MAX ((uint16_t )ENIC_MIN_MTU , c->mtu)); enic->adv_filters =vnic_dev_capable_adv_filters (enic->vdev); dev_info(enic, "Advanced Filters %savailable\n", ((enic->adv_filters)
@@ -100,20 +100,16 @@ int enic_get_vnic_config(struct enic *enic) ((enic->filter_actions &FILTER_ACTION_COUNTER_FLAG ) ? "count " : "")); - c->wq_desc_count = -min_t (uint32_t,ENIC_MAX_WQ_DESCS , -max_t (uint32_t,ENIC_MIN_WQ_DESCS , - c->wq_desc_count)); + c->wq_desc_count =RTE_MIN ((uint32_t )ENIC_MAX_WQ_DESCS , +RTE_MAX ((uint32_t )ENIC_MIN_WQ_DESCS , c->wq_desc_count)); c->wq_desc_count &=0xffffffe0 ;/* must be aligned to groups of 32 */ - c->rq_desc_count = -min_t (uint32_t,ENIC_MAX_RQ_DESCS , -max_t (uint32_t,ENIC_MIN_RQ_DESCS , - c->rq_desc_count)); + c->rq_desc_count =RTE_MIN ((uint32_t )ENIC_MAX_RQ_DESCS , +RTE_MAX ((uint32_t )ENIC_MIN_RQ_DESCS , c->rq_desc_count)); c->rq_desc_count &=0xffffffe0 ;/* must be aligned to groups of 32 */ - c->intr_timer_usec =min_t (uint32_t, c->intr_timer_usec, -vnic_dev_get_intr_coal_timer_max (enic->vdev)); + c->intr_timer_usec =RTE_MIN (c->intr_timer_usec, +vnic_dev_get_intr_coal_timer_max (enic->vdev));dev_info (enic_get_dev (enic), "vNIC MAC addr %02x:%02x:%02x:%02x:%02x:%02x "
Signature · 1 line
2.22.0
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH v2] net/enic: use RTE min and max macros
Quoted 4 lines · John Daley
Use the
RTE_MINandRTE_MAXmacros instead of private macros.Signed-off-by John Daley <[email protected]>Reviewed-by Hyong Youb Kim <[email protected]>
Applied to dpdk-next-net/master, thanks.
(Applied as incremental patch, instead of v2, since v1 is already in main repo)
Ferruh Yigit
AppliedQuoted 7 lines · John Daley
Use the memzone namesize, Ethernet address length defines from the RTE header files instead of locally defined versions.
Use the RTE byte swap functions instead of the x86 specific locally defined versions.Signed-off-by John Daley <[email protected]>Reviewed-by Hyong Youb Kim <[email protected]>
Applied to dpdk-next-net/master, thanks.