net/enic: do not use non-standard integer types
PATCH 1/6 net/enic: do not use non-standard integer types
From: Hyong Youb Kim <[email protected]>
Bugzilla ID: 39
--- drivers/net/enic/base/vnic_devcmd.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/enic/base/vnic_devcmd.h +8 -8
@@ -875,7 +875,7 @@ struct filter_action_v2 {u32 rq_idx;u32 flags;/* use FILTER_ACTION_XXX_FLAG defines */ u16 filter_id; -u_int8_t reserved[32 ];/* for future expansion */ +uint8_t reserved[32 ];/* for future expansion */ } __attribute__((packed));/* Specifies the filter type. */
@@ -941,9 +941,9 @@ enum { };struct filter_tlv { -u_int32_t type; -u_int32_t length; -u_int32_t val[0 ]; +uint32_t type; +uint32_t length; +uint32_t val[0 ]; };/* Data for CMD_ADD_FILTER is 2 TLV and filter + action structs */
@@ -957,10 +957,10 @@ struct filter_tlv {* drivers should use this instead of "sizeof (struct filter_v2)" when * computing length for TLV. */ -static inline u_int32_t +static inline uint32_t vnic_filter_size (struct filter_v2 *fp) { -u_int32_t size; +uint32_t size;switch (fp->type) {case FILTER_USNIC_ID :
@@ -999,10 +999,10 @@ enum {* drivers should use this instead of "sizeof (struct filter_action_v2)" * when computing length for TLV. */ -static inline u_int32_t +static inline uint32_t vnic_action_size (struct filter_action_v2 *fap) { -u_int32_t size; +uint32_t size;switch (fap->type) {case FILTER_ACTION_RQ_STEERING :
Signature · 1 line
2.16.2
PATCH 2/6 net/enic: enable IOVA mode
From: Hyong Youb Kim <[email protected]>
Cisco VIC models support RTE_IOVA_VA, so enable it. This change allows the driver to work properly when --no-huge is used, in combination with vfio and iommu.
--- drivers/net/enic/enic_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/enic/enic_ethdev.c +2 -1
@@ -1044,7 +1044,8 @@ static int eth_enic_pci_remove(struct rte_pci_device *pci_dev)static struct rte_pci_driver rte_enic_pmd = { .id_table = pci_id_enic_map, - .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC , + .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC | +RTE_PCI_DRV_IOVA_AS_VA , .probe = eth_enic_pci_probe, .remove = eth_enic_pci_remove, };
Signature · 1 line
2.16.2
PATCH 3/6 net/enic: set Rx VLAN offload flag for non-stripped packets
In reply to John DaleyFrom: Hyong Youb Kim <[email protected]>
The NIC indicates VLAN TCI to the driver even when VLAN stripping is disabled. The driver sets mbuf's vlan_tci but not PKT_RX_VLAN. Set PKT_RX_VLAN to indicate that vlan_tci is valid.
--- drivers/net/enic/enic_rxtx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/enic/enic_rxtx.c +4 -2
@@ -233,10 +233,12 @@ enic_cq_rx_to_pkt_flags(struct cq_desc *cqd, struct rte_mbuf *mbuf) pkt_flags |=PKT_RX_VLAN |PKT_RX_VLAN_STRIPPED ; mbuf->packet_type |=RTE_PTYPE_L2_ETHER ; }else { -if (vlan_tci !=0 ) +if (vlan_tci !=0 ) { + pkt_flags |=PKT_RX_VLAN ; mbuf->packet_type |=RTE_PTYPE_L2_ETHER_VLAN ; -else + }else { mbuf->packet_type |=RTE_PTYPE_L2_ETHER ; + } } mbuf->vlan_tci = vlan_tci;
Signature · 1 line
2.16.2
PATCH 4/6 net/enic: do not use deprecated Tx VLAN packet flag
In reply to John DaleyFrom: Hyong Youb Kim <[email protected]>
Replace PKT_TX_VLAN_PKT (deprecated) with PKT_TX_VLAN.
--- drivers/net/enic/enic_res.c | 2 +- drivers/net/enic/enic_rxtx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/enic/enic_res.c +1 -1
@@ -200,7 +200,7 @@ int enic_get_vnic_config(struct enic *enic)DEV_RX_OFFLOAD_UDP_CKSUM |DEV_RX_OFFLOAD_TCP_CKSUM ; enic->tx_offload_mask = -PKT_TX_VLAN_PKT | +PKT_TX_VLAN |PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG ;
drivers/net/enic/enic_rxtx.c +2 -2
@@ -709,7 +709,7 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, wq_desc_avail =vnic_wq_desc_avail (wq); head_idx = wq->head_idx; desc_count = wq->ring.desc_count; - ol_flags_mask =PKT_TX_VLAN_PKT |PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ; + ol_flags_mask =PKT_TX_VLAN |PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ; tx_oversized = &enic->soft_stats.tx_oversized; nb_pkts =RTE_MIN (nb_pkts,ENIC_TX_XMIT_MAX );
@@ -737,7 +737,7 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, mss =0 ; vlan_id = tx_pkt->vlan_tci; - vlan_tag_insert = !!(ol_flags &PKT_TX_VLAN_PKT ); + vlan_tag_insert = !!(ol_flags &PKT_TX_VLAN ); bus_addr = (dma_addr_t) (tx_pkt->buf_iova + tx_pkt->data_off);
Signature · 1 line
2.16.2
PATCH 5/6 net/enic: add VLAN and csum offloads to simple Tx handler
In reply to John DaleyFrom: Hyong Youb Kim <[email protected]>
Currently the simple Tx handler supports no offloads, which makes it usable only for a small number of benchmarks. Add vlan and checksum offloads to the handler, as cycles/packet increases only by about 3 cycles, and applications commonly use those offloads.
--- drivers/net/enic/enic_main.c | 14 +++++++++++--- drivers/net/enic/enic_rxtx.c | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-)
drivers/net/enic/enic_main.c +11 -3
@@ -534,6 +534,7 @@ int enic_enable(struct enic *enic)unsigned int index;int err;struct rte_eth_dev *eth_dev = enic->rte_dev; +uint64_t simple_tx_offloads; eth_dev->data->dev_link.link_speed =vnic_dev_port_speed (enic->vdev); eth_dev->data->dev_link.link_duplex =ETH_LINK_FULL_DUPLEX ;
@@ -572,10 +573,17 @@ int enic_enable(struct enic *enic) }/* -* Use the simple TX handler if possible. All offloads must be -* disabled. +* Use the simple TX handler if possible. Only checksum offloads +* and vlan insertion are supported. */ -if (eth_dev->data->dev_conf.txmode.offloads ==0 ) { + simple_tx_offloads = enic->tx_offload_capa & + (DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | +DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM ); +if ((eth_dev->data->dev_conf.txmode.offloads & + ~simple_tx_offloads) ==0 ) {PMD_INIT_LOG (DEBUG ," use the simple tx handler" ); eth_dev->tx_pkt_burst = &enic_simple_xmit_pkts;for (index =0 ; index < enic->wq_count; index++)
drivers/net/enic/enic_rxtx.c +21 -0
@@ -842,12 +842,33 @@ static void enqueue_simple_pkts(struct rte_mbuf **pkts, struct enic *enic) {struct rte_mbuf *p; +uint16_t mss;while (n) { n--; p = *pkts++; desc->address = p->buf_iova + p->data_off; desc->length = p->pkt_len; +/* VLAN insert */ + desc->vlan_tag = p->vlan_tci; + desc->header_length_flags &= + ((1 <<WQ_ENET_FLAGS_EOP_SHIFT ) | + (1 <<WQ_ENET_FLAGS_CQ_ENTRY_SHIFT )); +if (p->ol_flags &PKT_TX_VLAN ) { + desc->header_length_flags |= +1 <<WQ_ENET_FLAGS_VLAN_TAG_INSERT_SHIFT ; + } +/* +* Checksum offload. We use WQ_ENET_OFFLOAD_MODE_CSUM, which +* is 0, so no need to set offload_mode. +*/ + mss =0 ; +if (p->ol_flags &PKT_TX_IP_CKSUM ) + mss |=ENIC_CALC_IP_CKSUM <<WQ_ENET_MSS_SHIFT ; +if (p->ol_flags &PKT_TX_L4_MASK ) + mss |=ENIC_CALC_TCP_UDP_CKSUM <<WQ_ENET_MSS_SHIFT ; + desc->mss_loopback = mss; +/* * The app should not send oversized * packets. tx_pkt_prepare includes a check as
Signature · 1 line
2.16.2
PATCH 6/6 net/enic: explicitly disable overlay offload
In reply to John DaleyFrom: Hyong Youb Kim <[email protected]>
Reopening vNIC does not automatically disable overlay offload. If it is previously enabled, it remains enabled even when the user restarts DPDK and requests overlay offload to be disabled via devarg disable-overlay=1. So explicitly disable overlay offload when requested.
--- drivers/net/enic/enic_main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/enic/enic_main.c +13 -0
@@ -1652,6 +1652,19 @@ static int enic_dev_init(struct enic *enic)vnic_dev_notify_set (enic->vdev,-1 );/* No Intr for notify */ enic->overlay_offload = false; +if (enic->disable_overlay && enic->vxlan) { +/* +* Explicitly disable overlay offload as the setting is +* sticky, and resetting vNIC does not disable it. +*/ +if (vnic_dev_overlay_offload_ctrl (enic->vdev, +OVERLAY_FEATURE_VXLAN , +OVERLAY_OFFLOAD_DISABLE )) { +dev_err (enic,"failed to disable overlay offload\n" ); + }else { +dev_info (enic,"Overlay offload is disabled\n" ); + } + }if (!enic->disable_overlay && enic->vxlan &&/* 'VXLAN feature' enables VXLAN, NVGRE, and GENEVE. */ vnic_dev_overlay_offload_ctrl(enic->vdev,
Signature · 1 line
2.16.2
Quoted 8 lines · John Daley
From: Hyong Youb Kim <[email protected]>
Bugzilla ID: 39
Fixes 9913fbb91df0 ("enic/base: common code")Fixes 322b355f2183 ("net/enic/base: bring NIC interface functions up to date")Signed-off-by Hyong Youb Kim <[email protected]>Reviewed-by John Daley <[email protected]>
Series applied to dpdk-next-net/master, thanks.