From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id D1B1A4D27 for ; Wed, 10 Apr 2019 10:32:29 +0200 (CEST) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 9CCA6295E69; Wed, 10 Apr 2019 10:32:29 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: Ferruh Yigit Date: Wed, 10 Apr 2019 10:32:09 +0200 Message-Id: <20190410083218.17531-6-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190410083218.17531-1-olivier.matz@6wind.com> References: <20181024081833.21432-1-olivier.matz@6wind.com> <20190410083218.17531-1-olivier.matz@6wind.com> X-Mailman-Approved-At: Wed, 10 Apr 2019 11:01:32 +0200 Subject: [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2019 08:32:30 -0000 Add 'RTE_' prefix to defines: - rename ETHER_ADDR_LEN as RTE_ETHER_ADDR_LEN. - rename ETHER_TYPE_LEN as RTE_ETHER_TYPE_LEN. - rename ETHER_CRC_LEN as RTE_ETHER_CRC_LEN. - rename ETHER_HDR_LEN as RTE_ETHER_HDR_LEN. - rename ETHER_MIN_LEN as RTE_ETHER_MIN_LEN. - rename ETHER_MAX_LEN as RTE_ETHER_MAX_LEN. - rename ETHER_MTU as RTE_ETHER_MTU. - rename ETHER_MAX_VLAN_FRAME_LEN as RTE_ETHER_MAX_VLAN_FRAME_LEN. - rename ETHER_MAX_VLAN_ID as RTE_ETHER_MAX_VLAN_ID. - rename ETHER_MAX_JUMBO_FRAME_LEN as RTE_ETHER_MAX_JUMBO_FRAME_LEN. - rename ETHER_MIN_MTU as RTE_ETHER_MIN_MTU. - rename ETHER_LOCAL_ADMIN_ADDR as RTE_ETHER_LOCAL_ADMIN_ADDR. - rename ETHER_GROUP_ADDR as RTE_ETHER_GROUP_ADDR. - rename ETHER_TYPE_IPv4 as RTE_ETHER_TYPE_IPv4. - rename ETHER_TYPE_IPv6 as RTE_ETHER_TYPE_IPv6. - rename ETHER_TYPE_ARP as RTE_ETHER_TYPE_ARP. - rename ETHER_TYPE_VLAN as RTE_ETHER_TYPE_VLAN. - rename ETHER_TYPE_RARP as RTE_ETHER_TYPE_RARP. - rename ETHER_TYPE_QINQ as RTE_ETHER_TYPE_QINQ. - rename ETHER_TYPE_ETAG as RTE_ETHER_TYPE_ETAG. - rename ETHER_TYPE_1588 as RTE_ETHER_TYPE_1588. - rename ETHER_TYPE_SLOW as RTE_ETHER_TYPE_SLOW. - rename ETHER_TYPE_TEB as RTE_ETHER_TYPE_TEB. - rename ETHER_TYPE_LLDP as RTE_ETHER_TYPE_LLDP. - rename ETHER_TYPE_MPLS as RTE_ETHER_TYPE_MPLS. - rename ETHER_TYPE_MPLSM as RTE_ETHER_TYPE_MPLSM. - rename ETHER_VXLAN_HLEN as RTE_ETHER_VXLAN_HLEN. - rename ETHER_ADDR_FMT_SIZE as RTE_ETHER_ADDR_FMT_SIZE. - rename VXLAN_GPE_TYPE_IPV4 as RTE_VXLAN_GPE_TYPE_IPV4. - rename VXLAN_GPE_TYPE_IPV6 as RTE_VXLAN_GPE_TYPE_IPV6. - rename VXLAN_GPE_TYPE_ETH as RTE_VXLAN_GPE_TYPE_ETH. - rename VXLAN_GPE_TYPE_NSH as RTE_VXLAN_GPE_TYPE_NSH. - rename VXLAN_GPE_TYPE_MPLS as RTE_VXLAN_GPE_TYPE_MPLS. - rename VXLAN_GPE_TYPE_GBP as RTE_VXLAN_GPE_TYPE_GBP. - rename VXLAN_GPE_TYPE_VBNG as RTE_VXLAN_GPE_TYPE_VBNG. - rename ETHER_VXLAN_GPE_HLEN as RTE_ETHER_VXLAN_GPE_HLEN. Do not update the command line library to avoid adding a dependency to librte_net. Signed-off-by: Olivier Matz --- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 2 +- app/test-pmd/cmdline.c | 34 +++---- app/test-pmd/cmdline_flow.c | 80 +++++++-------- app/test-pmd/config.c | 4 +- app/test-pmd/csumonly.c | 46 ++++----- app/test-pmd/flowgen.c | 2 +- app/test-pmd/icmpecho.c | 12 +-- app/test-pmd/ieee1588fwd.c | 4 +- app/test-pmd/parameters.c | 6 +- app/test-pmd/testpmd.c | 10 +- app/test-pmd/testpmd.h | 20 ++-- app/test-pmd/txonly.c | 2 +- app/test-pmd/util.c | 4 +- app/test/packet_burst_generator.c | 14 +-- app/test/test_cmdline_etheraddr.c | 2 +- app/test/test_flow_classify.c | 6 +- app/test/test_link_bonding.c | 90 ++++++++--------- app/test/test_link_bonding_mode4.c | 28 +++--- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_pmd_perf.c | 8 +- app/test/test_sched.c | 2 +- app/test/virtual_pmd.c | 2 +- doc/guides/nics/kni.rst | 2 +- doc/guides/prog_guide/rte_flow.rst | 4 +- doc/guides/sample_app_ug/flow_classify.rst | 2 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- doc/guides/sample_app_ug/skeleton.rst | 2 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- drivers/net/ark/ark_ethdev.c | 4 +- drivers/net/atlantic/atl_ethdev.c | 6 +- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/avp/rte_avp_common.h | 2 +- drivers/net/axgbe/axgbe_dev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.h | 2 +- drivers/net/axgbe/axgbe_rxtx.c | 2 +- drivers/net/bnx2x/bnx2x.c | 4 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 4 +- drivers/net/bnxt/bnxt_ethdev.c | 64 ++++++------ drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 +- drivers/net/bnxt/bnxt_flow.c | 14 +-- drivers/net/bnxt/bnxt_hwrm.c | 34 +++---- drivers/net/bnxt/bnxt_ring.c | 8 +- drivers/net/bnxt/bnxt_rxq.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 2 +- drivers/net/bnxt/bnxt_vnic.c | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 8 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 8 +- drivers/net/bonding/rte_eth_bond_pmd.c | 40 ++++---- drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/t4_hw.c | 8 +- drivers/net/cxgbe/cxgbe.h | 4 +- drivers/net/cxgbe/cxgbe_ethdev.c | 12 +-- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 6 +- drivers/net/cxgbe/cxgbe_main.c | 4 +- drivers/net/cxgbe/cxgbevf_main.c | 2 +- drivers/net/cxgbe/l2t.c | 8 +- drivers/net/cxgbe/l2t.h | 2 +- drivers/net/cxgbe/mps_tcam.c | 14 +-- drivers/net/cxgbe/mps_tcam.h | 4 +- drivers/net/cxgbe/sge.c | 8 +- drivers/net/dpaa/dpaa_ethdev.c | 14 +-- drivers/net/dpaa/dpaa_rxtx.c | 8 +- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/e1000_ethdev.h | 4 +- drivers/net/e1000/em_ethdev.c | 20 ++-- drivers/net/e1000/em_rxtx.c | 16 +-- drivers/net/e1000/igb_ethdev.c | 42 ++++---- drivers/net/e1000/igb_flow.c | 4 +- drivers/net/e1000/igb_pf.c | 10 +- drivers/net/e1000/igb_rxtx.c | 12 +-- drivers/net/ena/ena_ethdev.h | 2 +- drivers/net/enetc/base/enetc_hw.h | 4 +- drivers/net/enetc/enetc_ethdev.c | 4 +- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_ethdev.c | 8 +- drivers/net/enic/enic_flow.c | 14 +-- drivers/net/enic/enic_res.c | 4 +- drivers/net/failsafe/failsafe_args.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 4 +- drivers/net/fm10k/fm10k.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 52 +++++----- drivers/net/i40e/i40e_ethdev.h | 2 +- drivers/net/i40e/i40e_ethdev_vf.c | 22 ++--- drivers/net/i40e/i40e_fdir.c | 14 +-- drivers/net/i40e/i40e_flow.c | 26 ++--- drivers/net/i40e/i40e_pf.c | 2 +- drivers/net/i40e/i40e_rxtx.c | 22 ++--- drivers/net/i40e/rte_pmd_i40e.c | 6 +- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_ethdev.c | 20 ++-- drivers/net/iavf/iavf_rxtx.c | 8 +- drivers/net/ice/ice_ethdev.c | 24 ++--- drivers/net/ice/ice_rxtx.c | 22 ++--- drivers/net/ixgbe/ixgbe_ethdev.c | 44 ++++----- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_flow.c | 14 +-- drivers/net/ixgbe/ixgbe_pf.c | 10 +- drivers/net/ixgbe/ixgbe_rxtx.c | 6 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 6 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 20 ++-- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_ethdev.c | 4 +- drivers/net/mlx4/mlx4_flow.c | 8 +- drivers/net/mlx4/mlx4_rxtx.c | 2 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 2 +- drivers/net/mlx5/mlx5_flow_dv.c | 12 +-- drivers/net/mlx5/mlx5_flow_tcf.c | 20 ++-- drivers/net/mlx5/mlx5_flow_verbs.c | 10 +- drivers/net/mlx5/mlx5_mac.c | 4 +- drivers/net/mlx5/mlx5_nl.c | 8 +- drivers/net/mlx5/mlx5_rxtx.c | 6 +- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- drivers/net/mlx5/mlx5_trigger.c | 2 +- drivers/net/mvneta/mvneta_ethdev.c | 12 +-- drivers/net/mvneta/mvneta_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 12 +-- drivers/net/mvpp2/mrvl_ethdev.h | 2 +- drivers/net/netvsc/hn_ethdev.c | 2 +- drivers/net/netvsc/hn_nvs.c | 2 +- drivers/net/netvsc/hn_rndis.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 4 +- drivers/net/nfp/nfp_net.c | 10 +- drivers/net/nfp/nfp_net_pmd.h | 2 +- drivers/net/octeontx/octeontx_ethdev.c | 6 +- drivers/net/octeontx/octeontx_ethdev.h | 2 +- drivers/net/pcap/rte_eth_pcap.c | 18 ++-- drivers/net/qede/base/bcm_osal.h | 2 +- drivers/net/qede/base/ecore_dev.c | 4 +- drivers/net/qede/qede_ethdev.c | 18 ++-- drivers/net/qede/qede_filter.c | 22 ++--- drivers/net/qede/qede_if.h | 2 +- drivers/net/qede/qede_main.c | 6 +- drivers/net/qede/qede_rxtx.c | 6 +- drivers/net/qede/qede_rxtx.h | 2 +- drivers/net/sfc/sfc_ethdev.c | 4 +- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/softnic/parser.c | 6 +- drivers/net/tap/rte_eth_tap.c | 22 ++--- drivers/net/tap/tap_flow.c | 8 +- drivers/net/thunderx/base/nicvf_plat.h | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 12 +-- drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/virtio/virtio_ethdev.c | 46 ++++----- drivers/net/virtio/virtio_pci.h | 4 +- drivers/net/virtio/virtio_rxtx.c | 10 +- drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 2 +- drivers/net/virtio/virtio_user/virtio_user_dev.c | 6 +- drivers/net/virtio/virtio_user/virtio_user_dev.h | 2 +- drivers/net/virtio/virtio_user_ethdev.c | 8 +- drivers/net/virtio/virtqueue.h | 2 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +- drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- examples/bbdev_app/main.c | 2 +- examples/bond/main.c | 22 ++--- examples/distributor/main.c | 2 +- examples/ethtool/ethtool-app/ethapp.c | 4 +- examples/eventdev_pipeline/main.c | 2 +- examples/flow_classify/flow_classify.c | 2 +- examples/flow_filtering/main.c | 4 +- examples/ip_fragmentation/main.c | 18 ++-- examples/ip_pipeline/kni.c | 2 +- examples/ip_pipeline/parser.c | 6 +- examples/ip_reassembly/main.c | 8 +- examples/ipsec-secgw/ipsec-secgw.c | 24 ++--- examples/ipv4_multicast/main.c | 6 +- examples/kni/main.c | 6 +- examples/l2fwd-cat/l2fwd-cat.c | 2 +- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 8 +- examples/l3fwd-power/main.c | 12 +-- examples/l3fwd-vf/main.c | 6 +- examples/l3fwd/l3fwd_em.c | 4 +- examples/l3fwd/l3fwd_lpm.c | 4 +- examples/l3fwd/main.c | 10 +- examples/performance-thread/l3fwd-thread/main.c | 14 +-- examples/ptpclient/ptpclient.c | 2 +- examples/qos_meter/main.c | 2 +- examples/qos_sched/init.c | 2 +- examples/rxtx_callbacks/main.c | 2 +- examples/skeleton/basicfwd.c | 2 +- examples/tep_termination/vxlan.c | 20 ++-- examples/tep_termination/vxlan_setup.c | 6 +- examples/vhost/main.c | 6 +- examples/vm_power_manager/channel_monitor.c | 6 +- examples/vm_power_manager/main.c | 2 +- lib/librte_ethdev/rte_ethdev.c | 18 ++-- lib/librte_ethdev/rte_ethdev.h | 2 +- lib/librte_ethdev/rte_flow.h | 6 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 10 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_kni/rte_kni.h | 2 +- lib/librte_net/rte_arp.c | 8 +- lib/librte_net/rte_ether.h | 114 +++++++++++----------- lib/librte_net/rte_net.c | 30 +++--- lib/librte_pipeline/rte_table_action.c | 34 +++---- lib/librte_port/rte_port_source_sink.c | 6 +- lib/librte_vhost/virtio_net.c | 6 +- 210 files changed, 1040 insertions(+), 1040 deletions(-) diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index 8dbfd8181..01f782820 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -658,7 +658,7 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt) struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .rx_adv_conf = { diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index 1e525643d..16c49b860 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -165,7 +165,7 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt) struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .rx_adv_conf = { .rss_conf = { diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b2c2b60dd..804479821 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1832,16 +1832,16 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, uint64_t rx_offloads = port->dev_conf.rxmode.offloads; if (!strcmp(res->name, "max-pkt-len")) { - if (res->value < ETHER_MIN_LEN) { + if (res->value < RTE_ETHER_MIN_LEN) { printf("max-pkt-len can not be less than %d\n", - ETHER_MIN_LEN); + RTE_ETHER_MIN_LEN); return; } if (res->value == port->dev_conf.rxmode.max_rx_pkt_len) return; port->dev_conf.rxmode.max_rx_pkt_len = res->value; - if (res->value > ETHER_MAX_LEN) + if (res->value > RTE_ETHER_MAX_LEN) rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -1903,8 +1903,8 @@ cmd_config_mtu_parsed(void *parsed_result, { struct cmd_config_mtu_result *res = parsed_result; - if (res->value < ETHER_MIN_LEN) { - printf("mtu cannot be less than %d\n", ETHER_MIN_LEN); + if (res->value < RTE_ETHER_MIN_LEN) { + printf("mtu cannot be less than %d\n", RTE_ETHER_MIN_LEN); return; } port_mtu_set(res->port_id, res->value); @@ -8143,7 +8143,7 @@ cmd_set_vf_macvlan_parsed(void *parsed_result, memset(&filter, 0, sizeof(struct rte_eth_mac_filter)); - rte_memcpy(&filter.mac_addr, &res->address, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, &res->address, RTE_ETHER_ADDR_LEN); /* set VF MAC filter */ filter.is_vf = 1; @@ -9117,7 +9117,7 @@ cmd_set_mirror_mask_parsed(void *parsed_result, return; for (i = 0; i < nb_item; i++) { - if (vlan_list[i] > ETHER_MAX_VLAN_ID) { + if (vlan_list[i] > RTE_ETHER_MAX_VLAN_ID) { printf("Invalid vlan_id: must be < 4096\n"); return; } @@ -15208,9 +15208,9 @@ static void cmd_set_vxlan_parsed(void *parsed_result, if (vxlan_encap_conf.select_vlan) vxlan_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_vxlan = { @@ -15399,9 +15399,9 @@ static void cmd_set_nvgre_parsed(void *parsed_result, if (nvgre_encap_conf.select_vlan) nvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_nvgre = { @@ -15516,9 +15516,9 @@ static void cmd_set_l2_encap_parsed(void *parsed_result, if (l2_encap_conf.select_vlan) l2_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_l2_encap = { @@ -15708,9 +15708,9 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, if (mplsogre_encap_conf.select_vlan) mplsogre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_mplsogre_encap = { @@ -15946,9 +15946,9 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, if (mplsoudp_encap_conf.select_vlan) mplsoudp_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_mplsoudp_encap = { diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 1b7fbd02c..b1b9b26fd 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3483,9 +3483,9 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token, .item_vxlan.flags = 0, }; memcpy(action_vxlan_encap_data->item_eth.dst.addr_bytes, - vxlan_encap_conf.eth_dst, ETHER_ADDR_LEN); + vxlan_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(action_vxlan_encap_data->item_eth.src.addr_bytes, - vxlan_encap_conf.eth_src, ETHER_ADDR_LEN); + vxlan_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); if (!vxlan_encap_conf.select_ipv4) { memcpy(&action_vxlan_encap_data->item_ipv6.hdr.src_addr, &vxlan_encap_conf.ipv6_src, @@ -3606,9 +3606,9 @@ parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token, .item_nvgre.flow_id = 0, }; memcpy(action_nvgre_encap_data->item_eth.dst.addr_bytes, - nvgre_encap_conf.eth_dst, ETHER_ADDR_LEN); + nvgre_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(action_nvgre_encap_data->item_eth.src.addr_bytes, - nvgre_encap_conf.eth_src, ETHER_ADDR_LEN); + nvgre_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); if (!nvgre_encap_conf.select_ipv4) { memcpy(&action_nvgre_encap_data->item_ipv6.hdr.src_addr, &nvgre_encap_conf.ipv6_src, @@ -3670,22 +3670,22 @@ parse_vc_action_l2_encap(struct context *ctx, const struct token *token, }; header = action_encap_data->data; if (l2_encap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (l2_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - l2_encap_conf.eth_dst, ETHER_ADDR_LEN); + l2_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - l2_encap_conf.eth_src, ETHER_ADDR_LEN); + l2_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (l2_encap_conf.select_vlan) { if (l2_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -3734,7 +3734,7 @@ parse_vc_action_l2_decap(struct context *ctx, const struct token *token, }; header = action_decap_data->data; if (l2_decap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (l2_decap_conf.select_vlan) { @@ -3805,22 +3805,22 @@ parse_vc_action_mplsogre_encap(struct context *ctx, const struct token *token, }; header = action_encap_data->data; if (mplsogre_encap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsogre_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsogre_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsogre_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsogre_encap_conf.select_vlan) { if (mplsogre_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -3900,22 +3900,22 @@ parse_vc_action_mplsogre_decap(struct context *ctx, const struct token *token, }; header = action_decap_data->data; if (mplsogre_decap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsogre_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsogre_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsogre_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsogre_encap_conf.select_vlan) { if (mplsogre_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -3996,22 +3996,22 @@ parse_vc_action_mplsoudp_encap(struct context *ctx, const struct token *token, }; header = action_encap_data->data; if (mplsoudp_encap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsoudp_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsoudp_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsoudp_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsoudp_encap_conf.select_vlan) { if (mplsoudp_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -4093,22 +4093,22 @@ parse_vc_action_mplsoudp_decap(struct context *ctx, const struct token *token, }; header = action_decap_data->data; if (mplsoudp_decap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsoudp_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsoudp_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsoudp_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsoudp_encap_conf.select_vlan) { if (mplsoudp_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 01a19d8e8..0f32a28fc 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -110,8 +110,8 @@ const struct rss_type_info rss_type_table[] = { static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index e052c7eb5..7080ff5d9 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -92,9 +92,9 @@ struct simple_gre_hdr { static uint16_t get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) { - if (ethertype == _htons(ETHER_TYPE_IPv4)) + if (ethertype == _htons(RTE_ETHER_TYPE_IPv4)) return rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr); } @@ -150,7 +150,7 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; - if (info->ethertype == _htons(ETHER_TYPE_VLAN)) { + if (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN)) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); info->l2_len += sizeof(struct rte_vlan_hdr); @@ -158,11 +158,11 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) } switch (info->ethertype) { - case _htons(ETHER_TYPE_IPv4): + case _htons(RTE_ETHER_TYPE_IPv4): ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv4(ipv4_hdr, info); break; - case _htons(ETHER_TYPE_IPv6): + case _htons(RTE_ETHER_TYPE_IPv6): ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv6(ipv6_hdr, info); break; @@ -200,7 +200,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); - info->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */ + info->l2_len += RTE_ETHER_VXLAN_HLEN; /* add udp + vxlan */ } /* Parse a vxlan-gpe header */ @@ -222,7 +222,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, sizeof(struct udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == - VXLAN_GPE_TYPE_IPV4) { + RTE_VXLAN_GPE_TYPE_IPV4) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -233,10 +233,10 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, vxlan_gpe_len); parse_ipv4(ipv4_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv4); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); info->l2_len = 0; - } else if (vxlan_gpe_hdr->proto == VXLAN_GPE_TYPE_IPV6) { + } else if (vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_IPV6) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -246,11 +246,11 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, ipv6_hdr = (struct ipv6_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); - info->ethertype = _htons(ETHER_TYPE_IPv6); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); info->l2_len = 0; - } else if (vxlan_gpe_hdr->proto == VXLAN_GPE_TYPE_ETH) { + } else if (vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_ETH) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -264,7 +264,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, } else return; - info->l2_len += ETHER_VXLAN_GPE_HLEN; + info->l2_len += RTE_ETHER_VXLAN_GPE_HLEN; } /* Parse a gre header */ @@ -285,7 +285,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) if (gre_hdr->flags & _htons(GRE_CHECKSUM_PRESENT)) gre_len += GRE_EXT_LEN; - if (gre_hdr->proto == _htons(ETHER_TYPE_IPv4)) { + if (gre_hdr->proto == _htons(RTE_ETHER_TYPE_IPv4)) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -295,10 +295,10 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len); parse_ipv4(ipv4_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv4); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); info->l2_len = 0; - } else if (gre_hdr->proto == _htons(ETHER_TYPE_IPv6)) { + } else if (gre_hdr->proto == _htons(RTE_ETHER_TYPE_IPv6)) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -307,11 +307,11 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len); - info->ethertype = _htons(ETHER_TYPE_IPv6); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); info->l2_len = 0; - } else if (gre_hdr->proto == _htons(ETHER_TYPE_TEB)) { + } else if (gre_hdr->proto == _htons(RTE_ETHER_TYPE_TEB)) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -348,10 +348,10 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) if (ip_version == 4) { parse_ipv4(ipv4_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv4); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); } else { parse_ipv6(ipv6_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv6); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); } info->l2_len = 0; } @@ -383,7 +383,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, tso_segsz = info->tunnel_tso_segsz; } - if (info->ethertype == _htons(ETHER_TYPE_IPv4)) { + if (info->ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = l3_hdr; ipv4_hdr->hdr_checksum = 0; @@ -397,7 +397,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } - } else if (info->ethertype == _htons(ETHER_TYPE_IPv6)) + } else if (info->ethertype == _htons(RTE_ETHER_TYPE_IPv6)) ol_flags |= PKT_TX_IPV6; else return 0; /* packet type not supported, nothing to do */ @@ -458,7 +458,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, struct udp_hdr *udp_hdr; uint64_t ol_flags = 0; - if (info->outer_ethertype == _htons(ETHER_TYPE_IPv4)) { + if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_OUTER_IPV4; @@ -494,7 +494,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; - if (info->outer_ethertype == _htons(ETHER_TYPE_IPv4)) + if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) udp_hdr->dgram_cksum = rte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr); else diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 69a3b5050..00acbaf70 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -173,7 +173,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); rte_ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); rte_ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); /* Initialize IP header. */ ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 879f6283d..e778de438 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -223,9 +223,9 @@ ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf) static void ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, ea); if (what) printf("%s", what); printf("%s", buf); @@ -330,7 +330,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_dump(" ETH: src=", ð_h->s_addr); ether_addr_dump(" dst=", ð_h->d_addr); } - if (eth_type == ETHER_TYPE_VLAN) { + if (eth_type == RTE_ETHER_TYPE_VLAN) { vlan_h = (struct rte_vlan_hdr *) ((char *)eth_h + sizeof(struct rte_ether_hdr)); l2_len += sizeof(struct rte_vlan_hdr); @@ -346,7 +346,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } /* Reply to ARP requests */ - if (eth_type == ETHER_TYPE_ARP) { + if (eth_type == RTE_ETHER_TYPE_ARP) { arp_h = (struct rte_arp_hdr *) ((char *)eth_h + l2_len); arp_opcode = RTE_BE_TO_CPU_16(arp_h->arp_opcode); arp_protocol = RTE_BE_TO_CPU_16(arp_h->arp_protocol); @@ -360,7 +360,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != RTE_ARP_HRD_ETHER) || - (arp_protocol != ETHER_TYPE_IPv4) || + (arp_protocol != RTE_ETHER_TYPE_IPv4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) ) { @@ -409,7 +409,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } - if (eth_type != ETHER_TYPE_IPv4) { + if (eth_type != RTE_ETHER_TYPE_IPv4) { rte_pktmbuf_free(pkt); continue; } diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index 2b7003be4..e3b98e3e0 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -115,7 +115,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) { - if (eth_type == ETHER_TYPE_1588) { + if (eth_type == RTE_ETHER_TYPE_1588) { printf("Port %u Received PTP packet not filtered" " by hardware\n", fs->rx_port); @@ -128,7 +128,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) rte_pktmbuf_free(mb); return; } - if (eth_type != ETHER_TYPE_1588) { + if (eth_type != RTE_ETHER_TYPE_1588) { printf("Port %u Received NON PTP packet incorrectly" " detected by hardware\n", fs->rx_port); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 7b6b60905..813abb2b0 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -823,15 +823,15 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) { n = atoi(optarg); - if (n >= ETHER_MIN_LEN) { + if (n >= RTE_ETHER_MIN_LEN) { rx_mode.max_rx_pkt_len = (uint32_t) n; - if (n > ETHER_MAX_LEN) + if (n > RTE_ETHER_MAX_LEN) rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; } else rte_exit(EXIT_FAILURE, "Invalid max-pkt-len=%d - should be > %d\n", - n, ETHER_MIN_LEN); + n, RTE_ETHER_MIN_LEN); } if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) { if (!strcmp(optarg, "signature")) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 831221c99..b18e2685f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -410,7 +410,7 @@ lcoreid_t latencystats_lcore_id = -1; * Ethernet device configuration. */ struct rte_eth_rxmode rx_mode = { - .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, /**< Default maximum frame length. */ }; struct rte_eth_txmode tx_mode = { @@ -523,7 +523,7 @@ static void dev_event_callback(const char *device_name, static int all_ports_started(void); struct gso_status gso_ports[RTE_MAX_ETHPORTS]; -uint16_t gso_max_segment_size = ETHER_MAX_LEN - ETHER_CRC_LEN; +uint16_t gso_max_segment_size = RTE_ETHER_MAX_LEN - RTE_ETHER_CRC_LEN; /* * Helper function to check if socket is already discovered. @@ -579,7 +579,7 @@ set_def_peer_eth_addrs(void) portid_t i; for (i = 0; i < RTE_MAX_ETHPORTS; i++) { - peer_eth_addrs[i].addr_bytes[0] = ETHER_LOCAL_ADMIN_ADDR; + peer_eth_addrs[i].addr_bytes[0] = RTE_ETHER_LOCAL_ADMIN_ADDR; peer_eth_addrs[i].addr_bytes[5] = i; } } @@ -1158,8 +1158,8 @@ init_config(void) fwd_lcores[lc_id]->gso_ctx.direct_pool = mbp; fwd_lcores[lc_id]->gso_ctx.indirect_pool = mbp; fwd_lcores[lc_id]->gso_ctx.gso_types = gso_types; - fwd_lcores[lc_id]->gso_ctx.gso_size = ETHER_MAX_LEN - - ETHER_CRC_LEN; + fwd_lcores[lc_id]->gso_ctx.gso_size = RTE_ETHER_MAX_LEN - + RTE_ETHER_CRC_LEN; fwd_lcores[lc_id]->gso_ctx.flag = 0; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2f1780216..82ed59a30 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -493,8 +493,8 @@ struct vxlan_encap_conf { rte_be16_t vlan_tci; uint8_t ip_tos; uint8_t ip_ttl; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct vxlan_encap_conf vxlan_encap_conf; @@ -508,8 +508,8 @@ struct nvgre_encap_conf { uint8_t ipv6_src[16]; uint8_t ipv6_dst[16]; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct nvgre_encap_conf nvgre_encap_conf; @@ -518,8 +518,8 @@ struct l2_encap_conf { uint32_t select_ipv4:1; uint32_t select_vlan:1; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct l2_encap_conf l2_encap_conf; @@ -539,8 +539,8 @@ struct mplsogre_encap_conf { uint8_t ipv6_src[16]; uint8_t ipv6_dst[16]; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct mplsogre_encap_conf mplsogre_encap_conf; @@ -563,8 +563,8 @@ struct mplsoudp_encap_conf { uint8_t ipv6_src[16]; uint8_t ipv6_dst[16]; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct mplsoudp_encap_conf mplsoudp_encap_conf; diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 3e3ead9fb..d5a46e8fc 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -266,7 +266,7 @@ pkt_burst_transmit(struct fwd_stream *fs) */ rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); - eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, nb_pkt_per_burst) == 0) { diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 55f3844dd..105c56090 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -16,8 +16,8 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", what, buf); } diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 2ef5d15a5..feee9e121 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -64,7 +64,7 @@ initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_ struct rte_vlan_hdr *vhdr = (struct rte_vlan_hdr *)((uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr)); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); vhdr->eth_proto = rte_cpu_to_be_16(ether_type); vhdr->vlan_tci = van_id; @@ -79,8 +79,8 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma uint32_t opcode) { arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); - arp_hdr->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hlen = ETHER_ADDR_LEN; + arp_hdr->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); + arp_hdr->arp_hlen = RTE_ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); rte_ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); @@ -318,10 +318,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, pkt->l2_len = eth_hdr_size; if (ipv4) { - pkt->vlan_tci = ETHER_TYPE_IPv4; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; pkt->l3_len = sizeof(struct ipv4_hdr); } else { - pkt->vlan_tci = ETHER_TYPE_IPv6; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; pkt->l3_len = sizeof(struct ipv6_hdr); } @@ -433,10 +433,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, pkt->l2_len = eth_hdr_size; if (ipv4) { - pkt->vlan_tci = ETHER_TYPE_IPv4; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; pkt->l3_len = sizeof(struct ipv4_hdr); } else { - pkt->vlan_tci = ETHER_TYPE_IPv6; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; pkt->l3_len = sizeof(struct ipv6_hdr); } diff --git a/app/test/test_cmdline_etheraddr.c b/app/test/test_cmdline_etheraddr.c index 90943c2b4..9a32fd7ec 100644 --- a/app/test/test_cmdline_etheraddr.c +++ b/app/test/test_cmdline_etheraddr.c @@ -85,7 +85,7 @@ static int is_addr_different(const struct rte_ether_addr addr, uint64_t num) { int i; - for (i = 0; i < ETHER_ADDR_LEN; i++, num >>= 8) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++, num >>= 8) if (addr.addr_bytes[i] != (num & 0xFF)) { return 1; } diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index f81bbba3a..3f06f3005 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -504,7 +504,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, printf("Set up IPv4 UDP traffic\n"); initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); @@ -541,7 +541,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, printf("Set up IPv4 TCP traffic\n"); initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); @@ -578,7 +578,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, printf("Set up IPv4 SCTP traffic\n"); initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 00ddb0efe..2490d5dd2 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -136,7 +136,7 @@ static struct rte_eth_conf default_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, .split_hdr_size = 0, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, @@ -236,7 +236,7 @@ test_setup(void) for (i = 0; i < TEST_MAX_NUMBER_OF_PORTS; i++) { char pmd_name[RTE_ETH_NAME_MAX_LEN]; - mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; + mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; snprintf(pmd_name, RTE_ETH_NAME_MAX_LEN, "eth_virt_%d", i); @@ -395,7 +395,7 @@ test_remove_slave_from_bonded_device(void) mac_addr = (struct rte_ether_addr *)slave_mac; - mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = + mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = test_params->bonded_slave_count-1; rte_eth_macaddr_get( @@ -751,7 +751,7 @@ test_set_primary_slave(void) test_params->bonded_port_id); expected_mac_addr = (struct rte_ether_addr *)&slave_mac; - expected_mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; + expected_mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; /* Check primary slave MAC */ rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); @@ -897,7 +897,7 @@ test_set_bonded_port_initialization_mac_assignment(void) for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT; i++) { char pmd_name[RTE_ETH_NAME_MAX_LEN]; - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = i + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = i + 100; snprintf(pmd_name, RTE_ETH_NAME_MAX_LEN, "eth_slave_%d", i); @@ -933,8 +933,8 @@ test_set_bonded_port_initialization_mac_assignment(void) /* * 3. Set explicit MAC address on bonded ethdev */ - bonded_mac_addr.addr_bytes[ETHER_ADDR_LEN-2] = 0xFF; - bonded_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 0xAA; + bonded_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-2] = 0xFF; + bonded_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0xAA; TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( bonded_port_id, &bonded_mac_addr), @@ -965,13 +965,13 @@ test_set_bonded_port_initialization_mac_assignment(void) sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 1 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 1 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 2 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), @@ -996,13 +996,13 @@ test_set_bonded_port_initialization_mac_assignment(void) sizeof(read_mac_addr)), "bonded port mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 0 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 1 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), @@ -1033,19 +1033,19 @@ test_set_bonded_port_initialization_mac_assignment(void) "Number of slaves (%d) is great than expected (%d).", slave_count, 0); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 0 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 1 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 1 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 2 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), @@ -1262,9 +1262,9 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, void *ip_hdr; if (ipv4) - ether_type = ETHER_TYPE_IPv4; + ether_type = RTE_ETHER_TYPE_IPv4; else - ether_type = ETHER_TYPE_IPv6; + ether_type = RTE_ETHER_TYPE_IPv6; if (toggle_dst_mac) initialize_eth_header(test_params->pkt_eth_hdr, @@ -1939,7 +1939,7 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void) for (i = 0; i < TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT; i++) { /* Generate slave name / MAC address */ snprintf(slave_name, RTE_ETH_NAME_MAX_LEN, "eth_virt_poll_%d", i); - mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; + mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; /* Create slave devices with no ISR Support */ if (polling_test_slaves[i] == -1) { @@ -2031,7 +2031,7 @@ test_activebackup_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, src_addr, @@ -2565,7 +2565,7 @@ test_balance_l2_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, src_addr, @@ -2580,7 +2580,7 @@ test_balance_l2_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); /* Generate a burst 2 of packets to transmit */ TEST_ASSERT_EQUAL(generate_packet_burst(test_params->mbuf_pool, &pkts_burst[1][0], @@ -3403,7 +3403,7 @@ test_broadcast_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -3986,11 +3986,11 @@ test_tlb_tx_burst(void) if (i % 2 == 0) { initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac_0, RTE_ETHER_TYPE_IPv4, 0, 0); } else { initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)test_params->default_slave_mac, - (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac_0, RTE_ETHER_TYPE_IPv4, 0, 0); } pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -4491,9 +4491,9 @@ test_alb_change_mac_in_reply_sent(void) * them through the bonding port. */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client1, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, @@ -4501,9 +4501,9 @@ test_alb_change_mac_in_reply_sent(void) rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client2, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, @@ -4511,9 +4511,9 @@ test_alb_change_mac_in_reply_sent(void) rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client3, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, @@ -4521,9 +4521,9 @@ test_alb_change_mac_in_reply_sent(void) rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client4, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, @@ -4604,9 +4604,9 @@ test_alb_reply_from_client(void) * them in the rx queue to be received by the bonding driver on rx_burst. */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client1, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, @@ -4615,9 +4615,9 @@ test_alb_reply_from_client(void) 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client2, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, @@ -4626,9 +4626,9 @@ test_alb_reply_from_client(void) 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client3, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, @@ -4637,9 +4637,9 @@ test_alb_reply_from_client(void) 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client4, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, @@ -4730,16 +4730,16 @@ test_alb_receive_vlan_reply(void) * Generating packet with double VLAN header and placing it in the rx queue. */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client1, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_VLAN, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_VLAN, 0, 0); vlan_pkt = (struct rte_vlan_hdr *)((char *)(eth_pkt + 1)); vlan_pkt->vlan_tci = rte_cpu_to_be_16(1); - vlan_pkt->eth_proto = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + vlan_pkt->eth_proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); vlan_pkt = vlan_pkt+1; vlan_pkt->vlan_tci = rte_cpu_to_be_16(2); - vlan_pkt->eth_proto = rte_cpu_to_be_16(ETHER_TYPE_ARP); + vlan_pkt->eth_proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, RTE_ARP_OP_REPLY); @@ -4764,7 +4764,7 @@ test_alb_receive_vlan_reply(void) retval = -1; goto test_end; } - if (vlan_pkt->eth_proto != rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { + if (vlan_pkt->eth_proto != rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { retval = -1; goto test_end; } @@ -4773,7 +4773,7 @@ test_alb_receive_vlan_reply(void) retval = -1; goto test_end; } - if (vlan_pkt->eth_proto != rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (vlan_pkt->eth_proto != rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { retval = -1; goto test_end; } diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index f5ac6c99f..6295b1874 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -108,7 +108,7 @@ static struct link_bonding_unittest_params test_params = { static struct rte_eth_conf default_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -233,7 +233,7 @@ add_slave(struct slave_conf *slave, uint8_t start) RTE_VERIFY(slave->port_id != INVALID_PORT_ID); rte_ether_addr_copy(&slave_mac_default, &addr); - addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; rte_eth_dev_mac_addr_remove(slave->port_id, &addr); @@ -299,7 +299,7 @@ lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) RTE_VERIFY(lacp_pkt != NULL); hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *); - RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW)); + RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW)); slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *); RTE_VERIFY(slow_hdr->slow_protocol.subtype == SLOW_SUBTYPE_LACP); @@ -480,7 +480,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) /* look for LACP */ hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW)) + if (hdr->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW)) return 1; slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *); @@ -492,7 +492,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) /* Change source address to partner address */ rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr); - slow_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + slow_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; lacp = (struct lacpdu *) &slow_hdr->slow_protocol; /* Save last received state */ @@ -926,11 +926,11 @@ test_mode4_rx(void) FOR_EACH_SLAVE(i, slave) { void *pkt = NULL; - dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1); TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst."); - src_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + src_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1); TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst."); @@ -990,7 +990,7 @@ test_mode4_tx_burst(void) /* Prepare burst */ for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) { - dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt; + dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = pkts_cnt; retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]); if (retval != 1) @@ -1063,7 +1063,7 @@ test_mode4_tx_burst(void) /* Prepare burst. */ for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) { - dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt; + dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = pkts_cnt; retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]); if (retval != 1) @@ -1134,9 +1134,9 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) /* Init source address */ rte_ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr); - marker_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN-1] = slave->port_id; + marker_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = slave->port_id; - marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); + marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW); marker_hdr->marker.subtype = SLOW_SUBTYPE_MARKER; marker_hdr->marker.version_number = 1; @@ -1162,7 +1162,7 @@ test_mode4_marker(void) int retval; uint16_t nb_pkts; uint8_t i, j; - const uint16_t ethtype_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); + const uint16_t ethtype_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); retval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT, 0); @@ -1362,7 +1362,7 @@ test_mode4_ext_ctrl(void) rte_ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac, - ETHER_TYPE_SLOW, 0, 0); + RTE_ETHER_TYPE_SLOW, 0, 0); for (i = 0; i < SLAVE_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); @@ -1416,7 +1416,7 @@ test_mode4_ext_lacp(void) rte_ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac, - ETHER_TYPE_SLOW, 0, 0); + RTE_ETHER_TYPE_SLOW, 0, 0); for (i = 0; i < SLAVE_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index 4392522ea..65de3b98d 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -81,7 +81,7 @@ static struct link_bonding_rssconf_unittest_params test_params = { static struct rte_eth_conf default_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -93,7 +93,7 @@ static struct rte_eth_conf default_pmd_conf = { static struct rte_eth_conf rss_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index a0c3eb956..4b973ffc4 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -63,7 +63,7 @@ static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -173,8 +173,8 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -192,7 +192,7 @@ init_traffic(struct rte_mempool *mp, initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, IPV4_ADDR(10, 0, 0, 1), diff --git a/app/test/test_sched.c b/app/test/test_sched.c index c4554aa74..58f42a2d8 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -91,7 +91,7 @@ prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip_hdr->dst_addr = IPv4(0,0,TC,QUEUE); diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 15ce64445..55c2bdb98 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -566,7 +566,7 @@ virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, eth_dev->data->dev_link.link_speed = ETH_SPEED_NUM_10G; eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; - eth_dev->data->mac_addrs = rte_zmalloc(name, ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc(name, RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) goto err; diff --git a/doc/guides/nics/kni.rst b/doc/guides/nics/kni.rst index a66c59531..7b482a5d4 100644 --- a/doc/guides/nics/kni.rst +++ b/doc/guides/nics/kni.rst @@ -56,7 +56,7 @@ configuration: Interface name: kni# force bind kernel thread to a core : NO mbuf size: (rte_pktmbuf_data_room_size(pktmbuf_pool) - RTE_PKTMBUF_HEADROOM) - mtu: (conf.mbuf_size - ETHER_HDR_LEN) + mtu: (conf.mbuf_size - RTE_ETHER_HDR_LEN) KNI control path is not supported with the PMD, since there is no physical backend device by default. diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 0203f4f61..19334d95f 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -863,7 +863,7 @@ Item: ``VLAN`` Matches an 802.1Q/ad VLAN tag. The corresponding standard outer EtherType (TPID) values are -``ETHER_TYPE_VLAN`` or ``ETHER_TYPE_QINQ``. It can be overridden by the +``RTE_ETHER_TYPE_VLAN`` or ``RTE_ETHER_TYPE_QINQ``. It can be overridden by the preceding pattern item. - ``tci``: tag control information. @@ -940,7 +940,7 @@ Item: ``E_TAG`` Matches an IEEE 802.1BR E-Tag header. The corresponding standard outer EtherType (TPID) value is -``ETHER_TYPE_ETAG``. It can be overridden by the preceding pattern item. +``RTE_ETHER_TYPE_ETAG``. It can be overridden by the preceding pattern item. - ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b), E-DEI (1b), ingress E-CID base (12b). diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 9582b9376..762c3844e 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -326,7 +326,7 @@ The Ethernet ports are configured with default settings using the .. code-block:: c static const struct rte_eth_conf port_conf_default = { - .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } + .rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN } }; For this example the ports are set up with 1 RX and 1 TX queue using the diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 0b44ab90b..a4cb4377f 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -229,7 +229,7 @@ The actual packet transmission is done in the mcast_send_pkt() function: rte_ether_addr_copy(dest_addr, ðdr->d_addr); rte_ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr); - ethdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + ethdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); /* Put new packet into the output queue */ diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst index 715f5e91a..59ca511d3 100644 --- a/doc/guides/sample_app_ug/skeleton.rst +++ b/doc/guides/sample_app_ug/skeleton.rst @@ -160,7 +160,7 @@ The Ethernet ports are configured with default settings using the .. code-block:: c static const struct rte_eth_conf port_conf_default = { - .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } + .rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN } }; For this example the ports are set up with 1 RX and 1 TX queue using the diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 8fa9b8cae..2556b0fb4 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -315,7 +315,7 @@ fman_if_init(const struct device_node *dpa_node) mname); goto err; } - memcpy(&__if->__if.mac_addr, mac_addr, ETHER_ADDR_LEN); + memcpy(&__if->__if.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); /* Extract the Tx port (it's the second of the two port handles) * and get its channel ID diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 9ab8e835d..a4c27786b 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -153,7 +153,7 @@ fman_if_add_mac_addr(struct fman_if *p, uint8_t *eth, uint8_t addr_num) void *reg; u32 val; - memcpy(&m->__if.mac_addr, eth, ETHER_ADDR_LEN); + memcpy(&m->__if.mac_addr, eth, RTE_ETHER_ADDR_LEN); if (addr_num) reg = &((struct memac_regs *)m->ccsr_map)-> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 4bd0392ef..1ffc9e5e1 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -796,7 +796,7 @@ get_iface_info(const char *if_name, if (ioctl(sock, SIOCGIFHWADDR, &ifr)) goto error; - rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(sock); return 0; diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index b2b1fd78a..15d813f61 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -318,7 +318,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) dev->dev_ops = &ark_eth_dev_ops; - dev->data->mac_addrs = rte_zmalloc("ark", ETHER_ADDR_LEN, 0); + dev->data->mac_addrs = rte_zmalloc("ark", RTE_ETHER_ADDR_LEN, 0); if (!dev->data->mac_addrs) { PMD_DRV_LOG(ERR, "Failed to allocated memory for storing mac address" @@ -385,7 +385,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->mac_addrs = rte_zmalloc(name, ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc(name, RTE_ETHER_ADDR_LEN, 0); if (!eth_dev->data->mac_addrs) { PMD_DRV_LOG(ERR, "Memory allocation for MAC failed!" diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index f1df8e7fa..13f8cd10d 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -366,7 +366,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) atl_disable_intr(hw); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("atlantic", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("atlantic", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "MAC Malloc failed"); return -ENOMEM; @@ -1264,11 +1264,11 @@ static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct rte_eth_dev_info dev_info; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; atl_dev_info_get(dev, &dev_info); - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; /* update max frame size */ diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 38e5eae05..e144c64ac 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -88,7 +88,7 @@ static void avp_dev_stats_reset(struct rte_eth_dev *dev); #define AVP_MAX_RX_BURST 64 #define AVP_MAX_TX_BURST 64 #define AVP_MAX_MAC_ADDRS 1 -#define AVP_MIN_RX_BUFSIZE ETHER_MIN_LEN +#define AVP_MIN_RX_BUFSIZE RTE_ETHER_MIN_LEN /* @@ -867,7 +867,7 @@ avp_dev_create(struct rte_pci_device *pci_dev, avp->host_features = host_info->features; rte_spinlock_init(&avp->lock); memcpy(&avp->ethaddr.addr_bytes[0], - host_info->ethaddr, ETHER_ADDR_LEN); + host_info->ethaddr, RTE_ETHER_ADDR_LEN); /* adjust max values to not exceed our max */ avp->max_tx_queues = RTE_MIN(host_info->max_tx_queues, RTE_AVP_MAX_QUEUES); @@ -1006,10 +1006,10 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("avp_ethdev", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("avp_ethdev", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_DRV_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses\n", - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); return -ENOMEM; } diff --git a/drivers/net/avp/rte_avp_common.h b/drivers/net/avp/rte_avp_common.h index aa95159c4..478c01a16 100644 --- a/drivers/net/avp/rte_avp_common.h +++ b/drivers/net/avp/rte_avp_common.h @@ -345,7 +345,7 @@ struct rte_avp_device_info { /* Ethernet info */ char ethaddr[ETH_ALEN]; #else - char ethaddr[ETHER_ADDR_LEN]; + char ethaddr[RTE_ETHER_ADDR_LEN]; #endif uint8_t mode; /**< device mode, i.e guest, host, trace */ diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c index 707f1ee9d..b1f0bbc8e 100644 --- a/drivers/net/axgbe/axgbe_dev.c +++ b/drivers/net/axgbe/axgbe_dev.c @@ -10,8 +10,8 @@ static inline unsigned int axgbe_get_max_frame(struct axgbe_port *pdata) { - return pdata->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_HLEN; + return pdata->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_HLEN; } /* query busy bit */ diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 237b75c5d..221979c5e 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -626,11 +626,11 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) pdata->mac_addr.addr_bytes[5] = (mac_hi >> 8) & 0xff; eth_dev->data->mac_addrs = rte_zmalloc("axgbe_mac_addr", - ETHER_ADDR_LEN, 0); + RTE_ETHER_ADDR_LEN, 0); if (!eth_dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to alloc %u bytes needed to store MAC addr tbl", - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); return -ENOMEM; } diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index 810ac4a74..e3cfaf36f 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -15,7 +15,7 @@ #define AXGBE_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1)) #define AXGBE_RX_MAX_BUF_SIZE (0x3fff & ~(64 - 1)) -#define AXGBE_RX_MIN_BUF_SIZE (ETHER_MAX_LEN + VLAN_HLEN) +#define AXGBE_RX_MIN_BUF_SIZE (RTE_ETHER_MAX_LEN + VLAN_HLEN) #define AXGBE_MAX_MAC_ADDRS 1 #define AXGBE_RX_BUF_ALIGN 64 diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index b5a29a95f..e76601d14 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -75,7 +75,7 @@ int axgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, rxq->dma_tail_reg = (volatile uint32_t *)((uint8_t *)rxq->dma_regs + DMA_CH_RDTR_LO); if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index d83d3e686..c09cb93aa 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -9745,13 +9745,13 @@ int bnx2x_attach(struct bnx2x_softc *sc) bnx2x_get_phy_info(sc); } else { /* Left mac of VF unfilled, PF should set it for VF */ - memset(sc->link_params.mac_addr, 0, ETHER_ADDR_LEN); + memset(sc->link_params.mac_addr, 0, RTE_ETHER_ADDR_LEN); } sc->wol = 0; /* set the default MTU (changed via ifconfig) */ - sc->mtu = ETHER_MTU; + sc->mtu = RTE_ETHER_MTU; bnx2x_set_modes_bitmap(sc); diff --git a/drivers/net/bnx2x/ecore_sp.h b/drivers/net/bnx2x/ecore_sp.h index f295bf5af..a73116151 100644 --- a/drivers/net/bnx2x/ecore_sp.h +++ b/drivers/net/bnx2x/ecore_sp.h @@ -38,7 +38,7 @@ typedef rte_iova_t ecore_dma_addr_t; /* expected to be 64 bit wide */ typedef volatile int ecore_atomic_t; -#define ETH_ALEN ETHER_ADDR_LEN /* 6 */ +#define ETH_ALEN RTE_ETHER_ADDR_LEN /* 6 */ #define ECORE_SWCID_SHIFT 17 #define ECORE_SWCID_MASK ((0x1 << ECORE_SWCID_SHIFT) - 1) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 5535c376e..caacc7258 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -309,7 +309,7 @@ struct bnxt { struct bnxt_irq *irq_tbl; #define MAX_NUM_MAC_ADDR 32 - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; uint16_t hwrm_cmd_seq; uint16_t kong_cmd_seq; @@ -326,7 +326,7 @@ struct bnxt { uint8_t tx_cosq_id; uint16_t fw_fid; - uint8_t dflt_mac_addr[ETHER_ADDR_LEN]; + uint8_t dflt_mac_addr[RTE_ETHER_ADDR_LEN]; uint16_t max_rsscos_ctx; uint16_t max_cp_rings; uint16_t max_tx_rings; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 0cad7a144..cf1f9beb7 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -214,7 +214,7 @@ static int bnxt_init_chip(struct bnxt *bp) /* disable uio/vfio intr/eventfd mapping */ rte_intr_disable(intr_handle); - if (bp->eth_dev->data->mtu > ETHER_MTU) { + if (bp->eth_dev->data->mtu > RTE_ETHER_MTU) { bp->eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; bp->flags |= BNXT_FLAG_JUMBO; @@ -462,7 +462,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, /* Fast path specifics */ dev_info->min_rx_bufsize = 1; - dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN + dev_info->max_rx_pktlen = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT; @@ -596,7 +596,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { eth_dev->data->mtu = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE * + RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN - VLAN_TAG_SIZE * BNXT_NUM_VLANS; bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu); } @@ -750,7 +750,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, bnxt_filter_info, next); bnxt_hwrm_clear_l2_filter(bp, filter); filter->mac_index = INVALID_MAC_INDEX; - memset(&filter->l2_addr, 0, ETHER_ADDR_LEN); + memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next); } @@ -791,7 +791,7 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, } STAILQ_INSERT_TAIL(&vnic->filter, filter, next); filter->mac_index = index; - memcpy(filter->l2_addr, mac_addr, ETHER_ADDR_LEN); + memcpy(filter->l2_addr, mac_addr, RTE_ETHER_ADDR_LEN); return bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); } @@ -1312,7 +1312,7 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id) new_filter->mac_index = filter->mac_index; memcpy(new_filter->l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); /* MAC only filter */ rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, @@ -1381,7 +1381,7 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) /* Inherit MAC from the previous filter */ new_filter->mac_index = filter->mac_index; memcpy(new_filter->l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); /* MAC + VLAN ID filter */ new_filter->l2_ivlan = vlan_id; new_filter->l2_ivlan_mask = 0xF000; @@ -1471,8 +1471,8 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct rte_ether_addr *add rc = bnxt_hwrm_clear_l2_filter(bp, filter); if (rc) return rc; - memcpy(filter->l2_addr, bp->mac_addr, ETHER_ADDR_LEN); - memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN); + memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | @@ -1507,8 +1507,8 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev, /* TODO Check for Duplicate mcast addresses */ vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI; for (i = 0; i < nb_mc_addr; i++) { - memcpy(vnic->mc_list + off, &mc_addr_list[i], ETHER_ADDR_LEN); - off += ETHER_ADDR_LEN; + memcpy(vnic->mc_list + off, &mc_addr_list[i], RTE_ETHER_ADDR_LEN); + off += RTE_ETHER_ADDR_LEN; } vnic->mc_addr_cnt = i; @@ -1581,13 +1581,13 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) bnxt_dev_info_get_op(eth_dev, &dev_info); - if (new_mtu < ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) { + if (new_mtu < RTE_ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) { PMD_DRV_LOG(ERR, "MTU requested must be within (%d, %d)\n", - ETHER_MIN_MTU, BNXT_MAX_MTU); + RTE_ETHER_MIN_MTU, BNXT_MAX_MTU); return -EINVAL; } - if (new_mtu > ETHER_MTU) { + if (new_mtu > RTE_ETHER_MTU) { bp->flags |= BNXT_FLAG_JUMBO; bp->eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -1598,7 +1598,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) } eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = - new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; + new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; eth_dev->data->mtu = new_mtu; PMD_DRV_LOG(INFO, "New MTU is %d\n", eth_dev->data->mtu); @@ -1607,8 +1607,8 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) struct bnxt_vnic_info *vnic = &bp->vnic_info[i]; uint16_t size = 0; - vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; + vnic->mru = bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; rc = bnxt_hwrm_vnic_cfg(bp, vnic); if (rc) break; @@ -1793,8 +1793,8 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, int match = 0; *ret = 0; - if (efilter->ether_type == ETHER_TYPE_IPv4 || - efilter->ether_type == ETHER_TYPE_IPv6) { + if (efilter->ether_type == RTE_ETHER_TYPE_IPv4 || + efilter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "invalid ether_type(0x%04x) in" " ethertype filter.", efilter->ether_type); *ret = -EINVAL; @@ -1817,7 +1817,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, if (efilter->flags & RTE_ETHTYPE_FLAGS_DROP) { STAILQ_FOREACH(mfilter, &vnic0->filter, next) { if ((!memcmp(efilter->mac_addr.addr_bytes, - mfilter->l2_addr, ETHER_ADDR_LEN) && + mfilter->l2_addr, RTE_ETHER_ADDR_LEN) && mfilter->flags == HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DROP && mfilter->ethertype == efilter->ether_type)) { @@ -1828,7 +1828,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, } else { STAILQ_FOREACH(mfilter, &vnic->filter, next) if ((!memcmp(efilter->mac_addr.addr_bytes, - mfilter->l2_addr, ETHER_ADDR_LEN) && + mfilter->l2_addr, RTE_ETHER_ADDR_LEN) && mfilter->ethertype == efilter->ether_type && mfilter->flags == HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX)) { @@ -1883,9 +1883,9 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev, } bfilter->filter_type = HWRM_CFA_NTUPLE_FILTER; memcpy(bfilter->l2_addr, efilter->mac_addr.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(bfilter->dst_macaddr, efilter->mac_addr.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_DST_MACADDR; bfilter->ethertype = efilter->ether_type; bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE; @@ -2396,7 +2396,7 @@ bnxt_parse_fdir_filter(struct bnxt *bp, //filter1 = bnxt_get_l2_filter(bp, filter, vnic0); } else { filter->dst_id = vnic->fw_vnic_id; - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) if (filter->dst_macaddr[i] == 0x00) filter1 = STAILQ_FIRST(&vnic0->filter); else @@ -2440,13 +2440,13 @@ bnxt_match_fdir(struct bnxt *bp, struct bnxt_filter_info *nf, mf->l2_ovlan_mask == nf->l2_ovlan_mask && mf->l2_ivlan == nf->l2_ivlan && mf->l2_ivlan_mask == nf->l2_ivlan_mask && - !memcmp(mf->l2_addr, nf->l2_addr, ETHER_ADDR_LEN) && + !memcmp(mf->l2_addr, nf->l2_addr, RTE_ETHER_ADDR_LEN) && !memcmp(mf->l2_addr_mask, nf->l2_addr_mask, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_macaddr, nf->src_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->dst_macaddr, nf->dst_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_ipaddr, nf->src_ipaddr, sizeof(nf->src_ipaddr)) && !memcmp(mf->src_ipaddr_mask, nf->src_ipaddr_mask, @@ -3353,16 +3353,16 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) goto error_free; } eth_dev->data->mac_addrs = rte_zmalloc("bnxt_mac_addr_tbl", - ETHER_ADDR_LEN * bp->max_l2_ctx, 0); + RTE_ETHER_ADDR_LEN * bp->max_l2_ctx, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_DRV_LOG(ERR, "Failed to alloc %u bytes needed to store MAC addr tbl", - ETHER_ADDR_LEN * bp->max_l2_ctx); + RTE_ETHER_ADDR_LEN * bp->max_l2_ctx); rc = -ENOMEM; goto error_free; } - if (bnxt_check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) { + if (bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN)) { PMD_DRV_LOG(ERR, "Invalid MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n", bp->dflt_mac_addr[0], bp->dflt_mac_addr[1], @@ -3373,7 +3373,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC from the qcap response address now. */ memcpy(bp->mac_addr, bp->dflt_mac_addr, sizeof(bp->mac_addr)); - memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN); + memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, RTE_ETHER_ADDR_LEN); if (bp->max_ring_grps < bp->rx_cp_nr_rings) { /* 1 ring is for default completion ring */ diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index f43fe0db0..0aed29fb0 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -39,8 +39,8 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp) filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; memcpy(filter->l2_addr, bp->eth_dev->data->mac_addrs->addr_bytes, - ETHER_ADDR_LEN); - memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); + memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); return filter; } diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h index a1ecfb19d..f8bad29de 100644 --- a/drivers/net/bnxt/bnxt_filter.h +++ b/drivers/net/bnxt/bnxt_filter.h @@ -25,14 +25,14 @@ struct bnxt_filter_info { /* Filter Characteristics */ uint32_t flags; uint32_t enables; - uint8_t l2_addr[ETHER_ADDR_LEN]; - uint8_t l2_addr_mask[ETHER_ADDR_LEN]; + uint8_t l2_addr[RTE_ETHER_ADDR_LEN]; + uint8_t l2_addr_mask[RTE_ETHER_ADDR_LEN]; uint16_t l2_ovlan; uint16_t l2_ovlan_mask; uint16_t l2_ivlan; uint16_t l2_ivlan_mask; - uint8_t t_l2_addr[ETHER_ADDR_LEN]; - uint8_t t_l2_addr_mask[ETHER_ADDR_LEN]; + uint8_t t_l2_addr[RTE_ETHER_ADDR_LEN]; + uint8_t t_l2_addr_mask[RTE_ETHER_ADDR_LEN]; uint16_t t_l2_ovlan; uint16_t t_l2_ovlan_mask; uint16_t t_l2_ivlan; diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index a1f527d4f..947bf79c3 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -682,7 +682,7 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, f0 = STAILQ_FIRST(&vnic0->filter); /* This flow has same DST MAC as the port/l2 filter. */ - if (memcmp(f0->l2_addr, nf->dst_macaddr, ETHER_ADDR_LEN) == 0) + if (memcmp(f0->l2_addr, nf->dst_macaddr, RTE_ETHER_ADDR_LEN) == 0) return f0; /* This flow needs DST MAC which is not same as port/l2 */ @@ -694,8 +694,8 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, filter1->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter1->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | L2_FILTER_ALLOC_INPUT_EN_L2_ADDR_MASK; - memcpy(filter1->l2_addr, nf->dst_macaddr, ETHER_ADDR_LEN); - memset(filter1->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + memcpy(filter1->l2_addr, nf->dst_macaddr, RTE_ETHER_ADDR_LEN); + memset(filter1->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter1); if (rc) { @@ -951,13 +951,13 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf) mf->l2_ovlan_mask == nf->l2_ovlan_mask && mf->l2_ivlan == nf->l2_ivlan && mf->l2_ivlan_mask == nf->l2_ivlan_mask && - !memcmp(mf->l2_addr, nf->l2_addr, ETHER_ADDR_LEN) && + !memcmp(mf->l2_addr, nf->l2_addr, RTE_ETHER_ADDR_LEN) && !memcmp(mf->l2_addr_mask, nf->l2_addr_mask, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_macaddr, nf->src_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->dst_macaddr, nf->dst_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_ipaddr, nf->src_ipaddr, sizeof(nf->src_ipaddr)) && !memcmp(mf->src_ipaddr_mask, nf->src_ipaddr_mask, diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index e2fe4f7a0..279424072 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -393,11 +393,11 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp, if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR) memcpy(req.l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK) memcpy(req.l2_addr_mask, filter->l2_addr_mask, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN) req.l2_ovlan = filter->l2_ovlan; @@ -571,7 +571,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) } bp->fw_fid = rte_le_to_cpu_32(resp->fid); - memcpy(bp->dflt_mac_addr, &resp->mac_address, ETHER_ADDR_LEN); + memcpy(bp->dflt_mac_addr, &resp->mac_address, RTE_ETHER_ADDR_LEN); bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->max_rsscos_ctx); bp->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings); bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings); @@ -1329,8 +1329,8 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic) vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE; vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE; vnic->lb_rule = (uint16_t)HWRM_NA_SIGNATURE; - vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE; + vnic->mru = bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; HWRM_PREP(req, VNIC_ALLOC, BNXT_USE_CHIMP_MB); if (vnic->func_default) @@ -2516,8 +2516,8 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings) HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS); req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags); req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU); - req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx); req.num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx); @@ -2554,11 +2554,11 @@ static void populate_vf_func_cfg_req(struct bnxt *bp, HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS | HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS); - req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); - req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); req->num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx / (num_vfs + 1)); @@ -2589,7 +2589,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, rte_eth_random_addr(cfg_req->dflt_mac_addr); bp->pf.vf_info[vf].random_mac = true; } else { - memcpy(cfg_req->dflt_mac_addr, mac.addr_bytes, ETHER_ADDR_LEN); + memcpy(cfg_req->dflt_mac_addr, mac.addr_bytes, RTE_ETHER_ADDR_LEN); } } @@ -3125,7 +3125,7 @@ int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, HWRM_CHECK_RESULT(); - memcpy(mac->addr_bytes, resp->mac_address, ETHER_ADDR_LEN); + memcpy(mac->addr_bytes, resp->mac_address, RTE_ETHER_ADDR_LEN); HWRM_UNLOCK(); @@ -3696,11 +3696,11 @@ int bnxt_hwrm_set_em_filter(struct bnxt *bp, if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_MACADDR) memcpy(req.src_macaddr, filter->src_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_MACADDR) memcpy(req.dst_macaddr, filter->dst_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_OVLAN_VID) req.ovlan_vid = filter->l2_ovlan; @@ -3799,11 +3799,11 @@ int bnxt_hwrm_set_ntuple_filter(struct bnxt *bp, if (enables & HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR) memcpy(req.src_macaddr, filter->src_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); //if (enables & //HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_MACADDR) //memcpy(req.dst_macaddr, filter->dst_macaddr, - //ETHER_ADDR_LEN); + //RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_ETHERTYPE) req.ethertype = rte_cpu_to_be_16(filter->ethertype); diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index fcbd6bc6e..51fe35f3e 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -344,8 +344,8 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id; B_RX_DB(rxr->ag_doorbell, rxr->ag_prod); - rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN + - ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); + rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); if (bp->eth_dev->data->rx_queue_state[queue_index] == RTE_ETH_QUEUE_STATE_STARTED) { @@ -452,8 +452,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) bp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id; B_RX_DB(rxr->ag_doorbell, rxr->ag_prod); - rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN + - ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); + rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); if (bnxt_init_one_rx_ring(rxq)) { PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n"); bnxt_rx_queue_release_op(rxq); diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 17e2909a7..f1ee9eede 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -334,7 +334,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, rxq->queue_id = queue_idx; rxq->port_id = eth_dev->data->port_id; if (rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index dc695e177..089fbc7fb 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -640,7 +640,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) struct bnxt_rx_ring_info *rxr; struct bnxt_ring *ring; - rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN + + rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); rxq->rx_buf_size = rxq->rx_buf_use_size + sizeof(struct rte_mbuf); diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index aebfb1f1c..2cf5f0b5b 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -116,7 +116,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) uint32_t entry_length = RTE_CACHE_LINE_ROUNDUP( HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) + HW_HASH_KEY_SIZE + - BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN); + BNXT_MAX_MC_ADDRS * RTE_ETHER_ADDR_LEN); uint16_t max_vnics; int i; rte_iova_t mz_phys_addr; diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index 5e3d1bfb1..f07789670 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -698,7 +698,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, filter->enables == (HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK) && - memcmp(addr, filter->l2_addr, ETHER_ADDR_LEN) == 0) { + memcmp(addr, filter->l2_addr, RTE_ETHER_ADDR_LEN) == 0) { bnxt_hwrm_clear_l2_filter(bp, filter); break; } @@ -711,12 +711,12 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, filter->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; - memcpy(filter->l2_addr, addr, ETHER_ADDR_LEN); - memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + memcpy(filter->l2_addr, addr, RTE_ETHER_ADDR_LEN); + memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); /* Do not add a filter for the default MAC */ if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf_id, &dflt_mac) || - memcmp(filter->l2_addr, dflt_mac.addr_bytes, ETHER_ADDR_LEN)) + memcmp(filter->l2_addr, dflt_mac.addr_bytes, RTE_ETHER_ADDR_LEN)) rc = bnxt_hwrm_set_l2_filter(bp, vnic.fw_vnic_id, filter); exit: diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 7a775cd0c..fd61b0bd3 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -577,7 +577,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) /* Source and destination MAC */ rte_ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.d_addr); rte_eth_macaddr_get(slave_id, &hdr->eth_hdr.s_addr); - hdr->eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); + hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW); lacpdu = &hdr->lacpdu; memset(lacpdu, 0, sizeof(*lacpdu)); diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 5b7c3296e..4be742c91 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -205,9 +205,9 @@ bond_mode_alb_arp_upd(struct client_data *client_info, rte_ether_addr_copy(&client_info->app_mac, ð_h->s_addr); rte_ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); if (client_info->vlan_count > 0) - eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth_h->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else - eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); + eth_h->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct rte_ether_hdr) + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); @@ -221,8 +221,8 @@ bond_mode_alb_arp_upd(struct client_data *client_info, arp_h->arp_data.arp_tip = client_info->cli_ip; arp_h->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); - arp_h->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_h->arp_hlen = ETHER_ADDR_LEN; + arp_h->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); + arp_h->arp_hlen = RTE_ETHER_ADDR_LEN; arp_h->arp_plen = sizeof(uint32_t); arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index fc905776c..58c23a970 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -37,14 +37,14 @@ get_vlan_offset(struct rte_ether_hdr *eth_hdr, uint16_t *proto) { size_t vlan_offset = 0; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto || - rte_cpu_to_be_16(ETHER_TYPE_QINQ) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto || + rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ) == *proto) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; vlan_offset += sizeof(struct rte_vlan_hdr); @@ -107,7 +107,7 @@ bond_ethdev_rx_burst_active_backup(void *queue, struct rte_mbuf **bufs, static inline uint8_t is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf) { - const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); + const uint16_t ether_type_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); return !((mbuf->ol_flags & PKT_RX_VLAN) ? mbuf->vlan_tci : 0) && (ethertype == ether_type_slow_be && @@ -121,7 +121,7 @@ is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf) static struct rte_flow_item_eth flow_item_eth_type_8023ad = { .dst.addr_bytes = { 0 }, .src.addr_bytes = { 0 }, - .type = RTE_BE16(ETHER_TYPE_SLOW), + .type = RTE_BE16(RTE_ETHER_TYPE_SLOW), }; static struct rte_flow_item_eth flow_item_eth_mask_type_8023ad = { @@ -397,7 +397,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, struct rte_ether_addr *bond_mac = bonded_eth_dev->data->mac_addrs; struct rte_ether_hdr *hdr; - const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); + const uint16_t ether_type_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); uint16_t num_rx_total = 0; /* Total number of received packets */ uint16_t slaves[RTE_MAX_ETHPORTS]; uint16_t slave_count, idx; @@ -603,7 +603,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ strlcpy(buf, info, 16); #endif - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String); #ifdef RTE_LIBRTE_BOND_DEBUG_ALB @@ -613,7 +613,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ update_client_stats(ipv4_h->src_addr, port, burstnumber); } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { arp_h = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String); ipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String); @@ -642,14 +642,14 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) mode6_debug("RX ARP:", eth_h, bufs[i]->port, &burstnumberRX); #endif bond_mode_alb_arp_recv(eth_h, offset, internals); } #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) mode6_debug("RX IPv4:", eth_h, bufs[i]->port, &burstnumberRX); #endif } @@ -807,12 +807,12 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, vlan_offset = get_vlan_offset(eth_hdr, &proto); - if (rte_cpu_to_be_16(ETHER_TYPE_IPv4) == proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv4_hash(ipv4_hdr); - } else if (rte_cpu_to_be_16(ETHER_TYPE_IPv6) == proto) { + } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); @@ -846,7 +846,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l3hash = 0; l4hash = 0; - if (rte_cpu_to_be_16(ETHER_TYPE_IPv4) == proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); size_t ip_hdr_offset; @@ -873,7 +873,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = HASH_L4_PORTS(udp_hdr); } } - } else if (rte_cpu_to_be_16(ETHER_TYPE_IPv6) == proto) { + } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); @@ -1097,7 +1097,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { slave_idx = bond_mode_alb_arp_xmit(eth_h, offset, internals); /* Change src mac in eth header */ @@ -2236,7 +2236,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_pktlen = internals->candidate_max_rx_pktlen ? internals->candidate_max_rx_pktlen : - ETHER_MAX_JUMBO_FRAME_LEN; + RTE_ETHER_MAX_JUMBO_FRAME_LEN; /* Max number of tx/rx queues that the bonded device can support is the * minimum values of the bonded slaves, as all slaves must be capable @@ -3066,12 +3066,12 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) eth_dev->data->nb_tx_queues = (uint16_t)1; /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc_socket(name, RTE_ETHER_ADDR_LEN * BOND_MAX_MAC_ADDRS, 0, socket_id); if (eth_dev->data->mac_addrs == NULL) { RTE_BOND_LOG(ERR, "Failed to allocate %u bytes needed to store MAC addresses", - ETHER_ADDR_LEN * BOND_MAX_MAC_ADDRS); + RTE_ETHER_ADDR_LEN * BOND_MAX_MAC_ADDRS); goto err; } @@ -3130,7 +3130,7 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) } vlan_filter_bmp_size = - rte_bitmap_get_memory_footprint(ETHER_MAX_VLAN_ID + 1); + rte_bitmap_get_memory_footprint(RTE_ETHER_MAX_VLAN_ID + 1); internals->vlan_filter_bmpmem = rte_malloc(name, vlan_filter_bmp_size, RTE_CACHE_LINE_SIZE); if (internals->vlan_filter_bmpmem == NULL) { @@ -3140,7 +3140,7 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) goto err; } - internals->vlan_filter_bmp = rte_bitmap_init(ETHER_MAX_VLAN_ID + 1, + internals->vlan_filter_bmp = rte_bitmap_init(RTE_ETHER_MAX_VLAN_ID + 1, internals->vlan_filter_bmpmem, vlan_filter_bmp_size); if (internals->vlan_filter_bmp == NULL) { RTE_BOND_LOG(ERR, diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 122166410..66966a60d 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -204,8 +204,8 @@ struct eth_coalesce { unsigned int len; unsigned int flits; unsigned int max; - __u8 ethmacdst[ETHER_ADDR_LEN]; - __u8 ethmacsrc[ETHER_ADDR_LEN]; + __u8 ethmacdst[RTE_ETHER_ADDR_LEN]; + __u8 ethmacsrc[RTE_ETHER_ADDR_LEN]; __be16 ethtype; __be16 vlantci; }; diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 71ad1cb0f..608dd4f4c 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -4204,8 +4204,8 @@ int t4_alloc_raw_mac_filt(struct adapter *adap, unsigned int viid, V_DATAPORTNUM(M_DATAPORTNUM)); /* Copy the address and the mask */ - memcpy((u8 *)&p->data1[0] + 2, addr, ETHER_ADDR_LEN); - memcpy((u8 *)&p->data1m[0] + 2, mask, ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1[0] + 2, addr, RTE_ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1m[0] + 2, mask, RTE_ETHER_ADDR_LEN); ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); if (ret == 0) { @@ -4261,8 +4261,8 @@ int t4_free_raw_mac_filt(struct adapter *adap, unsigned int viid, V_DATAPORTNUM(M_DATAPORTNUM)); /* Copy the address and the mask */ - memcpy((u8 *)&p->data1[0] + 2, addr, ETHER_ADDR_LEN); - memcpy((u8 *)&p->data1m[0] + 2, mask, ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1[0] + 2, addr, RTE_ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1m[0] + 2, mask, RTE_ETHER_ADDR_LEN); return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); } diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h index 5a7490f91..5d5baace4 100644 --- a/drivers/net/cxgbe/cxgbe.h +++ b/drivers/net/cxgbe/cxgbe.h @@ -15,8 +15,8 @@ #define CXGBE_DEFAULT_TX_DESC_SIZE 1024 /* Default TX ring size */ #define CXGBE_DEFAULT_RX_DESC_SIZE 1024 /* Default RX ring size */ -#define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU /* min buf size */ -#define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */ +#define CXGBE_MIN_RX_BUFSIZE RTE_ETHER_MIN_MTU /* min buf size */ +#define CXGBE_MAX_RX_PKTLEN (9000 + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN) /* max pkt */ /* Max poll time is 100 * 100msec = 10 sec */ #define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */ diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index bdda51894..ae30b92f8 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -276,16 +276,16 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) struct adapter *adapter = pi->adapter; struct rte_eth_dev_info dev_info; int err; - uint16_t new_mtu = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint16_t new_mtu = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; cxgbe_dev_info_get(eth_dev, &dev_info); - /* Must accommodate at least ETHER_MIN_MTU */ - if ((new_mtu < ETHER_MIN_MTU) || (new_mtu > dev_info.max_rx_pktlen)) + /* Must accommodate at least RTE_ETHER_MIN_MTU */ + if ((new_mtu < RTE_ETHER_MIN_MTU) || (new_mtu > dev_info.max_rx_pktlen)) return -EINVAL; /* set to jumbo mode if needed */ - if (new_mtu > ETHER_MAX_LEN) + if (new_mtu > RTE_ETHER_MAX_LEN) eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -586,7 +586,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, cxgbe_dev_info_get(eth_dev, &dev_info); - /* Must accommodate at least ETHER_MIN_MTU */ + /* Must accommodate at least RTE_ETHER_MIN_MTU */ if ((pkt_len < dev_info.min_rx_bufsize) || (pkt_len > dev_info.max_rx_pktlen)) { dev_err(adap, "%s: max pkt len must be > %d and <= %d\n", @@ -625,7 +625,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, rxq->fl.size = temp_nb_desc; /* Set to jumbo mode if necessary */ - if (pkt_len > ETHER_MAX_LEN) + if (pkt_len > RTE_ETHER_MAX_LEN) eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else diff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h index 6f6e25c63..0c67d2d15 100644 --- a/drivers/net/cxgbe/cxgbe_filter.h +++ b/drivers/net/cxgbe/cxgbe_filter.h @@ -102,7 +102,7 @@ struct ch_filter_specification { uint32_t eport:2; /* egress port to switch packet out */ uint32_t swapmac:1; /* swap SMAC/DMAC for loopback packet */ uint32_t newvlan:2; /* rewrite VLAN Tag */ - uint8_t dmac[ETHER_ADDR_LEN]; /* new destination MAC address */ + uint8_t dmac[RTE_ETHER_ADDR_LEN]; /* new destination MAC address */ uint16_t vlan; /* VLAN Tag to insert */ /* diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index a7b053b4a..4f23468b8 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -233,7 +233,7 @@ ch_rte_parsetype_ipv4(const void *dmask, const struct rte_flow_item *item, item, "ttl/tos are not supported"); fs->type = FILTER_TYPE_IPV4; - CXGBE_FILL_FS(ETHER_TYPE_IPv4, 0xffff, ethtype); + CXGBE_FILL_FS(RTE_ETHER_TYPE_IPv4, 0xffff, ethtype); if (!val) return 0; /* ipv4 wild card */ @@ -262,7 +262,7 @@ ch_rte_parsetype_ipv6(const void *dmask, const struct rte_flow_item *item, "tc/flow/hop are not supported"); fs->type = FILTER_TYPE_IPV6; - CXGBE_FILL_FS(ETHER_TYPE_IPv6, 0xffff, ethtype); + CXGBE_FILL_FS(RTE_ETHER_TYPE_IPv6, 0xffff, ethtype); if (!val) return 0; /* ipv6 wild card */ @@ -448,7 +448,7 @@ ch_rte_parse_atype_switch(const struct rte_flow_action *a, case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: pushvlan = (const struct rte_flow_action_of_push_vlan *) a->conf; - if (pushvlan->ethertype != ETHER_TYPE_VLAN) + if (pushvlan->ethertype != RTE_ETHER_TYPE_VLAN) return rte_flow_error_set(e, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, a, "only ethertype 0x8100 " diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index fd0707b95..57212a89c 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -1348,7 +1348,7 @@ int link_start(struct port_info *pi) int ret; mtu = pi->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - - (ETHER_HDR_LEN + ETHER_CRC_LEN); + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN); conf_offloads = pi->eth_dev->data->dev_conf.rxmode.offloads; @@ -1841,7 +1841,7 @@ int cxgbe_probe(struct adapter *adapter) rte_eth_copy_pci_info(pi->eth_dev, adapter->pdev); pi->eth_dev->data->mac_addrs = rte_zmalloc(name, - ETHER_ADDR_LEN, 0); + RTE_ETHER_ADDR_LEN, 0); if (!pi->eth_dev->data->mac_addrs) { dev_err(adapter, "%s: Mem allocation failed for storing mac addr, aborting\n", __func__); diff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c index f440b4345..46432c26c 100644 --- a/drivers/net/cxgbe/cxgbevf_main.c +++ b/drivers/net/cxgbe/cxgbevf_main.c @@ -245,7 +245,7 @@ int cxgbevf_probe(struct adapter *adapter) rte_eth_copy_pci_info(pi->eth_dev, adapter->pdev); pi->eth_dev->data->mac_addrs = rte_zmalloc(name, - ETHER_ADDR_LEN, 0); + RTE_ETHER_ADDR_LEN, 0); if (!pi->eth_dev->data->mac_addrs) { dev_err(adapter, "%s: Mem allocation failed for storing mac addr, aborting\n", __func__); diff --git a/drivers/net/cxgbe/l2t.c b/drivers/net/cxgbe/l2t.c index 27cdf6f33..6faf624f7 100644 --- a/drivers/net/cxgbe/l2t.c +++ b/drivers/net/cxgbe/l2t.c @@ -81,10 +81,10 @@ static int write_l2e(struct rte_eth_dev *dev, struct l2t_entry *e, int sync, V_L2T_W_NOREPLY(!sync)); req->l2t_idx = cpu_to_be16(l2t_idx); req->vlan = cpu_to_be16(e->vlan); - rte_memcpy(req->dst_mac, e->dmac, ETHER_ADDR_LEN); + rte_memcpy(req->dst_mac, e->dmac, RTE_ETHER_ADDR_LEN); if (loopback) - memset(req->dst_mac, 0, ETHER_ADDR_LEN); + memset(req->dst_mac, 0, RTE_ETHER_ADDR_LEN); t4_mgmt_tx(ctrlq, mbuf); @@ -116,7 +116,7 @@ static struct l2t_entry *find_or_alloc_l2e(struct l2t_data *d, u16 vlan, first_free = e; } else { if (e->state == L2T_STATE_SWITCHING) { - if ((!memcmp(e->dmac, dmac, ETHER_ADDR_LEN)) && + if ((!memcmp(e->dmac, dmac, RTE_ETHER_ADDR_LEN)) && e->vlan == vlan && e->lport == port) goto exists; } @@ -154,7 +154,7 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev, e->state = L2T_STATE_SWITCHING; e->vlan = vlan; e->lport = port; - rte_memcpy(e->dmac, eth_addr, ETHER_ADDR_LEN); + rte_memcpy(e->dmac, eth_addr, RTE_ETHER_ADDR_LEN); rte_atomic32_set(&e->refcnt, 1); ret = write_l2e(dev, e, 0, !L2T_LPBK, !L2T_ARPMISS); if (ret < 0) diff --git a/drivers/net/cxgbe/l2t.h b/drivers/net/cxgbe/l2t.h index ee40dc1f6..326abfde4 100644 --- a/drivers/net/cxgbe/l2t.h +++ b/drivers/net/cxgbe/l2t.h @@ -28,7 +28,7 @@ struct l2t_entry { u16 idx; /* entry index within in-memory table */ u16 vlan; /* VLAN TCI (id: bits 0-11, prio: 13-15 */ u8 lport; /* destination port */ - u8 dmac[ETHER_ADDR_LEN]; /* destination MAC address */ + u8 dmac[RTE_ETHER_ADDR_LEN]; /* destination MAC address */ rte_spinlock_t lock; /* entry lock */ rte_atomic32_t refcnt; /* entry reference count */ }; diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c index 71c8070b3..5302d1343 100644 --- a/drivers/net/cxgbe/mps_tcam.c +++ b/drivers/net/cxgbe/mps_tcam.c @@ -8,8 +8,8 @@ static inline bool match_entry(struct mps_tcam_entry *entry, const u8 *eth_addr, const u8 *mask) { - if (!memcmp(eth_addr, entry->eth_addr, ETHER_ADDR_LEN) && - !memcmp(mask, entry->mask, ETHER_ADDR_LEN)) + if (!memcmp(eth_addr, entry->eth_addr, RTE_ETHER_ADDR_LEN) && + !memcmp(mask, entry->mask, RTE_ETHER_ADDR_LEN)) return true; return false; } @@ -95,8 +95,8 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr, /* Fill in the new values */ entry = &mpstcam->entry[ret]; - memcpy(entry->eth_addr, eth_addr, ETHER_ADDR_LEN); - memcpy(entry->mask, mask, ETHER_ADDR_LEN); + memcpy(entry->eth_addr, eth_addr, RTE_ETHER_ADDR_LEN); + memcpy(entry->mask, mask, RTE_ETHER_ADDR_LEN); rte_atomic32_set(&entry->refcnt, 1); entry->state = MPS_ENTRY_USED; @@ -139,7 +139,7 @@ int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr) /* idx can now be different from what user provided */ entry = &mpstcam->entry[idx]; - memcpy(entry->eth_addr, addr, ETHER_ADDR_LEN); + memcpy(entry->eth_addr, addr, RTE_ETHER_ADDR_LEN); /* NOTE: we have considered the case that idx returned by t4_change_mac * will be different from the user provided value only if user * provided value is -1 @@ -161,8 +161,8 @@ int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr) */ static inline void reset_mpstcam_entry(struct mps_tcam_entry *entry) { - memset(entry->eth_addr, 0, ETHER_ADDR_LEN); - memset(entry->mask, 0, ETHER_ADDR_LEN); + memset(entry->eth_addr, 0, RTE_ETHER_ADDR_LEN); + memset(entry->mask, 0, RTE_ETHER_ADDR_LEN); rte_atomic32_clear(&entry->refcnt); entry->state = MPS_ENTRY_UNUSED; } diff --git a/drivers/net/cxgbe/mps_tcam.h b/drivers/net/cxgbe/mps_tcam.h index f86bac7bd..3d1e8d3db 100644 --- a/drivers/net/cxgbe/mps_tcam.h +++ b/drivers/net/cxgbe/mps_tcam.h @@ -24,8 +24,8 @@ struct mps_tcam_entry { u16 idx; /* add data here which uniquely defines an entry */ - u8 eth_addr[ETHER_ADDR_LEN]; - u8 mask[ETHER_ADDR_LEN]; + u8 eth_addr[RTE_ETHER_ADDR_LEN]; + u8 mask[RTE_ETHER_ADDR_LEN]; struct mpstcam_table *mpstcam; /* backptr */ rte_atomic32_t refcnt; diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 3a0eba5df..4f02f0647 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -73,7 +73,7 @@ static inline unsigned int fl_mtu_bufsize(struct adapter *adapter, { struct sge *s = &adapter->sge; - return CXGBE_ALIGN(s->pktshift + ETHER_HDR_LEN + VLAN_HLEN + mtu, + return CXGBE_ALIGN(s->pktshift + RTE_ETHER_HDR_LEN + VLAN_HLEN + mtu, s->fl_align); } @@ -1128,7 +1128,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, * The chip min packet length is 10 octets but play safe and reject * anything shorter than an Ethernet header. */ - if (unlikely(m->pkt_len < ETHER_HDR_LEN)) { + if (unlikely(m->pkt_len < RTE_ETHER_HDR_LEN)) { out_free: rte_pktmbuf_free(m); return 0; @@ -1145,7 +1145,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, /* align the end of coalesce WR to a 512 byte boundary */ txq->q.coalesce.max = (8 - (txq->q.pidx & 7)) * 8; - if (!((m->ol_flags & PKT_TX_TCP_SEG) || (m->pkt_len > ETHER_MAX_LEN))) { + if (!((m->ol_flags & PKT_TX_TCP_SEG) || (m->pkt_len > RTE_ETHER_MAX_LEN))) { if (should_tx_packet_coalesce(txq, mbuf, &cflits, adap)) { if (unlikely(map_mbuf(mbuf, addr) < 0)) { dev_warn(adap, "%s: mapping err for coalesce\n", @@ -1230,7 +1230,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, v6 = (m->ol_flags & PKT_TX_IPV6) != 0; l3hdr_len = m->l3_len; l4hdr_len = m->l4_len; - eth_xtra_len = m->l2_len - ETHER_HDR_LEN; + eth_xtra_len = m->l2_len - RTE_ETHER_HDR_LEN; len += sizeof(*lso); wr->op_immdlen = htonl(V_FW_WR_OP(is_pf4(adap) ? FW_ETH_TX_PKT_WR : diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 6716dd0cf..2cc163eaf 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -146,13 +146,13 @@ static int dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct dpaa_if *dpaa_intf = dev->data->dev_private; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; uint32_t buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM; PMD_INIT_FUNC_TRACE(); - if (mtu < ETHER_MIN_MTU || frame_size > DPAA_MAX_RX_PKT_LEN) + if (mtu < RTE_ETHER_MIN_MTU || frame_size > DPAA_MAX_RX_PKT_LEN) return -EINVAL; /* * Refuse mtu that requires the support of scattered packets @@ -172,7 +172,7 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EINVAL; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads &= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -230,7 +230,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) fman_if_set_maxfrm(dpaa_intf->fif, max_len); dev->data->mtu = max_len - - ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE; + - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN - VLAN_TAG_SIZE; } if (rx_offloads & DEV_RX_OFFLOAD_SCATTER) { @@ -1364,11 +1364,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) /* Allocate memory for storing MAC addresses */ eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", - ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0); + RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0); if (eth_dev->data->mac_addrs == NULL) { DPAA_PMD_ERR("Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER); + RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER); ret = -ENOMEM; goto free_tx; } @@ -1396,7 +1396,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) fman_if_stats_reset(fman_intf); /* Disable SG by default */ fman_if_set_sg(fman_intf, 0); - fman_if_set_maxfrm(fman_intf, ETHER_MAX_LEN + VLAN_TAG_SIZE); + fman_if_set_maxfrm(fman_intf, RTE_ETHER_MAX_LEN + VLAN_TAG_SIZE); return 0; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index dd8fd8fd5..ff061df25 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -221,10 +221,10 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + mbuf->l3_len); tcp_hdr->cksum = 0; - if (eth_hdr->ether_type == htons(ETHER_TYPE_IPv4)) + if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) tcp_hdr->cksum = rte_ipv4_udptcp_cksum(ipv4_hdr, tcp_hdr); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ tcp_hdr->cksum = rte_ipv6_udptcp_cksum(ipv6_hdr, tcp_hdr); } else if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == @@ -232,10 +232,10 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) struct udp_hdr *udp_hdr = (struct udp_hdr *)(l3_hdr + mbuf->l3_len); udp_hdr->dgram_cksum = 0; - if (eth_hdr->ether_type == htons(ETHER_TYPE_IPv4)) + if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) udp_hdr->dgram_cksum = rte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ udp_hdr->dgram_cksum = rte_ipv6_udptcp_cksum(ipv6_hdr, udp_hdr); } diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 40e357127..3488aa63c 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1086,7 +1086,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) int ret; struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; PMD_INIT_FUNC_TRACE(); @@ -1097,10 +1097,10 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > DPAA2_MAX_RX_PKT_LEN)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > DPAA2_MAX_RX_PKT_LEN)) return -EINVAL; - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads &= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -2185,11 +2185,11 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) * can add MAC entries when rte_eth_dev_mac_addr_add is called. */ eth_dev->data->mac_addrs = rte_zmalloc("dpni", - ETHER_ADDR_LEN * attr.mac_filter_entries, 0); + RTE_ETHER_ADDR_LEN * attr.mac_filter_entries, 0); if (eth_dev->data->mac_addrs == NULL) { DPAA2_PMD_ERR( "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN * attr.mac_filter_entries); + RTE_ETHER_ADDR_LEN * attr.mac_filter_entries); ret = -ENOMEM; goto init_err; } diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index 3e74cd8fe..8f19f0434 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -92,7 +92,7 @@ * The overhead from MTU to max frame size. * Considering VLAN so a tag needs to be counted. */ -#define E1000_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE) +#define E1000_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE) /* * Maximum number of Ring Descriptors. @@ -155,7 +155,7 @@ struct e1000_vfta { */ #define E1000_MAX_VF_MC_ENTRIES 30 struct e1000_vf_info { - uint8_t vf_mac_addresses[ETHER_ADDR_LEN]; + uint8_t vf_mac_addresses[RTE_ETHER_ADDR_LEN]; uint16_t vf_mc_hashes[E1000_MAX_VF_MC_ENTRIES]; uint16_t num_vf_mc_hashes; uint16_t default_vf_vlan_id; diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 355ffc8b1..c8e42c98b 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -283,12 +283,12 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("e1000", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("e1000", RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * hw->mac.rar_entry_count); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count); return -ENOMEM; } @@ -575,7 +575,7 @@ eth_em_start(struct rte_eth_dev *dev) return -EIO; } - E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN); + E1000_WRITE_REG(hw, E1000_VET, RTE_ETHER_TYPE_VLAN); /* Configure for OS presence */ em_init_manageability(hw); @@ -820,7 +820,7 @@ em_hardware_init(struct e1000_hw *hw) */ rx_buf_size = em_get_rx_buffer_size(hw); - hw->fc.high_water = rx_buf_size - PMD_ROUNDUP(ETHER_MAX_LEN * 2, 1024); + hw->fc.high_water = rx_buf_size - PMD_ROUNDUP(RTE_ETHER_MAX_LEN * 2, 1024); hw->fc.low_water = hw->fc.high_water - 1500; if (hw->mac.type == e1000_80003es2lan) @@ -1036,7 +1036,7 @@ em_get_max_pktlen(struct rte_eth_dev *dev) return 0x1000; /* Adapters that do not support jumbo frames */ case e1000_ich8lan: - return ETHER_MAX_LEN; + return RTE_ETHER_MAX_LEN; default: return MAX_JUMBO_FRAME_SIZE; } @@ -1696,7 +1696,7 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x", rx_buf_size); /* At least reserve one Ethernet frame for watermark */ - max_high_water = rx_buf_size - ETHER_MAX_LEN; + max_high_water = rx_buf_size - RTE_ETHER_MAX_LEN; if ((fc_conf->high_water > max_high_water) || (fc_conf->high_water < fc_conf->low_water)) { PMD_INIT_LOG(ERR, "e1000 incorrect high/low water value"); @@ -1746,7 +1746,7 @@ eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) { - uint8_t addr[ETHER_ADDR_LEN]; + uint8_t addr[RTE_ETHER_ADDR_LEN]; struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); memset(addr, 0, sizeof(addr)); @@ -1772,10 +1772,10 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t rctl; eth_em_infos_get(dev, &dev_info); - frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE; + frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; /* refuse mtu that requires the support of scattered packets when this @@ -1788,7 +1788,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) rctl = E1000_READ_REG(hw, E1000_RCTL); /* switch to jumbo mode if needed */ - if (frame_size > ETHER_MAX_LEN) { + if (frame_size > RTE_ETHER_MAX_LEN) { dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; rctl |= E1000_RCTL_LPE; diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 005e1ea96..e09cc8d49 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -1005,17 +1005,17 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (data_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (data_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t) (last_seg->data_len - - (ETHER_CRC_LEN - data_len)); + (RTE_ETHER_CRC_LEN - data_len)); last_seg->next = NULL; } else rxm->data_len = - (uint16_t) (data_len - ETHER_CRC_LEN); + (uint16_t) (data_len - RTE_ETHER_CRC_LEN); } /* @@ -1368,7 +1368,7 @@ em_get_rx_port_offloads_capa(struct rte_eth_dev *dev) DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_KEEP_CRC | DEV_RX_OFFLOAD_SCATTER; - if (max_rx_pktlen > ETHER_MAX_LEN) + if (max_rx_pktlen > RTE_ETHER_MAX_LEN) rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME; return rx_offload_capa; @@ -1463,7 +1463,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev, rxq->queue_id = queue_idx; rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -1799,7 +1799,7 @@ eth_em_rx_init(struct rte_eth_dev *dev) * call to configure */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -1832,7 +1832,7 @@ eth_em_rx_init(struct rte_eth_dev *dev) * one buffer. */ if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME || - rctl_bsize < ETHER_MAX_LEN) { + rctl_bsize < RTE_ETHER_MAX_LEN) { if (!dev->data->scattered_rx) PMD_INIT_LOG(DEBUG, "forcing scatter mode"); dev->rx_pkt_burst = diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index e5d69251f..089eb79b3 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -830,11 +830,11 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) /* Allocate memory for storing MAC addresses */ eth_dev->data->mac_addrs = rte_zmalloc("e1000", - ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * hw->mac.rar_entry_count); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count); error = -ENOMEM; goto err_late; } @@ -1026,13 +1026,13 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) diag = hw->mac.ops.reset_hw(hw); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("igbvf", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("igbvf", RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC " "addresses", - ETHER_ADDR_LEN * hw->mac.rar_entry_count); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count); return -ENOMEM; } @@ -1320,7 +1320,7 @@ eth_igb_start(struct rte_eth_dev *dev) } adapter->stopped = 0; - E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN << 16 | ETHER_TYPE_VLAN); + E1000_WRITE_REG(hw, E1000_VET, RTE_ETHER_TYPE_VLAN << 16 | RTE_ETHER_TYPE_VLAN); ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); /* Set PF Reset Done bit so PF/VF Mail Ops can work */ @@ -1687,7 +1687,7 @@ igb_hardware_init(struct e1000_hw *hw) */ rx_buf_size = igb_get_rx_buffer_size(hw); - hw->fc.high_water = rx_buf_size - (ETHER_MAX_LEN * 2); + hw->fc.high_water = rx_buf_size - (RTE_ETHER_MAX_LEN * 2); hw->fc.low_water = hw->fc.high_water - 1500; hw->fc.pause_time = IGB_FC_PAUSE_TIME; hw->fc.send_xon = 1; @@ -1706,7 +1706,7 @@ igb_hardware_init(struct e1000_hw *hw) if (diag < 0) return diag; - E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN << 16 | ETHER_TYPE_VLAN); + E1000_WRITE_REG(hw, E1000_VET, RTE_ETHER_TYPE_VLAN << 16 | RTE_ETHER_TYPE_VLAN); e1000_get_phy_info(hw); e1000_check_for_link(hw); @@ -1770,10 +1770,10 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats) /* Workaround CRC bytes included in size, take away 4 bytes/packet */ stats->gorc += E1000_READ_REG(hw, E1000_GORCL); stats->gorc += ((uint64_t)E1000_READ_REG(hw, E1000_GORCH) << 32); - stats->gorc -= (stats->gprc - old_gprc) * ETHER_CRC_LEN; + stats->gorc -= (stats->gprc - old_gprc) * RTE_ETHER_CRC_LEN; stats->gotc += E1000_READ_REG(hw, E1000_GOTCL); stats->gotc += ((uint64_t)E1000_READ_REG(hw, E1000_GOTCH) << 32); - stats->gotc -= (stats->gptc - old_gptc) * ETHER_CRC_LEN; + stats->gotc -= (stats->gptc - old_gptc) * RTE_ETHER_CRC_LEN; stats->rnbc += E1000_READ_REG(hw, E1000_RNBC); stats->ruc += E1000_READ_REG(hw, E1000_RUC); @@ -1786,10 +1786,10 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats) stats->tor += E1000_READ_REG(hw, E1000_TORL); stats->tor += ((uint64_t)E1000_READ_REG(hw, E1000_TORH) << 32); - stats->tor -= (stats->tpr - old_tpr) * ETHER_CRC_LEN; + stats->tor -= (stats->tpr - old_tpr) * RTE_ETHER_CRC_LEN; stats->tot += E1000_READ_REG(hw, E1000_TOTL); stats->tot += ((uint64_t)E1000_READ_REG(hw, E1000_TOTH) << 32); - stats->tot -= (stats->tpt - old_tpt) * ETHER_CRC_LEN; + stats->tot -= (stats->tpt - old_tpt) * RTE_ETHER_CRC_LEN; stats->ptc64 += E1000_READ_REG(hw, E1000_PTC64); stats->ptc127 += E1000_READ_REG(hw, E1000_PTC127); @@ -1823,10 +1823,10 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats) stats->htcbdpc += E1000_READ_REG(hw, E1000_HTCBDPC); stats->hgorc += E1000_READ_REG(hw, E1000_HGORCL); stats->hgorc += ((uint64_t)E1000_READ_REG(hw, E1000_HGORCH) << 32); - stats->hgorc -= (stats->rpthc - old_rpthc) * ETHER_CRC_LEN; + stats->hgorc -= (stats->rpthc - old_rpthc) * RTE_ETHER_CRC_LEN; stats->hgotc += E1000_READ_REG(hw, E1000_HGOTCL); stats->hgotc += ((uint64_t)E1000_READ_REG(hw, E1000_HGOTCH) << 32); - stats->hgotc -= (stats->hgptc - old_hgptc) * ETHER_CRC_LEN; + stats->hgotc -= (stats->hgptc - old_hgptc) * RTE_ETHER_CRC_LEN; stats->lenerrs += E1000_READ_REG(hw, E1000_LENERRS); stats->scvpc += E1000_READ_REG(hw, E1000_SCVPC); stats->hrmpc += E1000_READ_REG(hw, E1000_HRMPC); @@ -2286,7 +2286,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) ETH_LINK_SPEED_1G; dev_info->max_mtu = dev_info->max_rx_pktlen - E1000_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; } @@ -3079,7 +3079,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x", rx_buf_size); /* At least reserve one Ethernet frame for watermark */ - max_high_water = rx_buf_size - ETHER_MAX_LEN; + max_high_water = rx_buf_size - RTE_ETHER_MAX_LEN; if ((fc_conf->high_water > max_high_water) || (fc_conf->high_water < fc_conf->low_water)) { PMD_INIT_LOG(ERR, "e1000 incorrect high/low water value"); @@ -3135,7 +3135,7 @@ eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) { - uint8_t addr[ETHER_ADDR_LEN]; + uint8_t addr[RTE_ETHER_ADDR_LEN]; struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); memset(addr, 0, sizeof(addr)); @@ -4483,7 +4483,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) eth_igb_infos_get(dev, &dev_info); /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; @@ -4496,7 +4496,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) rctl = E1000_READ_REG(hw, E1000_RCTL); /* switch to jumbo mode if needed */ - if (frame_size > ETHER_MAX_LEN) { + if (frame_size > RTE_ETHER_MAX_LEN) { dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; rctl |= E1000_RCTL_LPE; @@ -4742,8 +4742,8 @@ igb_add_del_ethertype_filter(struct rte_eth_dev *dev, uint32_t etqf = 0; int ret; - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in" " ethertype filter.", filter->ether_type); return -EINVAL; @@ -5154,7 +5154,7 @@ igb_timesync_enable(struct rte_eth_dev *dev) /* Enable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ E1000_WRITE_REG(hw, E1000_ETQF(E1000_ETQF_FILTER_1588), - (ETHER_TYPE_1588 | + (RTE_ETHER_TYPE_1588 | E1000_ETQF_FILTER_ENABLE | E1000_ETQF_1588)); diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index 8dcfc71c5..342986121 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -700,8 +700,8 @@ igb_parse_ethertype_filter(struct rte_eth_dev *dev, } } - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { memset(filter, 0, sizeof(struct rte_eth_ethertype_filter)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index ab48a269f..f026d83a9 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -37,7 +37,7 @@ dev_num_vf(struct rte_eth_dev *eth_dev) static inline int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) { - unsigned char vf_mac_addr[ETHER_ADDR_LEN]; + unsigned char vf_mac_addr[RTE_ETHER_ADDR_LEN]; struct e1000_vf_info *vfinfo = *E1000_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); uint16_t vfn; @@ -46,7 +46,7 @@ int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) rte_eth_random_addr(vf_mac_addr); /* keep the random address as default */ memcpy(vfinfo[vfn].vf_mac_addresses, vf_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } return 0; @@ -290,7 +290,7 @@ igb_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, ETHER_ADDR_LEN); + rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); e1000_write_mbx(hw, msgbuf, 3, vf); return 0; @@ -400,10 +400,10 @@ igb_vf_set_rlpml(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint16_t rlpml = msgbuf[1] & E1000_VMOLR_RLPML_MASK; - uint32_t max_frame = rlpml + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t max_frame = rlpml + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; uint32_t vmolr; - if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) + if ((max_frame < RTE_ETHER_MIN_LEN) || (max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)) return -1; vmolr = E1000_READ_REG(hw, E1000_VMOLR(vf)); diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index ab0a80e15..ee51eca97 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1147,17 +1147,17 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (data_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (data_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t) (last_seg->data_len - - (ETHER_CRC_LEN - data_len)); + (RTE_ETHER_CRC_LEN - data_len)); last_seg->next = NULL; } else rxm->data_len = - (uint16_t) (data_len - ETHER_CRC_LEN); + (uint16_t) (data_len - RTE_ETHER_CRC_LEN); } /* @@ -1725,7 +1725,7 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev, queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx); rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -2378,7 +2378,7 @@ eth_igb_rx_init(struct rte_eth_dev *dev) * call to configure */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index 221760c62..dcc8690a5 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -198,7 +198,7 @@ struct ena_adapter { int id_number; char name[ENA_NAME_MAX_LEN]; - u8 mac_addr[ETHER_ADDR_LEN]; + u8 mac_addr[RTE_ETHER_ADDR_LEN]; void *regs; void *dev_mem_base; diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h index f36fa11e0..3c876963c 100644 --- a/drivers/net/enetc/base/enetc_hw.h +++ b/drivers/net/enetc/base/enetc_hw.h @@ -170,8 +170,8 @@ struct enetc_hw { }; struct enetc_eth_mac_info { - uint8_t addr[ETHER_ADDR_LEN]; - uint8_t perm_addr[ETHER_ADDR_LEN]; + uint8_t addr[RTE_ETHER_ADDR_LEN]; + uint8_t perm_addr[RTE_ETHER_ADDR_LEN]; uint8_t get_link_status; }; diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 3aa4977ff..b45b3b65c 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -88,11 +88,11 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("enetc_eth", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("enetc_eth", RTE_ETHER_ADDR_LEN, 0); if (!eth_dev->data->mac_addrs) { ENETC_PMD_ERR("Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * 1); + RTE_ETHER_ADDR_LEN * 1); error = -ENOMEM; return -1; } diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 20080af6f..bd2783430 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -204,7 +204,7 @@ struct enic { static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu) { /* ethdev max size includes eth whereas NIC MTU does not */ - return mtu + ETHER_HDR_LEN; + return mtu + RTE_ETHER_HDR_LEN; } /* Get the CQ index from a Start of Packet(SOP) RQ index */ diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 597c1f214..29025a12a 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -646,9 +646,9 @@ static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { - char mac_str[ETHER_ADDR_FMT_SIZE]; + char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(DEBUG, " %s address %s\n", add ? "add" : "remove", mac_str); } @@ -658,7 +658,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, uint32_t nb_mc_addr) { struct enic *enic = pmd_priv(eth_dev); - char mac_str[ETHER_ADDR_FMT_SIZE]; + char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; struct rte_ether_addr *addr; uint32_t i, j; int ret; @@ -670,7 +670,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, addr = &mc_addr_set[i]; if (!rte_is_multicast_ether_addr(addr) || rte_is_broadcast_ether_addr(addr)) { - rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(ERR, " invalid multicast address %s\n", mac_str); return -EINVAL; diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 94c443a98..4996fdf8a 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -592,7 +592,7 @@ enic_copy_item_inner_vlan_v2(struct copy_item_args *arg) arg->l2_proto_off = *off + offsetof(struct rte_vlan_hdr, eth_proto); return copy_inner_common(&arg->filter->u.generic_1, off, arg->item->spec, mask, sizeof(struct rte_vlan_hdr), - eth_type_off, rte_cpu_to_be_16(ETHER_TYPE_VLAN), 2); + eth_type_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN), 2); } static int @@ -608,7 +608,7 @@ enic_copy_item_inner_ipv4_v2(struct copy_item_args *arg) arg->l3_proto_off = *off + offsetof(struct ipv4_hdr, next_proto_id); return copy_inner_common(&arg->filter->u.generic_1, off, arg->item->spec, mask, sizeof(struct ipv4_hdr), - arg->l2_proto_off, rte_cpu_to_be_16(ETHER_TYPE_IPv4), 2); + arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4), 2); } static int @@ -624,7 +624,7 @@ enic_copy_item_inner_ipv6_v2(struct copy_item_args *arg) arg->l3_proto_off = *off + offsetof(struct ipv6_hdr, proto); return copy_inner_common(&arg->filter->u.generic_1, off, arg->item->spec, mask, sizeof(struct ipv6_hdr), - arg->l2_proto_off, rte_cpu_to_be_16(ETHER_TYPE_IPv6), 2); + arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6), 2); } static int @@ -678,14 +678,14 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) mask = &rte_flow_item_eth_mask; memcpy(enic_spec.d_addr.addr_bytes, spec->dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(enic_spec.s_addr.addr_bytes, spec->src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(enic_mask.d_addr.addr_bytes, mask->dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(enic_mask.s_addr.addr_bytes, mask->src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); enic_spec.ether_type = spec->type; enic_mask.ether_type = mask->type; diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c index f7cbc90fb..b92b8232e 100644 --- a/drivers/net/enic/enic_res.c +++ b/drivers/net/enic/enic_res.c @@ -61,9 +61,9 @@ int enic_get_vnic_config(struct enic *enic) * and will be 0 for legacy firmware and VICs */ if (c->max_pkt_size > ENIC_DEFAULT_RX_MAX_PKT_SIZE) - enic->max_mtu = c->max_pkt_size - ETHER_HDR_LEN; + enic->max_mtu = c->max_pkt_size - RTE_ETHER_HDR_LEN; else - enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - ETHER_HDR_LEN; + enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - RTE_ETHER_HDR_LEN; if (c->mtu == 0) c->mtu = 1500; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 5fc6be403..d2e725bce 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -376,7 +376,7 @@ fs_get_mac_addr_arg(const char *key __rte_unused, &ea->addr_bytes[0], &ea->addr_bytes[1], &ea->addr_bytes[2], &ea->addr_bytes[3], &ea->addr_bytes[4], &ea->addr_bytes[5]); - return ret != ETHER_ADDR_LEN; + return ret != RTE_ETHER_ADDR_LEN; } int diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 325c67ca9..217c93672 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -172,9 +172,9 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, ret = rte_eth_dev_mac_addr_add(PORT_ID(sdev), ea, PRIV(dev)->mac_addr_pool[i]); if (ret) { - char ea_fmt[ETHER_ADDR_FMT_SIZE]; + char ea_fmt[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(ea_fmt, RTE_ETHER_ADDR_FMT_SIZE, ea); ERROR("Adding MAC address %s failed", ea_fmt); return ret; } diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index dc814855d..99dedd98d 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -305,7 +305,7 @@ fm10k_addr_alignment_valid(struct rte_mbuf *mb) /* 8B aligned, and max Ethernet frame would not cross a 4KB boundary? */ if (RTE_ALIGN(addr, 8) == addr) { boundary1 = RTE_ALIGN_FLOOR(addr, 4096); - boundary2 = RTE_ALIGN_FLOOR(addr + ETHER_MAX_VLAN_FRAME_LEN, + boundary2 = RTE_ALIGN_FLOOR(addr + RTE_ETHER_MAX_VLAN_FRAME_LEN, 4096); if (boundary1 == boundary2) return 1; diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index e6956cbdb..b6bcebea9 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -613,7 +613,7 @@ fm10k_dev_mq_rx_configure(struct rte_eth_dev *dev) /* reset MAC/VLAN as it's based on VMDQ or PF main VSI */ memset(dev->data->mac_addrs, 0, - ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM); + RTE_ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM); rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); @@ -3072,7 +3072,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Initialize MAC address(es) */ dev->data->mac_addrs = rte_zmalloc("fm10k", - ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM, 0); + RTE_ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM, 0); if (dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Cannot allocate memory for MAC addresses"); return -ENOMEM; diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 5d0343a42..7d841d183 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1477,7 +1477,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) /* Set the global registers with default ether type value */ if (!pf->support_multi_driver) { ret = i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_OUTER, - ETHER_TYPE_VLAN); + RTE_ETHER_TYPE_VLAN); if (ret != I40E_SUCCESS) { PMD_INIT_LOG(ERR, "Failed to set the default outer " @@ -1508,9 +1508,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) } if (!vsi->max_macaddrs) - len = ETHER_ADDR_LEN; + len = RTE_ETHER_ADDR_LEN; else - len = ETHER_ADDR_LEN * vsi->max_macaddrs; + len = RTE_ETHER_ADDR_LEN * vsi->max_macaddrs; /* Should be after VSI initialized */ dev->data->mac_addrs = rte_zmalloc("i40e", len, 0); @@ -2824,7 +2824,7 @@ i40e_update_vsi_stats(struct i40e_vsi *vsi) &nes->rx_broadcast); /* exclude CRC bytes */ nes->rx_bytes -= (nes->rx_unicast + nes->rx_multicast + - nes->rx_broadcast) * ETHER_CRC_LEN; + nes->rx_broadcast) * RTE_ETHER_CRC_LEN; i40e_stat_update_32(hw, I40E_GLV_RDPC(idx), vsi->offset_loaded, &oes->rx_discards, &nes->rx_discards); @@ -2924,7 +2924,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) /* exclude CRC size */ pf->internal_stats.rx_bytes -= (pf->internal_stats.rx_unicast + pf->internal_stats.rx_multicast + - pf->internal_stats.rx_broadcast) * ETHER_CRC_LEN; + pf->internal_stats.rx_broadcast) * RTE_ETHER_CRC_LEN; /* Get statistics of struct i40e_eth_stats */ i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -2944,10 +2944,10 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) pf->offset_loaded, &os->eth.rx_broadcast, &ns->eth.rx_broadcast); /* Workaround: CRC size should not be included in byte statistics, - * so subtract ETHER_CRC_LEN from the byte counter for each rx packet. + * so subtract RTE_ETHER_CRC_LEN from the byte counter for each rx packet. */ ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast) * ETHER_CRC_LEN; + ns->eth.rx_broadcast) * RTE_ETHER_CRC_LEN; /* exclude internal rx bytes * Workaround: it is possible I40E_GLV_GORCH[H/L] is updated before @@ -3001,7 +3001,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) pf->offset_loaded, &os->eth.tx_broadcast, &ns->eth.tx_broadcast); ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast) * ETHER_CRC_LEN; + ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN; /* exclude internal tx bytes * Workaround: it is possible I40E_GLV_GOTCH[H/L] is updated before @@ -3500,7 +3500,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_mac_addrs = vsi->max_macaddrs; dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_mtu = dev_info->max_rx_pktlen - I40E_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->rx_queue_offload_capa = 0; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP | @@ -3766,9 +3766,9 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask) i40e_vsi_config_double_vlan(vsi, TRUE); /* Set global registers with default ethertype. */ i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_OUTER, - ETHER_TYPE_VLAN); + RTE_ETHER_TYPE_VLAN); i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_INNER, - ETHER_TYPE_VLAN); + RTE_ETHER_TYPE_VLAN); } else i40e_vsi_config_double_vlan(vsi, FALSE); @@ -4026,7 +4026,7 @@ i40e_macaddr_add(struct rte_eth_dev *dev, return -EINVAL; } - rte_memcpy(&mac_filter.mac_addr, mac_addr, ETHER_ADDR_LEN); + rte_memcpy(&mac_filter.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; else @@ -4131,11 +4131,11 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } if (add) { - rte_memcpy(&old_mac, hw->mac.addr, ETHER_ADDR_LEN); + rte_memcpy(&old_mac, hw->mac.addr, RTE_ETHER_ADDR_LEN); rte_memcpy(hw->mac.addr, new_mac->addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(&mac_filter.mac_addr, &filter->mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); mac_filter.filter_type = filter->filter_type; ret = i40e_vsi_add_mac(vf->vsi, &mac_filter); @@ -4146,7 +4146,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, rte_ether_addr_copy(new_mac, &pf->dev_addr); } else { rte_memcpy(hw->mac.addr, hw->mac.perm_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ret = i40e_vsi_delete_mac(vf->vsi, &filter->mac_addr); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to delete MAC filter."); @@ -5814,7 +5814,7 @@ i40e_vsi_setup(struct i40e_pf *pf, } /* MAC/VLAN configuration */ - rte_memcpy(&filter.mac_addr, &broadcast, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; ret = i40e_vsi_add_mac(vsi, &filter); @@ -7100,7 +7100,7 @@ i40e_vsi_add_vlan(struct i40e_vsi *vsi, uint16_t vlan) int mac_num; int ret = I40E_SUCCESS; - if (!vsi || vlan > ETHER_MAX_VLAN_ID) + if (!vsi || vlan > RTE_ETHER_MAX_VLAN_ID) return I40E_ERR_PARAM; /* If it's already set, just return */ @@ -7151,7 +7151,7 @@ i40e_vsi_delete_vlan(struct i40e_vsi *vsi, uint16_t vlan) * Vlan 0 is the generic filter for untagged packets * and can't be removed. */ - if (!vsi || vlan == 0 || vlan > ETHER_MAX_VLAN_ID) + if (!vsi || vlan == 0 || vlan > RTE_ETHER_MAX_VLAN_ID) return I40E_ERR_PARAM; /* If can't find it, just return */ @@ -8610,7 +8610,7 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, return -EINVAL; } - if (filter->inner_vlan > ETHER_MAX_VLAN_ID) { + if (filter->inner_vlan > RTE_ETHER_MAX_VLAN_ID) { PMD_DRV_LOG(ERR, "Invalid inner VLAN ID"); return -EINVAL; } @@ -9890,7 +9890,7 @@ static int i40e_ethertype_filter_convert(const struct rte_eth_ethertype_filter *input, struct i40e_ethertype_filter *filter) { - rte_memcpy(&filter->input.mac_addr, &input->mac_addr, ETHER_ADDR_LEN); + rte_memcpy(&filter->input.mac_addr, &input->mac_addr, RTE_ETHER_ADDR_LEN); filter->input.ether_type = input->ether_type; filter->flags = input->flags; filter->queue = input->queue; @@ -9982,14 +9982,14 @@ i40e_ethertype_filter_set(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "Invalid queue ID"); return -EINVAL; } - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in control packet filter.", filter->ether_type); return -EINVAL; } - if (filter->ether_type == ETHER_TYPE_VLAN) + if (filter->ether_type == RTE_ETHER_TYPE_VLAN) PMD_DRV_LOG(WARNING, "filter vlan ether_type in first tag is not supported."); @@ -11996,7 +11996,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) int ret = 0; /* check if mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -12006,7 +12006,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 0b8cb780d..d8251ac24 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -269,7 +269,7 @@ enum i40e_flxpld_layer_idx { * Considering QinQ packet, the VLAN tag needs to be counted twice. */ #define I40E_ETH_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2) struct i40e_adapter; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index ba9dd348f..9dc6a2774 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1503,12 +1503,12 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) /* copy mac addr */ eth_dev->data->mac_addrs = rte_zmalloc("i40evf_mac", - ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX, + RTE_ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to" " store MAC addresses", - ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); + RTE_ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, @@ -1765,21 +1765,21 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq) * Check if the jumbo frame and maximum packet length are set correctly */ if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (rxq->max_pkt_len <= ETHER_MAX_LEN || + if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN || rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, as jumbo " - "frame is enabled", (uint32_t)ETHER_MAX_LEN, + "frame is enabled", (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)I40E_FRAME_SIZE_MAX); return I40E_ERR_CONFIG; } } else { - if (rxq->max_pkt_len < ETHER_MIN_LEN || - rxq->max_pkt_len > ETHER_MAX_LEN) { + if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || + rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, as jumbo " - "frame is disabled", (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + "frame is disabled", (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return I40E_ERR_CONFIG; } } @@ -2217,7 +2217,7 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize = I40E_BUF_SIZE_MIN; dev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX; dev_info->max_mtu = dev_info->max_rx_pktlen - I40E_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->hash_key_size = (I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t); dev_info->reta_size = ETH_RSS_RETA_SIZE_64; dev_info->flow_type_rss_offloads = vf->adapter->flow_types_mask; @@ -2679,7 +2679,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) int ret = 0; /* check if mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -2689,7 +2689,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index dd940cecb..4aaf27f7c 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -113,7 +113,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq) #endif rx_ctx.dtype = i40e_header_split_none; rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE; - rx_ctx.rxmax = ETHER_MAX_LEN; + rx_ctx.rxmax = RTE_ETHER_MAX_LEN; rx_ctx.tphrdesc_ena = 1; rx_ctx.tphwdesc_ena = 1; rx_ctx.tphdata_ena = 1; @@ -725,7 +725,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_FRAG_IPV4: ip = (struct ipv4_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; /* set len to by default */ ip->total_length = rte_cpu_to_be_16(I40E_FDIR_IP_DEFAULT_LEN); @@ -752,7 +752,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_FRAG_IPV6: ip6 = (struct ipv6_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW | (fdir_input->flow.ipv6_flow.tc << @@ -910,7 +910,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, * starts after the whole ARP header */ if (fdir_input->flow.l2_flow.ether_type == - rte_cpu_to_be_16(ETHER_TYPE_ARP)) + rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; break; @@ -1009,7 +1009,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, is_customized_pctype) { ip = (struct ipv4_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; /* set len to by default */ ip->total_length = rte_cpu_to_be_16(I40E_FDIR_IP_DEFAULT_LEN); @@ -1042,7 +1042,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, pctype == I40E_FILTER_PCTYPE_FRAG_IPV6) { ip6 = (struct ipv6_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW | (fdir_input->flow.ipv6_flow.tc << @@ -1196,7 +1196,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, * starts after the whole ARP header */ if (fdir_input->flow.l2_flow.ether_type == - rte_cpu_to_be_16(ETHER_TYPE_ARP)) + rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; } else if (fdir_input->flow_ext.customized_pctype) { diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index e21a8f63b..eab451447 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2036,9 +2036,9 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, } filter->ether_type = rte_be_to_cpu_16(eth_spec->type); - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6 || - filter->ether_type == ETHER_TYPE_LLDP || + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6 || + filter->ether_type == RTE_ETHER_TYPE_LLDP || filter->ether_type == outer_tpid) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2508,9 +2508,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, ether_type = rte_be_to_cpu_16(eth_spec->type); if (next == RTE_FLOW_ITEM_TYPE_VLAN || - ether_type == ETHER_TYPE_IPv4 || - ether_type == ETHER_TYPE_IPv6 || - ether_type == ETHER_TYPE_ARP || + ether_type == RTE_ETHER_TYPE_IPv4 || + ether_type == RTE_ETHER_TYPE_IPv6 || + ether_type == RTE_ETHER_TYPE_ARP || ether_type == outer_tpid) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2553,9 +2553,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, ether_type = rte_be_to_cpu_16(vlan_spec->inner_type); - if (ether_type == ETHER_TYPE_IPv4 || - ether_type == ETHER_TYPE_IPv6 || - ether_type == ETHER_TYPE_ARP || + if (ether_type == RTE_ETHER_TYPE_IPv4 || + ether_type == RTE_ETHER_TYPE_IPv6 || + ether_type == RTE_ETHER_TYPE_ARP || ether_type == outer_tpid) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -3339,12 +3339,12 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, if (!vxlan_flag) { rte_memcpy(&filter->outer_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_OMAC; } else { rte_memcpy(&filter->inner_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_IMAC; } } @@ -3569,12 +3569,12 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, if (!nvgre_flag) { rte_memcpy(&filter->outer_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_OMAC; } else { rte_memcpy(&filter->inner_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_IMAC; } } diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 6a86ec57b..f2d98d8c7 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -843,7 +843,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, for (i = 0; i < addr_list->num_elements; i++) { mac = (struct rte_ether_addr *)(addr_list->list[i].addr); - rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, mac, RTE_ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; if (rte_is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, &filter)) { diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 8f727fae6..52ce536e0 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -889,17 +889,17 @@ i40e_recv_scattered_pkts(void *rx_queue, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (rx_packet_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (rx_packet_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t)(last_seg->data_len - - (ETHER_CRC_LEN - rx_packet_len)); + (RTE_ETHER_CRC_LEN - rx_packet_len)); last_seg->next = NULL; } else rxm->data_len = (uint16_t)(rx_packet_len - - ETHER_CRC_LEN); + RTE_ETHER_CRC_LEN); } first_seg->port = rxq->port_id; @@ -1839,7 +1839,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, rxq->reg_idx = reg_idx; rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; rxq->drop_en = rx_conf->rx_drop_en; @@ -2619,23 +2619,23 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) len = hw->func_caps.rx_buf_chain_len * rxq->rx_buf_len; rxq->max_pkt_len = RTE_MIN(len, data->dev_conf.rxmode.max_rx_pkt_len); if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (rxq->max_pkt_len <= ETHER_MAX_LEN || + if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN || rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must " "be larger than %u and smaller than %u," "as jumbo frame is enabled", - (uint32_t)ETHER_MAX_LEN, + (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)I40E_FRAME_SIZE_MAX); return I40E_ERR_CONFIG; } } else { - if (rxq->max_pkt_len < ETHER_MIN_LEN || - rxq->max_pkt_len > ETHER_MAX_LEN) { + if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || + rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is disabled", - (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return I40E_ERR_CONFIG; } } diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index c4ba8f89a..6393fc10c 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -663,7 +663,7 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id, RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - if (vlan_id > ETHER_MAX_VLAN_ID) { + if (vlan_id > RTE_ETHER_MAX_VLAN_ID) { PMD_DRV_LOG(ERR, "Invalid VLAN ID."); return -EINVAL; } @@ -765,7 +765,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, } if (on) { - rte_memcpy(&filter.mac_addr, &broadcast, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; ret = i40e_vsi_add_mac(vsi, &filter); } else { @@ -893,7 +893,7 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id, if (!is_i40e_supported(dev)) return -ENOTSUP; - if (vlan_id > ETHER_MAX_VLAN_ID || !vlan_id) { + if (vlan_id > RTE_ETHER_MAX_VLAN_ID || !vlan_id) { PMD_DRV_LOG(ERR, "Invalid VLAN ID."); return -EINVAL; } diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index e8f453bd8..a965f9a61 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -56,7 +56,7 @@ */ #define IAVF_VLAN_TAG_SIZE 4 #define IAVF_ETH_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2) struct iavf_adapter; struct iavf_rx_queue; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index b56fbcb13..a75f3e54d 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -223,23 +223,23 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq) * correctly. */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (max_pkt_len <= ETHER_MAX_LEN || + if (max_pkt_len <= RTE_ETHER_MAX_LEN || max_pkt_len > IAVF_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is enabled", - (uint32_t)ETHER_MAX_LEN, + (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)IAVF_FRAME_SIZE_MAX); return -EINVAL; } } else { - if (max_pkt_len < ETHER_MIN_LEN || - max_pkt_len > ETHER_MAX_LEN) { + if (max_pkt_len < RTE_ETHER_MIN_LEN || + max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is disabled", - (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return -EINVAL; } } @@ -907,7 +907,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t frame_size = mtu + IAVF_ETH_OVERHEAD; int ret = 0; - if (mtu < ETHER_MIN_MTU || frame_size > IAVF_FRAME_SIZE_MAX) + if (mtu < RTE_ETHER_MIN_MTU || frame_size > IAVF_FRAME_SIZE_MAX) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -916,7 +916,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -1233,12 +1233,12 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* copy mac addr */ eth_dev->data->mac_addrs = rte_zmalloc( "iavf_mac", - ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX, + RTE_ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX, 0); if (!eth_dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to" " store MAC addresses", - ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX); + RTE_ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX); return -ENOMEM; } /* If the MAC address is not configured by host, diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index db7070fb5..103a020c8 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1025,17 +1025,17 @@ iavf_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (rx_packet_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (rx_packet_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t)(last_seg->data_len - - (ETHER_CRC_LEN - rx_packet_len)); + (RTE_ETHER_CRC_LEN - rx_packet_len)); last_seg->next = NULL; } else rxm->data_len = (uint16_t)(rx_packet_len - - ETHER_CRC_LEN); + RTE_ETHER_CRC_LEN); } first_seg->port = rxq->port_id; diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 91f052852..0ddc89b08 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -647,7 +647,7 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) struct ice_hw *hw = ICE_VSI_TO_HW(vsi); int ret = 0; - if (!vsi || vlan_id > ETHER_MAX_VLAN_ID) + if (!vsi || vlan_id > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; /* If it's added and configured, return. */ @@ -716,7 +716,7 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) * Vlan 0 is the generic filter for untagged packets * and can't be removed. */ - if (!vsi || vlan_id == 0 || vlan_id > ETHER_MAX_VLAN_ID) + if (!vsi || vlan_id == 0 || vlan_id > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; /* Can't find it, return an error */ @@ -1216,12 +1216,12 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) hw->port_info->mac.perm_addr, ETH_ADDR_LEN); - rte_memcpy(&mac_addr, &pf->dev_addr, ETHER_ADDR_LEN); + rte_memcpy(&mac_addr, &pf->dev_addr, RTE_ETHER_ADDR_LEN); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add dflt MAC filter"); - rte_memcpy(&mac_addr, &broadcast, ETHER_ADDR_LEN); + rte_memcpy(&mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add MAC filter"); @@ -2206,11 +2206,11 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct rte_eth_dev_data *dev_data = pf->dev_data; - uint32_t frame_size = mtu + ETHER_HDR_LEN - + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE; + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE; /* check if mtu is within the allowed range */ - if (mtu < ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX) + if (mtu < RTE_ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -2221,7 +2221,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -3073,7 +3073,7 @@ ice_update_vsi_stats(struct ice_vsi *vsi) &nes->rx_broadcast); /* exclude CRC bytes */ nes->rx_bytes -= (nes->rx_unicast + nes->rx_multicast + - nes->rx_broadcast) * ETHER_CRC_LEN; + nes->rx_broadcast) * RTE_ETHER_CRC_LEN; ice_stat_update_32(hw, GLV_RDPC(idx), vsi->offset_loaded, &oes->rx_discards, &nes->rx_discards); @@ -3146,10 +3146,10 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) &ns->eth.rx_discards); /* Workaround: CRC size should not be included in byte statistics, - * so subtract ETHER_CRC_LEN from the byte counter for each rx packet. + * so subtract RTE_ETHER_CRC_LEN from the byte counter for each rx packet. */ ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast) * ETHER_CRC_LEN; + ns->eth.rx_broadcast) * RTE_ETHER_CRC_LEN; /* GLPRT_REPC not supported */ /* GLPRT_RMPC not supported */ @@ -3174,7 +3174,7 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) pf->offset_loaded, &os->eth.tx_broadcast, &ns->eth.tx_broadcast); ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast) * ETHER_CRC_LEN; + ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN; /* GLPRT_TEPC not supported */ diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index f45b8248f..9fc98b401 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -47,23 +47,23 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) dev->data->dev_conf.rxmode.max_rx_pkt_len); if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (rxq->max_pkt_len <= ETHER_MAX_LEN || + if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN || rxq->max_pkt_len > ICE_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must " "be larger than %u and smaller than %u," "as jumbo frame is enabled", - (uint32_t)ETHER_MAX_LEN, + (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)ICE_FRAME_SIZE_MAX); return -EINVAL; } } else { - if (rxq->max_pkt_len < ETHER_MIN_LEN || - rxq->max_pkt_len > ETHER_MAX_LEN) { + if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || + rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is disabled", - (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return -EINVAL; } } @@ -629,7 +629,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, rxq->reg_idx = vsi->base_queue + queue_idx; rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -1411,17 +1411,17 @@ ice_recv_scattered_pkts(void *rx_queue, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (rx_packet_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (rx_packet_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t)(last_seg->data_len - - (ETHER_CRC_LEN - rx_packet_len)); + (RTE_ETHER_CRC_LEN - rx_packet_len)); last_seg->next = NULL; } else rxm->data_len = (uint16_t)(rx_packet_len - - ETHER_CRC_LEN); + RTE_ETHER_CRC_LEN); } first_seg->port = rxq->port_id; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 6b44ca4c1..3afa43aae 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1212,13 +1212,13 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) ixgbe_reset_qstat_mappings(hw); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %u bytes needed to store " "MAC addresses", - ETHER_ADDR_LEN * hw->mac.num_rar_entries); + RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries); return -ENOMEM; } /* Copy the permanent MAC address */ @@ -1226,12 +1226,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ - eth_dev->data->hash_mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN * + eth_dev->data->hash_mac_addrs = rte_zmalloc("ixgbe", RTE_ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC, 0); if (eth_dev->data->hash_mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC); + RTE_ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC); return -ENOMEM; } @@ -1498,7 +1498,7 @@ static int ixgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) } l2_tn_info->e_tag_en = FALSE; l2_tn_info->e_tag_fwd_en = FALSE; - l2_tn_info->e_tag_ether_type = ETHER_TYPE_ETAG; + l2_tn_info->e_tag_ether_type = RTE_ETHER_TYPE_ETAG; return 0; } @@ -1539,7 +1539,7 @@ generate_random_mac_addr(struct rte_ether_addr *mac_addr) mac_addr->addr_bytes[1] = 0x09; mac_addr->addr_bytes[2] = 0xC0; /* Force indication of locally assigned MAC address. */ - mac_addr->addr_bytes[0] |= ETHER_LOCAL_ADMIN_ADDR; + mac_addr->addr_bytes[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR; /* Generate the last 3 bytes of the MAC address with a random number. */ random = rte_rand(); memcpy(&mac_addr->addr_bytes[3], &random, 3); @@ -1645,13 +1645,13 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) ixgbevf_get_queues(hw, &tcs, &tc); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %u bytes needed to store " "MAC addresses", - ETHER_ADDR_LEN * hw->mac.num_rar_entries); + RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries); return -ENOMEM; } @@ -3050,7 +3050,7 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw, hw_stats->qbrc[i] += ((uint64_t)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32); if (crc_strip == 0) - hw_stats->qbrc[i] -= delta_qprc * ETHER_CRC_LEN; + hw_stats->qbrc[i] -= delta_qprc * RTE_ETHER_CRC_LEN; hw_stats->qbtc[i] += IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)); hw_stats->qbtc[i] += @@ -3095,12 +3095,12 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw, hw_stats->tpt += IXGBE_READ_REG(hw, IXGBE_TPT); if (crc_strip == 0) - hw_stats->gorc -= delta_gprc * ETHER_CRC_LEN; + hw_stats->gorc -= delta_gprc * RTE_ETHER_CRC_LEN; uint64_t delta_gptc = IXGBE_READ_REG(hw, IXGBE_GPTC); hw_stats->gptc += delta_gptc; - hw_stats->gotc -= delta_gptc * ETHER_CRC_LEN; - hw_stats->tor -= (hw_stats->tpr - old_tpr) * ETHER_CRC_LEN; + hw_stats->gotc -= delta_gptc * RTE_ETHER_CRC_LEN; + hw_stats->tor -= (hw_stats->tpr - old_tpr) * RTE_ETHER_CRC_LEN; /* * Workaround: mprc hardware is incorrectly counting @@ -3130,7 +3130,7 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw, hw_stats->gptc -= total; hw_stats->mptc -= total; hw_stats->ptc64 -= total; - hw_stats->gotc -= total * ETHER_MIN_LEN; + hw_stats->gotc -= total * RTE_ETHER_MIN_LEN; hw_stats->ruc += IXGBE_READ_REG(hw, IXGBE_RUC); hw_stats->rfc += IXGBE_READ_REG(hw, IXGBE_RFC); @@ -3752,7 +3752,7 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) else dev_info->max_vmdq_pools = ETH_64_POOLS; dev_info->max_mtu = dev_info->max_rx_pktlen - IXGBE_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->vmdq_queue_num = dev_info->max_rx_queues; dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | @@ -4553,7 +4553,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) * At least reserve one Ethernet frame for watermark * high_water/low_water in kilo bytes for ixgbe */ - max_high_water = (rx_buf_size - ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; + max_high_water = (rx_buf_size - RTE_ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; if ((fc_conf->high_water > max_high_water) || (fc_conf->high_water < fc_conf->low_water)) { PMD_INIT_LOG(ERR, "Invalid high/low water setup value in KB"); @@ -4774,7 +4774,7 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p * At least reserve one Ethernet frame for watermark * high_water/low_water in kilo bytes for ixgbe */ - max_high_water = (rx_buf_size - ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; + max_high_water = (rx_buf_size - RTE_ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; if ((pfc_conf->fc.high_water > max_high_water) || (pfc_conf->fc.high_water <= pfc_conf->fc.low_water)) { PMD_INIT_LOG(ERR, "Invalid high/low water setup value in KB"); @@ -4955,7 +4955,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) ixgbe_dev_info_get(dev, &dev_info); /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; /* If device is started, refuse mtu that requires the support of @@ -4972,7 +4972,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); /* switch to jumbo mode if needed */ - if (frame_size > ETHER_MAX_LEN) { + if (frame_size > RTE_ETHER_MAX_LEN) { dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; hlreg0 |= IXGBE_HLREG0_JUMBOEN; @@ -6357,7 +6357,7 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if ((mtu < ETHER_MIN_MTU) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) + if ((mtu < RTE_ETHER_MIN_MTU) || (max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)) return -EINVAL; /* If device is started, refuse mtu that requires the support of @@ -6654,8 +6654,8 @@ ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev, if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM) return -EINVAL; - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in" " ethertype filter.", filter->ether_type); return -EINVAL; @@ -7063,7 +7063,7 @@ ixgbe_timesync_enable(struct rte_eth_dev *dev) /* Enable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_1588), - (ETHER_TYPE_1588 | + (RTE_ETHER_TYPE_1588 | IXGBE_ETQF_FILTER_EN | IXGBE_ETQF_1588)); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index d1f61e85e..fdad94d58 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -102,7 +102,7 @@ #define IXGBE_5TUPLE_MIN_PRI 1 /* The overhead from MTU to max frame size. */ -#define IXGBE_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN) +#define IXGBE_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN) /* bit of VXLAN tunnel type | 7 bits of zeros | 8 bits of zeros*/ #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE 0x8000 @@ -258,7 +258,7 @@ struct ixgbe_mirror_info { }; struct ixgbe_vf_info { - uint8_t vf_mac_addresses[ETHER_ADDR_LEN]; + uint8_t vf_mac_addresses[RTE_ETHER_ADDR_LEN]; uint16_t vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES]; uint16_t num_vf_mc_hashes; uint16_t default_vf_vlan_id; diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 7024354cd..23aba0a47 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -887,8 +887,8 @@ ixgbe_parse_ethertype_filter(struct rte_eth_dev *dev, return -rte_errno; } - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { memset(filter, 0, sizeof(struct rte_eth_ethertype_filter)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -1705,7 +1705,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev, eth_spec = item->spec; /* Get the dst MAC. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { rule->ixgbe_fdir.formatted.inner_mac[j] = eth_spec->dst.addr_bytes[j]; } @@ -1734,7 +1734,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev, * src MAC address must be masked, * and don't support dst MAC address mask. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { if (eth_mask->src.addr_bytes[j] || eth_mask->dst.addr_bytes[j] != 0xFF) { memset(rule, 0, @@ -2660,7 +2660,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, } /* src MAC address should be masked. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { if (eth_mask->src.addr_bytes[j]) { memset(rule, 0, sizeof(struct ixgbe_fdir_rule)); @@ -2671,7 +2671,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, } } rule->mask.mac_addr_byte_mask = 0; - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { /* It's a per byte mask. */ if (eth_mask->dst.addr_bytes[j] == 0xFF) { rule->mask.mac_addr_byte_mask |= 0x1 << j; @@ -2692,7 +2692,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, eth_spec = item->spec; /* Get the dst MAC. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { rule->ixgbe_fdir.formatted.inner_mac[j] = eth_spec->dst.addr_bytes[j]; } diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 37521af7c..646b3434c 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -40,7 +40,7 @@ dev_num_vf(struct rte_eth_dev *eth_dev) static inline int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) { - unsigned char vf_mac_addr[ETHER_ADDR_LEN]; + unsigned char vf_mac_addr[RTE_ETHER_ADDR_LEN]; struct ixgbe_vf_info *vfinfo = *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); uint16_t vfn; @@ -49,7 +49,7 @@ int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) rte_eth_random_addr(vf_mac_addr); /* keep the random address as default */ memcpy(vfinfo[vfn].vf_mac_addresses, vf_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } return 0; @@ -443,7 +443,7 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, ETHER_ADDR_LEN); + rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); /* * Piggyback the multicast filter type so VF can compute the * correct vectors @@ -546,7 +546,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t new_mtu = msgbuf[1]; uint32_t max_frs; - int max_frame = new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + int max_frame = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; /* X540 and X550 support jumbo frames in IOV mode */ if (hw->mac.type != ixgbe_mac_X540 && @@ -555,7 +555,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms hw->mac.type != ixgbe_mac_X550EM_a) return -1; - if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) + if ((max_frame < RTE_ETHER_MIN_LEN) || (max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)) return -1; max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) & diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e71d3c188..5b7953a7f 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2940,7 +2940,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx); rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; rxq->drop_en = rx_conf->rx_drop_en; @@ -3965,7 +3965,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev, uint16_t max[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0}; uint8_t map[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0}; struct ixgbe_dcb_tc_config *tc; - uint32_t max_frame = dev->data->mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t max_frame = dev->data->mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ixgbe_bw_conf *bw_conf = @@ -4948,7 +4948,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) * call to configure. */ if (rx_conf->offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 45fc3a4ad..12bf9b750 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -37,7 +37,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } @@ -154,7 +154,7 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf, uint16_t vlan_id) if (vf >= pci_dev->max_vfs) return -EINVAL; - if (vlan_id > ETHER_MAX_VLAN_ID) + if (vlan_id > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -476,7 +476,7 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint16_t port, uint16_t vlan, if (!is_ixgbe_supported(dev)) return -ENOTSUP; - if ((vlan > ETHER_MAX_VLAN_ID) || (vf_mask == 0)) + if ((vlan > RTE_ETHER_MAX_VLAN_ID) || (vf_mask == 0)) return -EINVAL; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 0e304fd00..d9fa28030 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -20,7 +20,7 @@ #define MAX_KNI_PORTS 8 #define KNI_ETHER_MTU(mbuf_size) \ - ((mbuf_size) - ETHER_HDR_LEN) /**< Ethernet MTU. */ + ((mbuf_size) - RTE_ETHER_HDR_LEN) /**< Ethernet MTU. */ #define ETH_KNI_NO_REQUEST_THREAD_ARG "no_request_thread" static const char * const valid_arguments[] = { diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index fea9f4922..5b0da7845 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -430,7 +430,7 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) { struct lio_device *lio_dev = LIO_DEV(eth_dev); uint16_t pf_mtu = lio_dev->linfo.link.s.mtu; - uint32_t frame_len = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t frame_len = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; struct lio_dev_ctrl_cmd ctrl_cmd; struct lio_ctrl_pkt ctrl_pkt; @@ -445,9 +445,9 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) /* check if VF MTU is within allowed range. * New value should not exceed PF MTU. */ - if ((mtu < ETHER_MIN_MTU) || (mtu > pf_mtu)) { + if ((mtu < RTE_ETHER_MIN_MTU) || (mtu > pf_mtu)) { lio_dev_err(lio_dev, "VF MTU should be >= %d and <= %d\n", - ETHER_MIN_MTU, pf_mtu); + RTE_ETHER_MIN_MTU, pf_mtu); return -EINVAL; } @@ -476,7 +476,7 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) return -1; } - if (frame_len > ETHER_MAX_LEN) + if (frame_len > RTE_ETHER_MAX_LEN) eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -1429,9 +1429,9 @@ lio_dev_start(struct rte_eth_dev *eth_dev) goto dev_mtu_set_error; } - mtu = (uint16_t)(frame_len - ETHER_HDR_LEN - ETHER_CRC_LEN); - if (mtu < ETHER_MIN_MTU) - mtu = ETHER_MIN_MTU; + mtu = (uint16_t)(frame_len - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN); + if (mtu < RTE_ETHER_MIN_MTU) + mtu = RTE_ETHER_MIN_MTU; if (eth_dev->data->mtu != mtu) { ret = lio_dev_mtu_set(eth_dev, mtu); @@ -1712,7 +1712,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) struct lio_device *lio_dev = LIO_DEV(eth_dev); uint16_t timeout = LIO_MAX_CMD_TIMEOUT; int retval, num_iqueues, num_oqueues; - uint8_t mac[ETHER_ADDR_LEN], i; + uint8_t mac[RTE_ETHER_ADDR_LEN], i; struct lio_if_cfg_resp *resp; struct lio_soft_command *sc; union lio_if_cfg if_cfg; @@ -1830,7 +1830,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) /* 64-bit swap required on LE machines */ lio_swap_8B_data(&lio_dev->linfo.hw_addr, 1); - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) mac[i] = *((uint8_t *)(((uint8_t *)&lio_dev->linfo.hw_addr) + 2 + i)); @@ -2089,7 +2089,7 @@ lio_eth_dev_init(struct rte_eth_dev *eth_dev) } eth_dev->dev_ops = &liovf_eth_dev_ops; - eth_dev->data->mac_addrs = rte_zmalloc("lio", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("lio", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { lio_dev_err(lio_dev, "MAC addresses memory allocation failed\n"); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 01678df2d..547fbd541 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -1073,7 +1073,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) priv->device_attr = device_attr; priv->port = port; priv->pd = pd; - priv->mtu = ETHER_MTU; + priv->mtu = RTE_ETHER_MTU; priv->vf = vf; priv->hw_csum = !!(device_attr.device_cap_flags & IBV_DEVICE_RAW_IP_CSUM); diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 13e1b31e2..eb3c02269 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -201,7 +201,7 @@ struct mlx4_priv { /* mlx4_ethdev.c */ int mlx4_get_ifname(const struct mlx4_priv *priv, char (*ifname)[IF_NAMESIZE]); -int mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]); +int mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]); int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t *mtu); int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); int mlx4_dev_set_link_down(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 20715390e..7b70f4587 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -176,14 +176,14 @@ mlx4_ifreq(const struct mlx4_priv *priv, int req, struct ifreq *ifr) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]) +mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]) { struct ifreq request; int ret = mlx4_ifreq(priv, SIOCGIFHWADDR, &request); if (ret) return ret; - memcpy(mac, request.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); return 0; } diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 9c87694a2..7c554daeb 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -225,7 +225,7 @@ mlx4_flow_merge_eth(struct rte_flow *flow, goto error; } flow->allmulti = 1; - } else if (sum_dst != (UINT8_C(0xff) * ETHER_ADDR_LEN)) { + } else if (sum_dst != (UINT8_C(0xff) * RTE_ETHER_ADDR_LEN)) { msg = "mlx4 does not support matching partial" " Ethernet fields"; goto error; @@ -253,10 +253,10 @@ mlx4_flow_merge_eth(struct rte_flow *flow, flow->promisc = 1; return 0; } - memcpy(eth->val.dst_mac, spec->dst.addr_bytes, ETHER_ADDR_LEN); - memcpy(eth->mask.dst_mac, mask->dst.addr_bytes, ETHER_ADDR_LEN); + memcpy(eth->val.dst_mac, spec->dst.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(eth->mask.dst_mac, mask->dst.addr_bytes, RTE_ETHER_ADDR_LEN); /* Remove unwanted bits from values. */ - for (i = 0; i < ETHER_ADDR_LEN; ++i) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) { eth->val.dst_mac[i] &= eth->mask.dst_mac[i]; } return 0; diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index f22f1ba55..6ca4e5c02 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -1281,7 +1281,7 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) pkt->ol_flags = PKT_RX_RSS_HASH; pkt->hash.rss = cqe->immed_rss_invalid; if (rxq->crc_present) - len -= ETHER_CRC_LEN; + len -= RTE_ETHER_CRC_LEN; pkt->pkt_len = len; if (rxq->csum | rxq->csum_l2tun) { uint32_t flags = diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 194c87aae..801274c18 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1335,7 +1335,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } priv->sh = sh; priv->ibv_port = spawn->ibv_port; - priv->mtu = ETHER_MTU; + priv->mtu = RTE_ETHER_MTU; #ifndef RTE_ARCH_64 /* Initialize UAR access locks for 32bit implementations. */ rte_spinlock_init(&priv->uar_lock_cq); diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index d9d3179df..01bde9a90 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -401,7 +401,7 @@ bool mlx5_translate_port_name(const char *port_name_in, /* mlx5_mac.c */ -int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN]); +int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]); void mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq); diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index fbcb2880b..8110e9e3e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1086,7 +1086,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, (void *)items->type, "eth header not found"); if (!eth->ether_type) - eth->ether_type = RTE_BE16(ETHER_TYPE_VLAN); + eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: ipv4 = (struct ipv4_hdr *)&buf[temp_size]; @@ -1097,9 +1097,9 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, "neither eth nor vlan" " header found"); if (vlan && !vlan->eth_proto) - vlan->eth_proto = RTE_BE16(ETHER_TYPE_IPv4); + vlan->eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPv4); else if (eth && !eth->ether_type) - eth->ether_type = RTE_BE16(ETHER_TYPE_IPv4); + eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_IPv4); if (!ipv4->version_ihl) ipv4->version_ihl = MLX5_ENCAP_IPV4_VERSION | MLX5_ENCAP_IPV4_IHL_MIN; @@ -1115,9 +1115,9 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, "neither eth nor vlan" " header found"); if (vlan && !vlan->eth_proto) - vlan->eth_proto = RTE_BE16(ETHER_TYPE_IPv6); + vlan->eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPv6); else if (eth && !eth->ether_type) - eth->ether_type = RTE_BE16(ETHER_TYPE_IPv6); + eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_IPv6); if (!ipv6->vtc_flow) ipv6->vtc_flow = RTE_BE32(MLX5_ENCAP_IPV6_VTC_FLOW); @@ -2779,7 +2779,7 @@ flow_dv_translate_item_mpls(void *matcher, void *key, case MLX5_FLOW_LAYER_GRE: MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, 0xffff); MLX5_SET(fte_match_set_misc, misc_v, gre_protocol, - ETHER_TYPE_MPLS); + RTE_ETHER_TYPE_MPLS); break; default: MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 938f68c19..595c13e1f 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -707,7 +707,7 @@ flow_tcf_pedit_key_set_mac(const struct rte_flow_action *actions, p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_SET; memcpy(&p_parser->keys[idx].val, conf->mac_addr + SZ_PEDIT_KEY_VAL, - ETHER_ADDR_LEN - SZ_PEDIT_KEY_VAL); + RTE_ETHER_ADDR_LEN - SZ_PEDIT_KEY_VAL); p_parser->sel.nkeys = (++idx); } @@ -984,11 +984,11 @@ flow_tcf_get_pedit_actions_size(const struct rte_flow_action **actions, flags |= MLX5_FLOW_ACTION_DEC_TTL; break; case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC: - keys += NUM_OF_PEDIT_KEYS(ETHER_ADDR_LEN); + keys += NUM_OF_PEDIT_KEYS(RTE_ETHER_ADDR_LEN); flags |= MLX5_FLOW_ACTION_SET_MAC_SRC; break; case RTE_FLOW_ACTION_TYPE_SET_MAC_DST: - keys += NUM_OF_PEDIT_KEYS(ETHER_ADDR_LEN); + keys += NUM_OF_PEDIT_KEYS(RTE_ETHER_ADDR_LEN); flags |= MLX5_FLOW_ACTION_SET_MAC_DST; break; default: @@ -2521,7 +2521,7 @@ flow_tcf_get_items_size(const struct rte_flow_attr *attr, case RTE_FLOW_ITEM_TYPE_PORT_ID: break; case RTE_FLOW_ITEM_TYPE_ETH: - size += SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) * 4; + size += SZ_NLATTR_DATA_OF(RTE_ETHER_ADDR_LEN) * 4; /* dst/src MAC addr and mask. */ break; case RTE_FLOW_ITEM_TYPE_VLAN: @@ -3336,18 +3336,18 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, } if (!rte_is_zero_ether_addr(&mask.eth->dst)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, spec.eth->dst.addr_bytes); mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST_MASK, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, mask.eth->dst.addr_bytes); } if (!rte_is_zero_ether_addr(&mask.eth->src)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, spec.eth->src.addr_bytes); mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC_MASK, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, mask.eth->src.addr_bytes); } assert(dev_flow->tcf.nlsize >= nlh->nlmsg_len); @@ -4395,7 +4395,7 @@ flow_tcf_collect_neigh_cb(const struct nlmsghdr *nlh, void *arg) /* Neigh rule with permenent attribute found. */ size = MNL_ALIGN(sizeof(struct nlmsghdr)) + MNL_ALIGN(sizeof(struct ndmsg)) + - SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) + + SZ_NLATTR_DATA_OF(RTE_ETHER_ADDR_LEN) + (family == AF_INET6 ? SZ_NLATTR_DATA_OF(IPV6_ADDR_LEN) : SZ_NLATTR_TYPE_OF(uint32_t)); cmd = flow_tcf_alloc_nlcmd(ctx, size); @@ -4419,7 +4419,7 @@ flow_tcf_collect_neigh_cb(const struct nlmsghdr *nlh, void *arg) mnl_attr_put(cmd, NDA_DST, IPV6_ADDR_LEN, mnl_attr_get_payload(na_ip)); } - mnl_attr_put(cmd, NDA_LLADDR, ETHER_ADDR_LEN, + mnl_attr_put(cmd, NDA_LLADDR, RTE_ETHER_ADDR_LEN, mnl_attr_get_payload(na_mac)); assert(size == cmd->nlmsg_len); return 1; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 49dd13e6d..252febf35 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -290,14 +290,14 @@ flow_verbs_translate_item_eth(struct mlx5_flow *dev_flow, if (spec) { unsigned int i; - memcpy(ð.val.dst_mac, spec->dst.addr_bytes, ETHER_ADDR_LEN); - memcpy(ð.val.src_mac, spec->src.addr_bytes, ETHER_ADDR_LEN); + memcpy(ð.val.dst_mac, spec->dst.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(ð.val.src_mac, spec->src.addr_bytes, RTE_ETHER_ADDR_LEN); eth.val.ether_type = spec->type; - memcpy(ð.mask.dst_mac, mask->dst.addr_bytes, ETHER_ADDR_LEN); - memcpy(ð.mask.src_mac, mask->src.addr_bytes, ETHER_ADDR_LEN); + memcpy(ð.mask.dst_mac, mask->dst.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(ð.mask.src_mac, mask->src.addr_bytes, RTE_ETHER_ADDR_LEN); eth.mask.ether_type = mask->type; /* Remove unwanted bits from values. */ - for (i = 0; i < ETHER_ADDR_LEN; ++i) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) { eth.val.dst_mac[i] &= eth.mask.dst_mac[i]; eth.val.src_mac[i] &= eth.mask.src_mac[i]; } diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 9204c5f52..0ffef5c5d 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -44,7 +44,7 @@ * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN]) +mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]) { struct ifreq request; int ret; @@ -52,7 +52,7 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN]) ret = mlx5_ifreq(dev, SIOCGIFHWADDR, &request); if (ret) return ret; - memcpy(mac, request.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); return 0; } diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index 19b4e346f..94efbf2a0 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -344,7 +344,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], - RTA_DATA(attribute), ETHER_ADDR_LEN); + RTA_DATA(attribute), RTE_ETHER_ADDR_LEN); } } return 0; @@ -433,7 +433,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, struct nlmsghdr hdr; struct ndmsg ndm; struct rtattr rta; - uint8_t buffer[ETHER_ADDR_LEN]; + uint8_t buffer[RTE_ETHER_ADDR_LEN]; } req = { .hdr = { .nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)), @@ -449,7 +449,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, }, .rta = { .rta_type = NDA_LLADDR, - .rta_len = RTA_LENGTH(ETHER_ADDR_LEN), + .rta_len = RTA_LENGTH(RTE_ETHER_ADDR_LEN), }, }; int fd; @@ -459,7 +459,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, if (priv->nl_socket_route == -1) return 0; fd = priv->nl_socket_route; - memcpy(RTA_DATA(&req.rta), mac, ETHER_ADDR_LEN); + memcpy(RTA_DATA(&req.rta), mac, RTE_ETHER_ADDR_LEN); req.hdr.nlmsg_len = NLMSG_ALIGN(req.hdr.nlmsg_len) + RTA_ALIGN(req.rta.rta_len); ret = mlx5_nl_send(fd, &req.hdr, sn); diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 3da3f62fa..7174ffc91 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -632,7 +632,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) if (buf->ol_flags & PKT_TX_VLAN_PKT) { uint32_t vlan = rte_cpu_to_be_32(0x81000000 | buf->vlan_tci); - unsigned int len = 2 * ETHER_ADDR_LEN - 2; + unsigned int len = 2 * RTE_ETHER_ADDR_LEN - 2; addr += 2; length -= 2; @@ -2058,7 +2058,7 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) mcqe->rx_hash_result); rxq_cq_to_mbuf(rxq, pkt, cqe, rss_hash_res); if (rxq->crc_present) - len -= ETHER_CRC_LEN; + len -= RTE_ETHER_CRC_LEN; PKT_LEN(pkt) = len; } DATA_LEN(rep) = DATA_LEN(seg); @@ -2264,7 +2264,7 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) len = (byte_cnt & MLX5_MPRQ_LEN_MASK) >> MLX5_MPRQ_LEN_SHIFT; assert((int)len >= (rxq->crc_present << 2)); if (rxq->crc_present) - len -= ETHER_CRC_LEN; + len -= RTE_ETHER_CRC_LEN; offset = strd_idx * strd_sz + strd_shift; addr = RTE_PTR_ADD(mlx5_mprq_buf_addr(buf), offset); /* Initialize the offload flag. */ diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h index 38e915c5c..b2cc71088 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -379,7 +379,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, }; /* Restore the compressed count. Must be 16 bits. */ const uint16_t mcqe_n = t_pkt->data_len + - (rxq->crc_present * ETHER_CRC_LEN); + (rxq->crc_present * RTE_ETHER_CRC_LEN); const uint64x2_t rearm = vld1q_u64((void *)&t_pkt->rearm_data); const uint32x4_t rxdf_mask = { @@ -393,8 +393,8 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, vreinterpretq_u8_u32(rxdf_mask)); const uint16x8_t crc_adj = { 0, 0, - rxq->crc_present * ETHER_CRC_LEN, 0, - rxq->crc_present * ETHER_CRC_LEN, 0, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0, 0 }; const uint32_t flow_tag = t_pkt->hash.fdir.hi; @@ -717,7 +717,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n, 12, 13, 14, -1 /* 1st CQE */ }; const uint16x8_t crc_adj = { - 0, 0, rxq->crc_present * ETHER_CRC_LEN, 0, 0, 0, 0, 0 + 0, 0, rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0, 0, 0, 0 }; const uint32x4_t flow_mark_adj = { 0, 0, 0, rxq->mark * (-1) }; diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h index fb384efde..dce3ee4b4 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -374,16 +374,16 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, -1, -1, -1, -1 /* skip packet_type */); /* Restore the compressed count. Must be 16 bits. */ const uint16_t mcqe_n = t_pkt->data_len + - (rxq->crc_present * ETHER_CRC_LEN); + (rxq->crc_present * RTE_ETHER_CRC_LEN); const __m128i rearm = _mm_loadu_si128((__m128i *)&t_pkt->rearm_data); const __m128i rxdf = _mm_loadu_si128((__m128i *)&t_pkt->rx_descriptor_fields1); const __m128i crc_adj = _mm_set_epi16(0, 0, 0, - rxq->crc_present * ETHER_CRC_LEN, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, - rxq->crc_present * ETHER_CRC_LEN, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0); const uint32_t flow_tag = t_pkt->hash.fdir.hi; #ifdef MLX5_PMD_SOFT_COUNTERS @@ -699,9 +699,9 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n, const __m128i ones = _mm_cmpeq_epi32(zero, zero); const __m128i crc_adj = _mm_set_epi16(0, 0, 0, 0, 0, - rxq->crc_present * ETHER_CRC_LEN, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, - rxq->crc_present * ETHER_CRC_LEN); + rxq->crc_present * RTE_ETHER_CRC_LEN); const __m128i flow_mark_adj = _mm_set_epi32(rxq->mark * (-1), 0, 0, 0); assert(rxq->sges_n == 0); diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index d8a6b50b0..7fca9a125 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -343,7 +343,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) continue; memcpy(&unicast.dst.addr_bytes, mac->addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); for (j = 0; j != vlan_filter_n; ++j) { uint16_t vlan = priv->vlan_filter[j]; diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 9ec71c3c1..965744406 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -261,7 +261,7 @@ mvneta_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) mbuf_data_size, mtu, mru); } - if (mtu < ETHER_MIN_MTU || mru > MVNETA_PKT_SIZE_MAX) { + if (mtu < RTE_ETHER_MIN_MTU || mru > MVNETA_PKT_SIZE_MAX) { MVNETA_LOG(ERR, "Invalid MTU [%u] or MRU [%u]", mtu, mru); return -EINVAL; } @@ -586,7 +586,7 @@ static void mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct mvneta_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (!priv->ppio) @@ -621,7 +621,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct mvneta_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (index == 0) @@ -660,7 +660,7 @@ mvneta_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = neta_ppio_set_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to set mac to %s", buf); } @@ -794,7 +794,7 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name) eth_dev->data->mac_addrs = rte_zmalloc("mac_addrs", - ETHER_ADDR_LEN * MVNETA_MAC_ADDRS_MAX, 0); + RTE_ETHER_ADDR_LEN * MVNETA_MAC_ADDRS_MAX, 0); if (!eth_dev->data->mac_addrs) { MVNETA_LOG(ERR, "Failed to allocate space for eth addrs"); ret = -ENOMEM; @@ -808,7 +808,7 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name) goto out_free; memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - req.ifr_addr.sa_data, ETHER_ADDR_LEN); + req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN); eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->device = &vdev->device; diff --git a/drivers/net/mvneta/mvneta_ethdev.h b/drivers/net/mvneta/mvneta_ethdev.h index 101b0a817..c39d15eec 100644 --- a/drivers/net/mvneta/mvneta_ethdev.h +++ b/drivers/net/mvneta/mvneta_ethdev.h @@ -46,7 +46,7 @@ #define MRVL_NETA_RXD_ALIGN 32 #define MRVL_NETA_VLAN_TAG_LEN 4 -#define MRVL_NETA_ETH_HDRS_LEN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ +#define MRVL_NETA_ETH_HDRS_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \ MRVL_NETA_VLAN_TAG_LEN) #define MRVL_NETA_HDRS_LEN (MV_MH_SIZE + MRVL_NETA_ETH_HDRS_LEN) diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 4c6edb41d..d1d0d4186 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -448,7 +448,7 @@ mrvl_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) mbuf_data_size, mtu, mru); } - if (mtu < ETHER_MIN_MTU || mru > MRVL_PKT_SIZE_MAX) { + if (mtu < RTE_ETHER_MIN_MTU || mru > MRVL_PKT_SIZE_MAX) { MRVL_LOG(ERR, "Invalid MTU [%u] or MRU [%u]", mtu, mru); return -EINVAL; } @@ -1068,7 +1068,7 @@ static void mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct mrvl_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (!priv->ppio) @@ -1106,7 +1106,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct mrvl_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (priv->isolated) @@ -1167,7 +1167,7 @@ mrvl_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = pp2_ppio_set_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to set mac to %s", buf); } @@ -2787,7 +2787,7 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name) eth_dev->data->mac_addrs = rte_zmalloc("mac_addrs", - ETHER_ADDR_LEN * MRVL_MAC_ADDRS_MAX, 0); + RTE_ETHER_ADDR_LEN * MRVL_MAC_ADDRS_MAX, 0); if (!eth_dev->data->mac_addrs) { MRVL_LOG(ERR, "Failed to allocate space for eth addrs"); ret = -ENOMEM; @@ -2801,7 +2801,7 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name) goto out_free; memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - req.ifr_addr.sa_data, ETHER_ADDR_LEN); + req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN); eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->device = &vdev->device; diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h index 0120b9e8a..7bc450c41 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.h +++ b/drivers/net/mvpp2/mrvl_ethdev.h @@ -73,7 +73,7 @@ #define MRVL_PP2_BUF_RELEASE_BURST_SIZE 64 #define MRVL_PP2_VLAN_TAG_LEN 4 -#define MRVL_PP2_ETH_HDRS_LEN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ +#define MRVL_PP2_ETH_HDRS_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \ (2 * MRVL_PP2_VLAN_TAG_LEN)) #define MRVL_PP2_HDRS_LEN (MV_MH_SIZE + MRVL_PP2_ETH_HDRS_LEN) #define MRVL_PP2_MTU_TO_MRU(mtu) ((mtu) + MRVL_PP2_HDRS_LEN) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index dadff166e..863053d99 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -762,7 +762,7 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) if (!hv->primary) return -ENOMEM; - err = hn_attach(hv, ETHER_MTU); + err = hn_attach(hv, RTE_ETHER_MTU); if (err) goto failed; diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c index d58770e04..6b518685a 100644 --- a/drivers/net/netvsc/hn_nvs.c +++ b/drivers/net/netvsc/hn_nvs.c @@ -323,7 +323,7 @@ hn_nvs_conf_ndis(struct hn_data *hv, unsigned int mtu) memset(&conf, 0, sizeof(conf)); conf.type = NVS_TYPE_NDIS_CONF; - conf.mtu = mtu + ETHER_HDR_LEN; + conf.mtu = mtu + RTE_ETHER_HDR_LEN; conf.caps = NVS_NDIS_CONF_VLAN; /* enable SRIOV */ diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c index 0134ecb67..4a1d49ffc 100644 --- a/drivers/net/netvsc/hn_rndis.c +++ b/drivers/net/netvsc/hn_rndis.c @@ -1093,7 +1093,7 @@ hn_rndis_get_eaddr(struct hn_data *hv, uint8_t *eaddr) uint32_t eaddr_len; int error; - eaddr_len = ETHER_ADDR_LEN; + eaddr_len = RTE_ETHER_ADDR_LEN; error = hn_rndis_query(hv, OID_802_3_PERMANENT_ADDRESS, NULL, 0, eaddr, eaddr_len); if (error) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index ef5abd37b..b8ed7b18c 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -100,7 +100,7 @@ struct hn_txdesc { /* Minimum space required for a packet */ #define HN_PKTSIZE_MIN(align) \ - RTE_ALIGN(ETHER_MIN_LEN + HN_RNDIS_PKT_LEN, align) + RTE_ALIGN(RTE_ETHER_MIN_LEN + HN_RNDIS_PKT_LEN, align) #define DEFAULT_TX_FREE_THRESH 32U @@ -606,7 +606,7 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq, if (unlikely(data_off + data_len > pkt->len)) goto error; - if (unlikely(data_len < ETHER_HDR_LEN)) + if (unlikely(data_len < RTE_ETHER_HDR_LEN)) goto error; hn_rxpkt(rxq, rxb, data, data_off, data_len, &info); diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index a54243392..5c7814a12 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1213,7 +1213,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues; dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues; - dev_info->min_rx_bufsize = ETHER_MIN_MTU; + dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU; dev_info->max_rx_pktlen = hw->max_mtu; /* Next should change when PF support is implemented */ dev_info->max_mac_addrs = 1; @@ -1486,7 +1486,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || ((uint32_t)mtu > hw->max_mtu)) + if ((mtu < RTE_ETHER_MIN_MTU) || ((uint32_t)mtu > hw->max_mtu)) return -EINVAL; /* mtu setting is forbidden if port is started */ @@ -1497,7 +1497,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } /* switch to jumbo mode if needed */ - if ((uint32_t)mtu > ETHER_MAX_LEN) + if ((uint32_t)mtu > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -2905,7 +2905,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); - hw->mtu = ETHER_MTU; + hw->mtu = RTE_ETHER_MTU; /* VLAN insertion is incompatible with LSOv2 */ if (hw->cap & NFP_NET_CFG_CTRL_LSO2) @@ -2948,7 +2948,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) rte_spinlock_init(&hw->reconfig_lock); /* Allocating memory for mac addr */ - eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to space for MAC address"); err = -ENOMEM; diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h index 7913a29c2..9e2032698 100644 --- a/drivers/net/nfp/nfp_net_pmd.h +++ b/drivers/net/nfp/nfp_net_pmd.h @@ -436,7 +436,7 @@ struct nfp_net_hw { #endif #endif - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* Records starting point for counters */ struct rte_eth_stats eth_stats_base; diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 643479254..1055f3702 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -142,7 +142,7 @@ octeontx_port_open(struct octeontx_nic *nic) nic->mcast_mode = bgx_port_conf.mcast_mode; nic->speed = bgx_port_conf.mode; - memcpy(&nic->mac_addr[0], &bgx_port_conf.macaddr[0], ETHER_ADDR_LEN); + memcpy(&nic->mac_addr[0], &bgx_port_conf.macaddr[0], RTE_ETHER_ADDR_LEN); octeontx_log_dbg("port opened %d", nic->port_id); return res; @@ -1064,7 +1064,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, data->all_multicast = 0; data->scattered_rx = 0; - data->mac_addrs = rte_zmalloc_socket(octtx_name, ETHER_ADDR_LEN, 0, + data->mac_addrs = rte_zmalloc_socket(octtx_name, RTE_ETHER_ADDR_LEN, 0, socket_id); if (data->mac_addrs == NULL) { octeontx_log_err("failed to allocate memory for mac_addrs"); @@ -1085,7 +1085,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, } /* Update port_id mac to eth_dev */ - memcpy(data->mac_addrs, nic->mac_addr, ETHER_ADDR_LEN); + memcpy(data->mac_addrs, nic->mac_addr, RTE_ETHER_ADDR_LEN); PMD_INIT_LOG(DEBUG, "ethdev info: "); PMD_INIT_LOG(DEBUG, "port %d, port_ena %d ochan %d num_ochan %d tx_q %d", diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h index 2a4a08afc..fd2e99edf 100644 --- a/drivers/net/octeontx/octeontx_ethdev.h +++ b/drivers/net/octeontx/octeontx_ethdev.h @@ -62,7 +62,7 @@ struct octeontx_nic { uint8_t duplex; uint8_t speed; uint16_t mtu; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* Rx port parameters */ struct { bool classifier_enable; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 7655b3a7a..10277b9b6 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -28,7 +28,7 @@ #include #define RTE_ETH_PCAP_SNAPSHOT_LEN 65535 -#define RTE_ETH_PCAP_SNAPLEN ETHER_MAX_JUMBO_FRAME_LEN +#define RTE_ETH_PCAP_SNAPLEN RTE_ETHER_MAX_JUMBO_FRAME_LEN #define RTE_ETH_PCAP_PROMISC 1 #define RTE_ETH_PCAP_TIMEOUT -1 @@ -287,7 +287,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) pcap_dump((u_char *)dumper, &header, rte_pktmbuf_mtod(mbuf, void*)); } else { - if (mbuf->pkt_len <= ETHER_MAX_JUMBO_FRAME_LEN) { + if (mbuf->pkt_len <= RTE_ETHER_MAX_JUMBO_FRAME_LEN) { eth_pcap_gather_data(tx_pcap_data, mbuf); pcap_dump((u_char *)dumper, &header, tx_pcap_data); @@ -295,7 +295,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) PMD_LOG(ERR, "Dropping PCAP packet. Size (%d) > max jumbo size (%d).", mbuf->pkt_len, - ETHER_MAX_JUMBO_FRAME_LEN); + RTE_ETHER_MAX_JUMBO_FRAME_LEN); rte_pktmbuf_free(mbuf); break; @@ -349,7 +349,7 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_pktmbuf_mtod(mbuf, u_char *), mbuf->pkt_len); } else { - if (mbuf->pkt_len <= ETHER_MAX_JUMBO_FRAME_LEN) { + if (mbuf->pkt_len <= RTE_ETHER_MAX_JUMBO_FRAME_LEN) { eth_pcap_gather_data(tx_pcap_data, mbuf); ret = pcap_sendpacket(pcap, tx_pcap_data, mbuf->pkt_len); @@ -357,7 +357,7 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) PMD_LOG(ERR, "Dropping PCAP packet. Size (%d) > max jumbo size (%d).", mbuf->pkt_len, - ETHER_MAX_JUMBO_FRAME_LEN); + RTE_ETHER_MAX_JUMBO_FRAME_LEN); rte_pktmbuf_free(mbuf); break; @@ -993,7 +993,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, return -1; } - mac_addrs = rte_zmalloc_socket(NULL, ETHER_ADDR_LEN, 0, numa_node); + mac_addrs = rte_zmalloc_socket(NULL, RTE_ETHER_ADDR_LEN, 0, numa_node); if (!mac_addrs) { close(if_fd); return -1; @@ -1002,7 +1002,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, PMD_LOG(INFO, "Setting phy MAC for %s", if_name); eth_dev->data->mac_addrs = mac_addrs; rte_memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(if_fd); @@ -1040,7 +1040,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, ifm = (struct if_msghdr *)buf; sdl = (struct sockaddr_dl *)(ifm + 1); - mac_addrs = rte_zmalloc_socket(NULL, ETHER_ADDR_LEN, 0, numa_node); + mac_addrs = rte_zmalloc_socket(NULL, RTE_ETHER_ADDR_LEN, 0, numa_node); if (!mac_addrs) { rte_free(buf); return -1; @@ -1049,7 +1049,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, PMD_LOG(INFO, "Setting phy MAC for %s", if_name); eth_dev->data->mac_addrs = mac_addrs; rte_memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - LLADDR(sdl), ETHER_ADDR_LEN); + LLADDR(sdl), RTE_ETHER_ADDR_LEN); rte_free(buf); diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 1abf44fa7..ec918c8ac 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -332,7 +332,7 @@ u32 qede_find_first_zero_bit(unsigned long *, u32); qede_find_first_zero_bit(bitmap, length) #define OSAL_BUILD_BUG_ON(cond) nothing -#define ETH_ALEN ETHER_ADDR_LEN +#define ETH_ALEN RTE_ETHER_ADDR_LEN #define OSAL_BITMAP_WEIGHT(bitmap, count) 0 diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index d7e1d7b32..434a8b96a 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -3656,9 +3656,9 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev, &p_dev->mf_bits))) { if (OSAL_TEST_BIT(ECORE_MF_8021Q_TAGGING, &p_dev->mf_bits)) - ether_type = ETHER_TYPE_VLAN; + ether_type = RTE_ETHER_TYPE_VLAN; else - ether_type = ETHER_TYPE_QINQ; + ether_type = RTE_ETHER_TYPE_QINQ; STORE_RT_REG(p_hwfn, PRS_REG_TAG_ETHERTYPE_0_RT_OFFSET, ether_type); STORE_RT_REG(p_hwfn, NIG_REG_TAG_ETHERTYPE_0_RT_OFFSET, diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 243c6974e..62303509f 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -565,7 +565,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, if (add) { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, - ETHER_ADDR_LEN) == 0) && + RTE_ETHER_ADDR_LEN) == 0) && ucast->vni == tmp->vni && ucast->vlan == tmp->vlan) { DP_INFO(edev, "Unicast MAC is already added" @@ -588,7 +588,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } else { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, - ETHER_ADDR_LEN) == 0) && + RTE_ETHER_ADDR_LEN) == 0) && ucast->vlan == tmp->vlan && ucast->vni == tmp->vni) break; @@ -1214,7 +1214,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) eth_dev->data->mtu = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN - QEDE_ETH_OVERHEAD; + RTE_ETHER_HDR_LEN - QEDE_ETH_OVERHEAD; if (rxmode->offloads & DEV_RX_OFFLOAD_SCATTER) eth_dev->data->scattered_rx = 1; @@ -2229,9 +2229,9 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) qede_dev_info_get(dev, &dev_info); max_rx_pkt_len = mtu + QEDE_MAX_ETHER_HDR_LEN; frame_size = max_rx_pkt_len; - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) { + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) { DP_ERR(edev, "MTU %u out of range, %u is maximum allowable\n", - mtu, dev_info.max_rx_pktlen - ETHER_HDR_LEN - + mtu, dev_info.max_rx_pktlen - RTE_ETHER_HDR_LEN - QEDE_ETH_OVERHEAD); return -EINVAL; } @@ -2271,7 +2271,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) fp->rxq->rx_buf_size = rc; } } - if (max_rx_pkt_len > ETHER_MAX_LEN) + if (max_rx_pkt_len > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -2405,7 +2405,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) struct qed_slowpath_params params; static bool do_once = true; uint8_t bulletin_change; - uint8_t vf_mac[ETHER_ADDR_LEN]; + uint8_t vf_mac[RTE_ETHER_ADDR_LEN]; uint8_t is_mac_forced; bool is_mac_exist; /* Fix up ecore debug level */ @@ -2535,7 +2535,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) /* Allocate memory for storing MAC addr */ eth_dev->data->mac_addrs = rte_zmalloc(edev->name, - (ETHER_ADDR_LEN * + (RTE_ETHER_ADDR_LEN * adapter->dev_info.num_mac_filters), RTE_CACHE_LINE_SIZE); @@ -2591,7 +2591,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) SLIST_INIT(&adapter->vlan_list_head); SLIST_INIT(&adapter->uc_list_head); SLIST_INIT(&adapter->mc_list_head); - adapter->mtu = ETHER_MTU; + adapter->mtu = RTE_ETHER_MTU; adapter->vport_started = false; /* VF tunnel offloads is enabled by default in PF driver */ diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 27fbe538a..12c83f46d 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -221,7 +221,7 @@ qede_fdir_to_arfs_filter(struct rte_eth_dev *eth_dev, case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: /* fill the common ip header */ - arfs->tuple.eth_proto = ETHER_TYPE_IPv4; + arfs->tuple.eth_proto = RTE_ETHER_TYPE_IPv4; arfs->tuple.dst_ipv4 = input->flow.ip4_flow.dst_ip; arfs->tuple.src_ipv4 = input->flow.ip4_flow.src_ip; arfs->tuple.ip_proto = next_proto[input->flow_type]; @@ -237,7 +237,7 @@ qede_fdir_to_arfs_filter(struct rte_eth_dev *eth_dev, break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - arfs->tuple.eth_proto = ETHER_TYPE_IPv6; + arfs->tuple.eth_proto = RTE_ETHER_TYPE_IPv6; arfs->tuple.ip_proto = next_proto[input->flow_type]; rte_memcpy(arfs->tuple.dst_ipv6, &input->flow.ipv6_flow.dst_ip, @@ -473,7 +473,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, *ether_type = rte_cpu_to_be_16(arfs->tuple.eth_proto); switch (arfs->tuple.eth_proto) { - case ETHER_TYPE_IPv4: + case RTE_ETHER_TYPE_IPv4: ip = (struct ipv4_hdr *)raw_pkt; ip->version_ihl = QEDE_FDIR_IP_DEFAULT_VERSION_IHL; ip->total_length = sizeof(struct ipv4_hdr); @@ -506,7 +506,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, params->tcp = true; } break; - case ETHER_TYPE_IPv6: + case RTE_ETHER_TYPE_IPv6: ip6 = (struct ipv6_hdr *)raw_pkt; ip6->proto = arfs->tuple.ip_proto; ip6->vtc_flow = @@ -992,25 +992,25 @@ qede_set_ucast_tunn_cmn_param(struct ecore_filter_ucast *ucast, break; case ECORE_FILTER_MAC: memcpy(ucast->mac, conf->outer_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); break; case ECORE_FILTER_INNER_MAC: memcpy(ucast->mac, conf->inner_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); break; case ECORE_FILTER_MAC_VNI_PAIR: memcpy(ucast->mac, conf->outer_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ucast->vni = conf->tenant_id; break; case ECORE_FILTER_INNER_MAC_VNI_PAIR: memcpy(ucast->mac, conf->inner_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ucast->vni = conf->tenant_id; break; case ECORE_FILTER_INNER_PAIR: memcpy(ucast->mac, conf->inner_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ucast->vlan = conf->inner_vlan; break; default: @@ -1266,7 +1266,7 @@ qede_flow_parse_pattern(__attribute__((unused))struct rte_eth_dev *dev, spec = pattern->spec; flow->entry.tuple.src_ipv4 = spec->hdr.src_addr; flow->entry.tuple.dst_ipv4 = spec->hdr.dst_addr; - flow->entry.tuple.eth_proto = ETHER_TYPE_IPv4; + flow->entry.tuple.eth_proto = RTE_ETHER_TYPE_IPv4; } break; @@ -1283,7 +1283,7 @@ qede_flow_parse_pattern(__attribute__((unused))struct rte_eth_dev *dev, rte_memcpy(flow->entry.tuple.dst_ipv6, spec->hdr.dst_addr, IPV6_ADDR_LEN); - flow->entry.tuple.eth_proto = ETHER_TYPE_IPv6; + flow->entry.tuple.eth_proto = RTE_ETHER_TYPE_IPv6; } break; diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index b840c743c..02feaba16 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -17,7 +17,7 @@ enum ecore_int_mode; struct qed_dev_info { uint8_t num_hwfns; - uint8_t hw_mac[ETHER_ADDR_LEN]; + uint8_t hw_mac[RTE_ETHER_ADDR_LEN]; bool is_mf_default; /* FW version */ diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index ec6190b11..8a108f99c 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -369,7 +369,7 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info) dev_info->dev_type = edev->type; rte_memcpy(&dev_info->hw_mac, &edev->hwfns[0].hw_info.hw_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); dev_info->fw_major = FW_MAJOR_VERSION; dev_info->fw_minor = FW_MINOR_VERSION; @@ -434,7 +434,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info) max_vf_vlan_filters; rte_memcpy(&info->port_mac, &edev->hwfns[0].hw_info.hw_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } else { ecore_vf_get_num_rxqs(ECORE_LEADING_HWFN(edev), &info->num_queues); @@ -455,7 +455,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info) qed_fill_dev_info(edev, &info->common); if (IS_VF(edev)) - memset(&info->common.hw_mac, 0, ETHER_ADDR_LEN); + memset(&info->common.hw_mac, 0, RTE_ETHER_ADDR_LEN); return 0; } diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 0e8a3675b..235f78ae3 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -963,21 +963,21 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) ethertype = rte_cpu_to_be_16(eth_hdr->ether_type); /* Note: Valid only if VLAN stripping is disabled */ - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { vlan_tagged = 1; vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); len += sizeof(struct rte_vlan_hdr); ethertype = rte_cpu_to_be_16(vlan_hdr->eth_proto); } - if (ethertype == ETHER_TYPE_IPv4) { + if (ethertype == RTE_ETHER_TYPE_IPv4) { packet_type |= RTE_PTYPE_L3_IPV4; ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len); if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) packet_type |= RTE_PTYPE_L4_UDP; - } else if (ethertype == ETHER_TYPE_IPv6) { + } else if (ethertype == RTE_ETHER_TYPE_IPv6) { packet_type |= RTE_PTYPE_L3_IPV6; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len); if (ipv6_hdr->proto == IPPROTO_TCP) diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h index 5b249cbb2..41a5f0f5c 100644 --- a/drivers/net/qede/qede_rxtx.h +++ b/drivers/net/qede/qede_rxtx.h @@ -70,7 +70,7 @@ #define QEDE_ETH_OVERHEAD (((2 * QEDE_VLAN_TAG_SIZE)) \ + (QEDE_LLC_SNAP_HDR_LEN) + 2) -#define QEDE_MAX_ETHER_HDR_LEN (ETHER_HDR_LEN + QEDE_ETH_OVERHEAD) +#define QEDE_MAX_ETHER_HDR_LEN (RTE_ETHER_HDR_LEN + QEDE_ETH_OVERHEAD) #define QEDE_RSS_OFFLOAD_ALL (ETH_RSS_IPV4 |\ ETH_RSS_NONFRAG_IPV4_TCP |\ diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 3324194d5..8bd04659e 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -905,7 +905,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) * The driver does not use it, but other PMDs update jumbo frame * flag and max_rx_pkt_len when MTU is set. */ - if (mtu > ETHER_MAX_LEN) { + if (mtu > RTE_ETHER_MAX_LEN) { struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; } @@ -2057,7 +2057,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) sfc_log_init(sa, "entry"); - dev->data->mac_addrs = rte_zmalloc("sfc", ETHER_ADDR_LEN, 0); + dev->data->mac_addrs = rte_zmalloc("sfc", RTE_ETHER_ADDR_LEN, 0); if (dev->data->mac_addrs == NULL) { rc = ENOMEM; goto fail_mac_addrs; diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 26d7de91e..9927253ef 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -952,7 +952,7 @@ sfc_flow_parse_geneve(const struct rte_flow_item *item, return 0; if (mask->protocol == supp_mask.protocol) { - if (spec->protocol != rte_cpu_to_be_16(ETHER_TYPE_TEB)) { + if (spec->protocol != rte_cpu_to_be_16(RTE_ETHER_TYPE_TEB)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "GENEVE encap. protocol must be Ethernet " diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c index 7ea6eb4fa..dc15ec8aa 100644 --- a/drivers/net/softnic/parser.c +++ b/drivers/net/softnic/parser.c @@ -533,7 +533,7 @@ my_ether_aton(const char *a) { int i; char *end; - unsigned long o[ETHER_ADDR_LEN]; + unsigned long o[RTE_ETHER_ADDR_LEN]; static struct rte_ether_addr ether_addr; i = 0; @@ -550,14 +550,14 @@ my_ether_aton(const char *a) return NULL; /* Support the format XX:XX:XX:XX:XX:XX */ - if (i == ETHER_ADDR_LEN) { + if (i == RTE_ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) return NULL; ether_addr.addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ - } else if (i == ETHER_ADDR_LEN / 2) { + } else if (i == RTE_ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return NULL; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index df92a536c..bb0aee42d 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -565,9 +565,9 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs, char *buff_data = rte_pktmbuf_mtod(seg, void *); proto = (*buff_data & 0xf0); pi.proto = (proto == 0x40) ? - rte_cpu_to_be_16(ETHER_TYPE_IPv4) : + rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) : ((proto == 0x60) ? - rte_cpu_to_be_16(ETHER_TYPE_IPv6) : + rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) : 0x00); } @@ -657,7 +657,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) return 0; struct rte_mbuf *gso_mbufs[MAX_GSO_MBUFS]; - max_size = *txq->mtu + (ETHER_HDR_LEN + ETHER_CRC_LEN + 4); + max_size = *txq->mtu + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 4); for (i = 0; i < nb_pkts; i++) { struct rte_mbuf *mbuf_in = bufs[num_tx]; struct rte_mbuf **mbuf; @@ -677,7 +677,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* TCP segmentation implies TCP checksum offload */ mbuf_in->ol_flags |= PKT_TX_TCP_CKSUM; - /* gso size is calculated without ETHER_CRC_LEN */ + /* gso size is calculated without RTE_ETHER_CRC_LEN */ hdrs_len = mbuf_in->l2_len + mbuf_in->l3_len + mbuf_in->l4_len; tso_segsz = mbuf_in->tso_segsz + hdrs_len; @@ -924,7 +924,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->if_index = internals->if_index; dev_info->max_mac_addrs = 1; - dev_info->max_rx_pktlen = (uint32_t)ETHER_MAX_VLAN_FRAME_LEN; + dev_info->max_rx_pktlen = (uint32_t)RTE_ETHER_MAX_VLAN_FRAME_LEN; dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES; dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES; dev_info->min_rx_bufsize = 0; @@ -1183,11 +1183,11 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; - rte_memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, ETHER_ADDR_LEN); + rte_memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, RTE_ETHER_ADDR_LEN); ret = tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 1, mode); if (ret < 0) return ret; - rte_memcpy(&pmd->eth_addr, mac_addr, ETHER_ADDR_LEN); + rte_memcpy(&pmd->eth_addr, mac_addr, RTE_ETHER_ADDR_LEN); if (pmd->remote_if_index && !pmd->flow_isolate) { /* Replace MAC redirection rule after a MAC change */ ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_LOCAL_MAC); @@ -1780,7 +1780,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, memset(&ifr, 0, sizeof(struct ifreq)); ifr.ifr_hwaddr.sa_family = AF_LOCAL; rte_memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) goto error_exit; } @@ -1835,7 +1835,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, goto error_remote; } rte_memcpy(&pmd->eth_addr, ifr.ifr_hwaddr.sa_data, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); /* The desired MAC is already in ifreq after SIOCGIFHWADDR. */ if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) { TAP_LOG(ERR, "%s: failed to get %s MAC address.", @@ -1994,8 +1994,8 @@ set_mac_type(const char *key __rte_unused, static int iface_idx; /* fixed mac = 00:64:74:61:70: */ - memcpy((char *)user_mac->addr_bytes, "\0dtap", ETHER_ADDR_LEN); - user_mac->addr_bytes[ETHER_ADDR_LEN - 1] = iface_idx++ + '0'; + memcpy((char *)user_mac->addr_bytes, "\0dtap", RTE_ETHER_ADDR_LEN); + user_mac->addr_bytes[RTE_ETHER_ADDR_LEN - 1] = iface_idx++ + '0'; goto success; } diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index 20963090c..7fd0bd7f7 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -538,17 +538,17 @@ tap_flow_create_eth(const struct rte_flow_item *item, void *data) return 0; msg = &flow->msg; if (!rte_is_zero_ether_addr(&mask->dst)) { - tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, + tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, RTE_ETHER_ADDR_LEN, &spec->dst.addr_bytes); tap_nlattr_add(&msg->nh, - TCA_FLOWER_KEY_ETH_DST_MASK, ETHER_ADDR_LEN, + TCA_FLOWER_KEY_ETH_DST_MASK, RTE_ETHER_ADDR_LEN, &mask->dst.addr_bytes); } if (!rte_is_zero_ether_addr(&mask->src)) { - tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, + tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, RTE_ETHER_ADDR_LEN, &spec->src.addr_bytes); tap_nlattr_add(&msg->nh, - TCA_FLOWER_KEY_ETH_SRC_MASK, ETHER_ADDR_LEN, + TCA_FLOWER_KEY_ETH_SRC_MASK, RTE_ETHER_ADDR_LEN, &mask->src.addr_bytes); } return 0; diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h index 6de07c708..a0bb0ba0a 100644 --- a/drivers/net/thunderx/base/nicvf_plat.h +++ b/drivers/net/thunderx/base/nicvf_plat.h @@ -44,7 +44,7 @@ /* Constants */ #include -#define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN +#define NICVF_MAC_ADDR_SIZE RTE_ETHER_ADDR_LEN #include #define nicvf_addr_write(addr, val) rte_write64_relaxed((val), (void *)(addr)) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 482968b7a..3692c4b58 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -191,7 +191,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) (frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS)) return -EINVAL; - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -200,7 +200,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) return -EINVAL; /* Update max_rx_pkt_len */ - rxmode->max_rx_pkt_len = mtu + ETHER_HDR_LEN; + rxmode->max_rx_pkt_len = mtu + RTE_ETHER_HDR_LEN; nic->mtu = mtu; for (i = 0; i < nic->sqs_count; i++) @@ -1408,8 +1408,8 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if (nicvf_hw_version(nic) != PCI_SUB_DEVICE_ID_CN81XX_NICVF) dev_info->speed_capa |= ETH_LINK_SPEED_40G; - dev_info->min_rx_bufsize = ETHER_MIN_MTU; - dev_info->max_rx_pktlen = NIC_HW_MAX_MTU + ETHER_HDR_LEN; + dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU; + dev_info->max_rx_pktlen = NIC_HW_MAX_MTU + RTE_ETHER_HDR_LEN; dev_info->max_rx_queues = (uint16_t)MAX_RCV_QUEUES_PER_QS * (MAX_SQS_PER_VF + 1); dev_info->max_tx_queues = @@ -1736,7 +1736,7 @@ nicvf_dev_start(struct rte_eth_dev *dev) /* Setup MTU based on max_rx_pkt_len or default */ mtu = dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME ? dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN : ETHER_MTU; + - RTE_ETHER_HDR_LEN : RTE_ETHER_MTU; if (nicvf_dev_set_mtu(dev, mtu)) { PMD_INIT_LOG(ERR, "Failed to set default mtu size"); @@ -2173,7 +2173,7 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) return ENOTSUP; } - eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate memory for mac addr"); ret = -ENOMEM; diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h index dd52f38e5..5d1379803 100644 --- a/drivers/net/thunderx/nicvf_struct.h +++ b/drivers/net/thunderx/nicvf_struct.h @@ -105,7 +105,7 @@ struct nicvf { uint16_t mtu; int skip_bytes; bool vlan_filter_en; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* secondary queue set support */ uint8_t sqs_id; uint8_t sqs_count; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 445f89989..40b9b81fc 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -832,16 +832,16 @@ static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct virtio_hw *hw = dev->data->dev_private; - uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + + uint32_t ether_hdr_len = RTE_ETHER_HDR_LEN + VLAN_TAG_LEN + hw->vtnet_hdr_size; uint32_t frame_size = mtu + ether_hdr_len; uint32_t max_frame_size = hw->max_mtu + ether_hdr_len; max_frame_size = RTE_MIN(max_frame_size, VIRTIO_MAX_RX_PKTLEN); - if (mtu < ETHER_MIN_MTU || frame_size > max_frame_size) { + if (mtu < RTE_ETHER_MIN_MTU || frame_size > max_frame_size) { PMD_INIT_LOG(ERR, "MTU should be between %d and %d", - ETHER_MIN_MTU, max_frame_size - ether_hdr_len); + RTE_ETHER_MIN_MTU, max_frame_size - ether_hdr_len); return -EINVAL; } return 0; @@ -1097,7 +1097,7 @@ virtio_set_hwaddr(struct virtio_hw *hw) { vtpci_write_dev_config(hw, offsetof(struct virtio_net_config, mac), - &hw->mac_addr, ETHER_ADDR_LEN); + &hw->mac_addr, RTE_ETHER_ADDR_LEN); } static void @@ -1106,7 +1106,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) if (vtpci_with_feature(hw, VIRTIO_NET_F_MAC)) { vtpci_read_dev_config(hw, offsetof(struct virtio_net_config, mac), - &hw->mac_addr, ETHER_ADDR_LEN); + &hw->mac_addr, RTE_ETHER_ADDR_LEN); } else { rte_eth_random_addr(&hw->mac_addr[0]); virtio_set_hwaddr(hw); @@ -1129,10 +1129,10 @@ virtio_mac_table_set(struct virtio_hw *hw, ctrl.hdr.class = VIRTIO_NET_CTRL_MAC; ctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_TABLE_SET; - len[0] = uc->entries * ETHER_ADDR_LEN + sizeof(uc->entries); + len[0] = uc->entries * RTE_ETHER_ADDR_LEN + sizeof(uc->entries); memcpy(ctrl.data, uc, len[0]); - len[1] = mc->entries * ETHER_ADDR_LEN + sizeof(mc->entries); + len[1] = mc->entries * RTE_ETHER_ADDR_LEN + sizeof(mc->entries); memcpy(ctrl.data + len[0], mc, len[1]); err = virtio_send_command(hw->cvq, &ctrl, len, 2); @@ -1155,9 +1155,9 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, return -EINVAL; } - uc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(uc->entries)); + uc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(uc->entries)); uc->entries = 0; - mc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(mc->entries)); + mc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(mc->entries)); mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { @@ -1166,7 +1166,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, struct virtio_net_ctrl_mac *tbl = rte_is_multicast_ether_addr(addr) ? mc : uc; - memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN); + memcpy(&tbl->macs[tbl->entries++], addr, RTE_ETHER_ADDR_LEN); } return virtio_mac_table_set(hw, uc, mc); @@ -1185,9 +1185,9 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) return; } - uc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(uc->entries)); + uc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(uc->entries)); uc->entries = 0; - mc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(mc->entries)); + mc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(mc->entries)); mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { @@ -1197,7 +1197,7 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) continue; tbl = rte_is_multicast_ether_addr(addrs + i) ? mc : uc; - memcpy(&tbl->macs[tbl->entries++], addrs + i, ETHER_ADDR_LEN); + memcpy(&tbl->macs[tbl->entries++], addrs + i, RTE_ETHER_ADDR_LEN); } virtio_mac_table_set(hw, uc, mc); @@ -1208,17 +1208,17 @@ virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct virtio_hw *hw = dev->data->dev_private; - memcpy(hw->mac_addr, mac_addr, ETHER_ADDR_LEN); + memcpy(hw->mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); /* Use atomic update if available */ if (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) { struct virtio_pmd_ctrl ctrl; - int len = ETHER_ADDR_LEN; + int len = RTE_ETHER_ADDR_LEN; ctrl.hdr.class = VIRTIO_NET_CTRL_MAC; ctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_ADDR_SET; - memcpy(ctrl.data, mac_addr, ETHER_ADDR_LEN); + memcpy(ctrl.data, mac_addr, RTE_ETHER_ADDR_LEN); return virtio_send_command(hw->cvq, &ctrl, &len, 1); } @@ -1297,7 +1297,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features) offsetof(struct virtio_net_config, mtu), &config.mtu, sizeof(config.mtu)); - if (config.mtu < ETHER_MIN_MTU) + if (config.mtu < RTE_ETHER_MIN_MTU) req_features &= ~(1ULL << VIRTIO_NET_F_MTU); } @@ -1710,7 +1710,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) * time, but check again in case it has changed since * then, which should not happen. */ - if (config->mtu < ETHER_MIN_MTU) { + if (config->mtu < RTE_ETHER_MIN_MTU) { PMD_INIT_LOG(ERR, "invalid max MTU value (%u)", config->mtu); return -1; @@ -1721,7 +1721,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) eth_dev->data->mtu = config->mtu; } else { - hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - ETHER_HDR_LEN - + hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - RTE_ETHER_HDR_LEN - VLAN_TAG_LEN - hw->vtnet_hdr_size; } @@ -1736,7 +1736,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) } else { PMD_INIT_LOG(DEBUG, "config->max_virtqueue_pairs=1"); hw->max_queue_pairs = 1; - hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - ETHER_HDR_LEN - + hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - RTE_ETHER_HDR_LEN - VLAN_TAG_LEN - hw->vtnet_hdr_size; } @@ -1835,11 +1835,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("virtio", VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("virtio", VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", - VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN); + VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN); return -ENOMEM; } @@ -1989,7 +1989,7 @@ virtio_dev_configure(struct rte_eth_dev *dev) const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; const struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode; struct virtio_hw *hw = dev->data->dev_private; - uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + + uint32_t ether_hdr_len = RTE_ETHER_HDR_LEN + VLAN_TAG_LEN + hw->vtnet_hdr_size; uint64_t rx_offloads = rxmode->offloads; uint64_t tx_offloads = txmode->offloads; diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 38a0261da..a38cb45ad 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -251,7 +251,7 @@ struct virtio_hw { bool has_tx_offload; bool has_rx_offload; uint16_t port_id; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; uint32_t notify_off_multiplier; uint8_t *isr; uint16_t *notify_base; @@ -294,7 +294,7 @@ extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS]; */ struct virtio_net_config { /* The config defining mac address (if VIRTIO_NET_F_MAC) */ - uint8_t mac[ETHER_ADDR_LEN]; + uint8_t mac[RTE_ETHER_ADDR_LEN]; /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ uint16_t status; uint16_t max_virtqueue_pairs; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index ab3b6cf1b..12283cd4c 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1244,7 +1244,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) PMD_RX_LOG(DEBUG, "packet len:%d", len[i]); - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); @@ -1347,7 +1347,7 @@ virtio_recv_pkts_packed(void *rx_queue, struct rte_mbuf **rx_pkts, PMD_RX_LOG(DEBUG, "packet len:%d", len[i]); - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); @@ -1461,7 +1461,7 @@ virtio_recv_pkts_inorder(void *rx_queue, rxm = rcv_pkts[i]; - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf_inorder(vq, rxm); @@ -1653,7 +1653,7 @@ virtio_recv_mergeable_pkts(void *rx_queue, rxm = rcv_pkts[i]; - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); @@ -1832,7 +1832,7 @@ virtio_recv_mergeable_pkts_packed(void *rx_queue, rxm = rcv_pkts[i]; - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c index fbd9e979d..76bf75423 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c @@ -135,7 +135,7 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq, memset(&ifr, 0, sizeof(ifr)); ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; - memcpy(ifr.ifr_hwaddr.sa_data, mac, ETHER_ADDR_LEN); + memcpy(ifr.ifr_hwaddr.sa_data, mac, RTE_ETHER_ADDR_LEN); if (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) { PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", strerror(errno)); goto error; diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 8e420bcbc..e743695e4 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -226,15 +226,15 @@ static inline void parse_mac(struct virtio_user_dev *dev, const char *mac) { int i, r; - uint32_t tmp[ETHER_ADDR_LEN]; + uint32_t tmp[RTE_ETHER_ADDR_LEN]; if (!mac) return; r = sscanf(mac, "%x:%x:%x:%x:%x:%x", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]); - if (r == ETHER_ADDR_LEN) { - for (i = 0; i < ETHER_ADDR_LEN; ++i) + if (r == RTE_ETHER_ADDR_LEN) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) dev->mac_addr[i] = (uint8_t)tmp[i]; dev->mac_specified = 1; } else { diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index 829ad4140..db7dc607a 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -43,7 +43,7 @@ struct virtio_user_dev { uint64_t unsupported_features; /* unsupported features mask */ uint8_t status; uint16_t port_id; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; char path[PATH_MAX]; union { struct vring vrings[VIRTIO_MAX_VIRTQUEUES]; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 129c2b9ef..893f48a5d 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -118,8 +118,8 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, struct virtio_user_dev *dev = virtio_user_get_dev(hw); if (offset == offsetof(struct virtio_net_config, mac) && - length == ETHER_ADDR_LEN) { - for (i = 0; i < ETHER_ADDR_LEN; ++i) + length == RTE_ETHER_ADDR_LEN) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) ((uint8_t *)dst)[i] = dev->mac_addr[i]; return; } @@ -179,8 +179,8 @@ virtio_user_write_dev_config(struct virtio_hw *hw, size_t offset, struct virtio_user_dev *dev = virtio_user_get_dev(hw); if ((offset == offsetof(struct virtio_net_config, mac)) && - (length == ETHER_ADDR_LEN)) - for (i = 0; i < ETHER_ADDR_LEN; ++i) + (length == RTE_ETHER_ADDR_LEN)) + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) dev->mac_addr[i] = ((const uint8_t *)src)[i]; else PMD_DRV_LOG(ERR, "not supported offset=%zu, len=%d", diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index e9dedc5da..c6dd4a347 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -134,7 +134,7 @@ enum { VTNET_RQ = 0, VTNET_TQ = 1, VTNET_CQ = 2 }; */ struct virtio_net_ctrl_mac { uint32_t entries; - uint8_t macs[][ETHER_ADDR_LEN]; + uint8_t macs[][RTE_ETHER_ADDR_LEN]; } __attribute__((__packed__)); #define VIRTIO_NET_CTRL_MAC 1 diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 3ac65d0e4..2aae8cb0c 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -302,12 +302,12 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) memcpy(hw->perm_addr + 4, &mac_hi, 2); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("vmxnet3", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("vmxnet3", RTE_ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS); + RTE_ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS); return -ENOMEM; } /* Copy the permanent MAC address */ diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index 5bc3a84c9..e5ad684cf 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -67,7 +67,7 @@ struct vmxnet3_hw { uint16_t subsystem_vendor_id; bool adapter_stopped; - uint8_t perm_addr[ETHER_ADDR_LEN]; + uint8_t perm_addr[RTE_ETHER_ADDR_LEN]; uint8_t num_tx_queues; uint8_t num_rx_queues; uint8_t bufs_per_pkt; diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 9fa492978..bf9d36615 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -62,7 +62,7 @@ static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { diff --git a/examples/bond/main.c b/examples/bond/main.c index 23171f4cf..04102b7ed 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -120,7 +120,7 @@ static struct rte_mempool *mbuf_pool; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .rx_adv_conf = { @@ -304,13 +304,13 @@ get_vlan_offset(struct rte_ether_hdr *eth_hdr, uint16_t *proto) { size_t vlan_offset = 0; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; @@ -372,12 +372,12 @@ static int lcore_main(__attribute__((unused)) void *arg1) } eth_hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) printf("VLAN taged frame, offset:"); offset = get_vlan_offset(eth_hdr, ðer_type); if (offset > 0) printf("%d\n", offset); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { if (rte_spinlock_trylock(&global_flag_stru_p->lock) == 1) { global_flag_stru_p->port_packets[1]++; rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -400,7 +400,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) rte_eth_tx_burst(BOND_PORT, 0, NULL, 0); } } - } else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { if (rte_spinlock_trylock(&global_flag_stru_p->lock) == 1) { global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -475,19 +475,19 @@ static void cmd_obj_send_parsed(void *parsed_result, eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); - memset(ð_hdr->d_addr, 0xFF, ETHER_ADDR_LEN); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); + memset(ð_hdr->d_addr, 0xFF, RTE_ETHER_ADDR_LEN); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct rte_ether_hdr)); arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); - arp_hdr->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hlen = ETHER_ADDR_LEN; + arp_hdr->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); + arp_hdr->arp_hlen = RTE_ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REQUEST); rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; - memset(&arp_hdr->arp_data.arp_tha, 0, ETHER_ADDR_LEN); + memset(&arp_hdr->arp_data.arp_tha, 0, RTE_ETHER_ADDR_LEN); arp_hdr->arp_data.arp_tip = ((unsigned char *)&res->ip.addr.ipv4)[0] | (((unsigned char *)&res->ip.addr.ipv4)[1] << 8) | diff --git a/examples/distributor/main.c b/examples/distributor/main.c index e4c8c3c18..81d7ca61d 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -81,7 +81,7 @@ struct app_stats prev_app_stats; static const struct rte_eth_conf port_conf_default = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index ce7f715f8..b6b967118 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -530,8 +530,8 @@ pcmd_mtu_callback(void *ptr_params, new_mtu = atoi(params->opt); new_mtu = strtoul(params->opt, &ptr_parse_end, 10); if (*ptr_parse_end != '\0' || - new_mtu < ETHER_MIN_MTU || - new_mtu > ETHER_MAX_JUMBO_FRAME_LEN) { + new_mtu < RTE_ETHER_MIN_MTU || + new_mtu > RTE_ETHER_MAX_JUMBO_FRAME_LEN) { printf("Port %i: Invalid MTU value\n", params->port); return; } diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index 63227f0d5..f4e57f541 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -253,7 +253,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) static const struct rte_eth_conf port_conf_default = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .rx_adv_conf = { .rss_conf = { diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index 5ae81fab1..dfb7db1c9 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -61,7 +61,7 @@ const char cb_port_delim[] = ":"; static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index cf9421874..09dbbcea9 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -47,8 +47,8 @@ struct rte_flow *flow; static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", what, buf); } diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index ed92d6f06..b34a2228f 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -52,15 +52,15 @@ * Default byte size for the IPv6 Maximum Transfer Unit (MTU). * This value includes the size of IPv6 header. */ -#define IPV4_MTU_DEFAULT ETHER_MTU -#define IPV6_MTU_DEFAULT ETHER_MTU +#define IPV4_MTU_DEFAULT RTE_ETHER_MTU +#define IPV6_MTU_DEFAULT RTE_ETHER_MTU /* * The overhead from max frame size to MTU. * We have to consider the max possible overhead. */ #define MTU_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct rte_vlan_hdr)) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 2 * sizeof(struct rte_vlan_hdr)) /* * Default payload in bytes for the IPv6 packet. @@ -355,9 +355,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, /* src addr */ rte_ether_addr_copy(&ports_eth_addr[port_out], ð_hdr->s_addr); if (ipv6) - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv6); else - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); } len += len2; @@ -570,8 +570,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -675,9 +675,9 @@ parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c index e3d0b3758..e9262e079 100644 --- a/examples/ip_pipeline/kni.c +++ b/examples/ip_pipeline/kni.c @@ -86,7 +86,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) if (!rte_eth_dev_is_valid_port(port_id)) return -EINVAL; - if (new_mtu > ETHER_MAX_LEN) + if (new_mtu > RTE_ETHER_MAX_LEN) return -EINVAL; /* Set new MTU */ diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c index 4777f9ffd..3fffeb586 100644 --- a/examples/ip_pipeline/parser.c +++ b/examples/ip_pipeline/parser.c @@ -518,7 +518,7 @@ my_ether_aton(const char *a) { int i; char *end; - unsigned long o[ETHER_ADDR_LEN]; + unsigned long o[RTE_ETHER_ADDR_LEN]; static struct rte_ether_addr ether_addr; i = 0; @@ -535,14 +535,14 @@ my_ether_aton(const char *a) return NULL; /* Support the format XX:XX:XX:XX:XX:XX */ - if (i == ETHER_ADDR_LEN) { + if (i == RTE_ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) return NULL; ether_addr.addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ - } else if (i == ETHER_ADDR_LEN / 2) { + } else if (i == RTE_ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return NULL; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 3a98e644f..c2a1f9228 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -362,7 +362,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, dst_port = next_hop; } - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; @@ -400,7 +400,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, dst_port = next_hop; } - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv6); } /* if packet wasn't IPv4 or IPv6, it's forwarded to the port it came from */ @@ -693,8 +693,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 959fa569a..05c187c4c 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -211,7 +211,7 @@ static struct lcore_conf lcore_conf[RTE_MAX_LCORE]; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -236,8 +236,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) struct rte_ether_hdr *eth; eth = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { - nlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN); + if (eth->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { + nlp = (uint8_t *)rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p)); if (*nlp == IPPROTO_ESP) t->ipsec.pkts[(t->ipsec.num)++] = pkt; @@ -247,8 +247,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) } pkt->l2_len = 0; pkt->l3_len = sizeof(struct ip); - } else if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { - nlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN); + } else if (eth->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { + nlp = (uint8_t *)rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip6_hdr, ip6_nxt)); if (*nlp == IPPROTO_ESP) t->ipsec.pkts[(t->ipsec.num)++] = pkt; @@ -329,12 +329,12 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, ip = rte_pktmbuf_mtod(pkt, struct ip *); - ethhdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); + ethhdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, RTE_ETHER_HDR_LEN); if (ip->ip_v == IPVERSION) { pkt->ol_flags |= qconf->outbound.ipv4_offloads; pkt->l3_len = sizeof(struct ip); - pkt->l2_len = ETHER_HDR_LEN; + pkt->l2_len = RTE_ETHER_HDR_LEN; ip->ip_sum = 0; @@ -342,13 +342,13 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0) ip->ip_sum = rte_ipv4_cksum((struct ipv4_hdr *)ip); - ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); } else { pkt->ol_flags |= qconf->outbound.ipv6_offloads; pkt->l3_len = sizeof(struct ip6_hdr); - pkt->l2_len = ETHER_HDR_LEN; + pkt->l2_len = RTE_ETHER_HDR_LEN; - ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); } memcpy(ðhdr->s_addr, ðaddr_tbl[port].src, @@ -1428,8 +1428,8 @@ parse_args(int32_t argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 8f84545df..cc9a30c4c 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -279,7 +279,7 @@ mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, rte_ether_addr_copy(dest_addr, ðdr->d_addr); rte_ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr); - ethdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + ethdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); /* Put new packet into the output queue */ len = qconf->tx_mbufs[port].len; @@ -537,8 +537,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/kni/main.c b/examples/kni/main.c index c96095f5f..75b55f39b 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -760,7 +760,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) memcpy(&conf, &port_conf, sizeof(conf)); /* Set new MTU */ - if (new_mtu > ETHER_MAX_LEN) + if (new_mtu > RTE_ETHER_MAX_LEN) conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -834,8 +834,8 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) static void print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, mac_addr); RTE_LOG(INFO, APP, "\t%s%s\n", name, buf); } diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index 1a8af28e2..b34b40a00 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -20,7 +20,7 @@ #define BURST_SIZE 32 static const struct rte_eth_conf port_conf_default = { - .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } + .rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN } }; /* l2fwd-cat.c: CAT enabled, basic DPDK skeleton forwarding example. */ diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index a77b000a9..973a371bf 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -212,7 +212,7 @@ struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE]; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -396,7 +396,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (eth_hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (eth_hdr->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) return -1; ipdata_offset = sizeof(struct rte_ether_hdr); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 4b94c246a..ab8ba046b 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -125,7 +125,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -1701,7 +1701,7 @@ parse_args(int argc, char **argv) /* * if no max-pkt-len set, then use the - * default value ETHER_MAX_LEN + * default value RTE_ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -1756,8 +1756,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 7d57a7f39..2725bb40b 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -200,7 +200,7 @@ uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -624,9 +624,9 @@ parse_ptype_one(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; @@ -1534,7 +1534,7 @@ parse_args(int argc, char **argv) /** * if no max-pkt-len set, use the default value - * ETHER_MAX_LEN + * RTE_ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -1579,8 +1579,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 56a55ac28..d9b636806 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -159,7 +159,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -790,8 +790,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index 64e79b946..b56b08646 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -572,7 +572,7 @@ em_parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = (struct ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; @@ -584,7 +584,7 @@ em_parse_ptype(struct rte_mbuf *m) packet_type |= RTE_PTYPE_L4_UDP; } else packet_type |= RTE_PTYPE_L3_IPV4_EXT; - } else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { + } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { ipv6_hdr = (struct ipv6_hdr *)l3; if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP; diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index d7e1aef86..96143d871 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -378,9 +378,9 @@ lpm_parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index ad013bae8..0fa9dc3a1 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -118,7 +118,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -562,7 +562,7 @@ parse_args(int argc, char **argv) /* * if no max-pkt-len set, use the default - * value ETHER_MAX_LEN. + * value RTE_ETHER_MAX_LEN. */ if (getopt_long(argc, argvopt, "", &lenopts, &option_index) == 0) { @@ -636,8 +636,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -808,7 +808,7 @@ main(int argc, char **argv) /* pre-init dst MACs for all ports to 02:00:00:00:00:xx */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) { dest_eth_addr[portid] = - ETHER_LOCAL_ADMIN_ADDR + ((uint64_t)portid << 40); + RTE_ETHER_LOCAL_ADMIN_ADDR + ((uint64_t)portid << 40); *(uint64_t *)(val_eth + portid) = dest_eth_addr[portid]; } diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index bd1ec8fa0..3d2ceea2f 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -98,9 +98,9 @@ parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; @@ -302,7 +302,7 @@ static uint16_t nb_tx_thread_params = RTE_DIM(tx_thread_params_array_default); static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -2975,7 +2975,7 @@ parse_args(int argc, char **argv) port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; - /* if no max-pkt-len set, use the default value ETHER_MAX_LEN */ + /* if no max-pkt-len set, use the default value RTE_ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -3022,9 +3022,9 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3488,7 +3488,7 @@ main(int argc, char **argv) /* pre-init dst MACs for all ports to 02:00:00:00:00:xx */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) { - dest_eth_addr[portid] = ETHER_LOCAL_ADMIN_ADDR + + dest_eth_addr[portid] = RTE_ETHER_LOCAL_ADMIN_ADDR + ((uint64_t)portid << 40); *(uint64_t *)(val_eth + portid) = dest_eth_addr[portid]; } diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 1266f521c..95b0c176e 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -49,7 +49,7 @@ static uint8_t ptp_enabled_ports[RTE_MAX_ETHPORTS]; static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 9f3344bf1..5f44f3b8c 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -54,7 +54,7 @@ static struct rte_mempool *pool = NULL; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 37c2b95fd..1209bd7ce 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -57,7 +57,7 @@ struct flow_conf qos_conf[MAX_DATA_STREAMS]; static struct rte_eth_conf port_conf = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index a277519f5..640a4152d 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -19,7 +19,7 @@ static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 7e3cd8715..a8a8e98f0 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -19,7 +19,7 @@ static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index ed2a405d5..48a46d536 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -16,9 +16,9 @@ static uint16_t get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags) { - if (ethertype == ETHER_TYPE_IPv4) + if (ethertype == RTE_ETHER_TYPE_IPv4) return rte_ipv4_phdr_cksum(l3_hdr, ol_flags); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ return rte_ipv6_phdr_cksum(l3_hdr, ol_flags); } @@ -38,20 +38,20 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, info->outer_l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); info->outer_l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); } switch (ethertype) { - case ETHER_TYPE_IPv4: + case RTE_ETHER_TYPE_IPv4: ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->outer_l2_len); info->outer_l3_len = sizeof(struct ipv4_hdr); *l4_proto = ipv4_hdr->next_proto_id; break; - case ETHER_TYPE_IPv6: + case RTE_ETHER_TYPE_IPv6: ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->outer_l2_len); info->outer_l3_len = sizeof(struct ipv6_hdr); @@ -83,7 +83,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i info->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); info->l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); @@ -91,14 +91,14 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i l3_hdr = (char *)eth_hdr + info->l2_len; - if (ethertype == ETHER_TYPE_IPv4) { + if (ethertype == RTE_ETHER_TYPE_IPv4) { ipv4_hdr = (struct ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_IPV4; ol_flags |= PKT_TX_IP_CKSUM; info->l3_len = sizeof(struct ipv4_hdr); l4_proto = ipv4_hdr->next_proto_id; - } else if (ethertype == ETHER_TYPE_IPv6) { + } else if (ethertype == RTE_ETHER_TYPE_IPv6) { ipv6_hdr = (struct ipv6_hdr *)l3_hdr; info->l3_len = sizeof(struct ipv6_hdr); l4_proto = ipv6_hdr->proto; @@ -206,7 +206,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) m->l2_len = tx_offload.l2_len; m->l3_len = tx_offload.l3_len; m->l4_len = tx_offload.l4_len; - m->l2_len += ETHER_VXLAN_HLEN; + m->l2_len += RTE_ETHER_VXLAN_HLEN; } m->outer_l2_len = sizeof(struct rte_ether_hdr); @@ -228,7 +228,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) + sizeof(struct rte_vxlan_hdr)); udp->dst_port = rte_cpu_to_be_16(vxdev.dst_port); - hash = rte_hash_crc(phdr, 2 * ETHER_ADDR_LEN, phdr->ether_type); + hash = rte_hash_crc(phdr, 2 * RTE_ETHER_ADDR_LEN, phdr->ether_type); udp->src_port = rte_cpu_to_be_16((((uint64_t) hash * PORT_RANGE) >> 32) + PORT_MIN); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 18a2215b4..0b6b2d86e 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -251,7 +251,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) return -1; } - for (i = 0; i < ETHER_ADDR_LEN; i++) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) { vdev->mac_address.addr_bytes[i] = vxdev.port[portid].vport_mac.addr_bytes[i] = pkt_hdr->s_addr.addr_bytes[i]; @@ -313,7 +313,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) &app_l2_hdr[portid].d_addr); rte_ether_addr_copy(&ports_eth_addr[0], &app_l2_hdr[portid].s_addr); - app_l2_hdr[portid].ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + app_l2_hdr[portid].ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip = &app_ip_hdr[portid]; ip->version_ihl = IP_VHL_DEF; @@ -371,7 +371,7 @@ vxlan_unlink(struct vhost_dev *vdev) vdev->rx_q); return; } - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) vdev->mac_address.addr_bytes[i] = 0; /* Clear out the receive buffers */ diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 96d697677..cbd8e248d 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -693,7 +693,7 @@ link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m) return -1; } - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) vdev->mac_address.addr_bytes[i] = pkt_hdr->s_addr.addr_bytes[i]; /* vlan_tag currently uses the device_id. */ @@ -857,7 +857,7 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) { if (ol_flags & PKT_TX_IPV4) return rte_ipv4_phdr_cksum(l3_hdr, ol_flags); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ return rte_ipv6_phdr_cksum(l3_hdr, ol_flags); } @@ -947,7 +947,7 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) tx_q = &lcore_tx_queue[lcore_id]; nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) { + if (unlikely(nh->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN))) { /* Guest has inserted the vlan tag. */ struct rte_vlan_hdr *vh = (struct rte_vlan_hdr *) (nh + 1); uint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag); diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index a2bec6242..b4de4e3a6 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -65,7 +65,7 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr) { int i; char *end; - unsigned long o[ETHER_ADDR_LEN]; + unsigned long o[RTE_ETHER_ADDR_LEN]; i = 0; do { @@ -81,14 +81,14 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr) return -1; /* Support the format XX:XX:XX:XX:XX:XX */ - if (i == ETHER_ADDR_LEN) { + if (i == RTE_ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) return -1; ether_addr->addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ - } else if (i == ETHER_ADDR_LEN / 2) { + } else if (i == RTE_ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return -1; diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index f018e1509..b0a3196bf 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -48,7 +48,7 @@ static volatile bool force_quit; /****************/ static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index f5e4e2d12..ebeae2b2e 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -491,7 +491,7 @@ rte_eth_dev_allocate(const char *name) eth_dev = eth_dev_get(port_id); strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name)); eth_dev->data->port_id = port_id; - eth_dev->data->mtu = ETHER_MTU; + eth_dev->data->mtu = RTE_ETHER_MTU; unlock: rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock); @@ -1221,20 +1221,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, dev_info.max_rx_pktlen); ret = -EINVAL; goto rollback; - } else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { + } else if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN) { RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%u max_rx_pkt_len %u < min valid value %u\n", port_id, dev_conf->rxmode.max_rx_pkt_len, - (unsigned)ETHER_MIN_LEN); + (unsigned)RTE_ETHER_MIN_LEN); ret = -EINVAL; goto rollback; } } else { - if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN || - dev_conf->rxmode.max_rx_pkt_len > ETHER_MAX_LEN) + if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN || + dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN) /* Use default value */ dev->data->dev_conf.rxmode.max_rx_pkt_len = - ETHER_MAX_LEN; + RTE_ETHER_MAX_LEN; } /* Any requested offloading must be within its device capabilities */ @@ -2549,7 +2549,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim = lim; dev_info->tx_desc_lim = lim; dev_info->device = dev->device; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->max_mtu = UINT16_MAX; RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); @@ -3085,7 +3085,7 @@ get_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) rte_eth_dev_info_get(port_id, &dev_info); for (i = 0; i < dev_info.max_mac_addrs; i++) - if (memcmp(addr, &dev->data->mac_addrs[i], ETHER_ADDR_LEN) == 0) + if (memcmp(addr, &dev->data->mac_addrs[i], RTE_ETHER_ADDR_LEN) == 0) return i; return -1; @@ -3219,7 +3219,7 @@ get_hash_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) for (i = 0; i < dev_info.max_hash_mac_addrs; i++) if (memcmp(addr, &dev->data->hash_mac_addrs[i], - ETHER_ADDR_LEN) == 0) + RTE_ETHER_ADDR_LEN) == 0) return i; return -1; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index fd8366043..50d98ec4b 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2284,7 +2284,7 @@ void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); * }; * * device = dev->device - * min_mtu = ETHER_MIN_MTU + * min_mtu = RTE_ETHER_MIN_MTU * max_mtu = UINT16_MAX * * The following fields will be populated if support for dev_infos_get() diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 958a8e77c..75c374552 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -605,7 +605,7 @@ static const struct rte_flow_item_eth rte_flow_item_eth_mask = { * Matches an 802.1Q/ad VLAN tag. * * The corresponding standard outer EtherType (TPID) values are - * ETHER_TYPE_VLAN or ETHER_TYPE_QINQ. It can be overridden by the preceding + * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by the preceding * pattern item. */ struct rte_flow_item_vlan { @@ -769,7 +769,7 @@ static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { * Matches a E-tag header. * * The corresponding standard outer EtherType (TPID) value is - * ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. + * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. */ struct rte_flow_item_e_tag { /** @@ -2119,7 +2119,7 @@ struct rte_flow_action_set_ttl { * Set MAC address from the matched flow */ struct rte_flow_action_set_mac { - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; }; /* diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index d248f387f..11d422573 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -621,21 +621,21 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, *ipv6_hdr = NULL; switch (eth_hdr->ether_type) { - case RTE_BE16(ETHER_TYPE_IPv4): + case RTE_BE16(RTE_ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); break; - case RTE_BE16(ETHER_TYPE_IPv6): + case RTE_BE16(RTE_ETHER_TYPE_IPv6): *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); break; - case RTE_BE16(ETHER_TYPE_VLAN): + case RTE_BE16(RTE_ETHER_TYPE_VLAN): vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { - case RTE_BE16(ETHER_TYPE_IPv4): + case RTE_BE16(RTE_ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); break; - case RTE_BE16(ETHER_TYPE_IPv6): + case RTE_BE16(RTE_ETHER_TYPE_IPv6): *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1); break; default: diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index d0975eda8..5f9873634 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -253,7 +253,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool, dev_info.mbuf_size = conf->mbuf_size; dev_info.mtu = conf->mtu; - memcpy(dev_info.mac_addr, conf->mac_addr, ETHER_ADDR_LEN); + memcpy(dev_info.mac_addr, conf->mac_addr, RTE_ETHER_ADDR_LEN); strlcpy(dev_info.name, conf->name, RTE_KNI_NAMESIZE); diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 9a9a7d754..950673339 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -68,7 +68,7 @@ struct rte_kni_conf { __extension__ uint8_t force_bind : 1; /* Flag to bind kernel thread */ - char mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ + char mac_addr[RTE_ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ uint16_t mtu; }; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 2274dc65d..b9dd8dc4f 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -29,15 +29,15 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, } /* Ethernet header. */ - memset(eth_hdr->d_addr.addr_bytes, 0xff, ETHER_ADDR_LEN); + memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN); rte_ether_addr_copy(mac, ð_hdr->s_addr); - eth_hdr->ether_type = htons(ETHER_TYPE_RARP); + eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP); /* RARP header. */ rarp = (struct rte_arp_hdr *)(eth_hdr + 1); rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER); - rarp->arp_protocol = htons(ETHER_TYPE_IPv4); - rarp->arp_hlen = ETHER_ADDR_LEN; + rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPv4); + rarp->arp_hlen = RTE_ETHER_ADDR_LEN; rarp->arp_plen = 4; rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index cc31fbd9b..b8b545f37 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -23,25 +23,25 @@ extern "C" { #include #include -#define ETHER_ADDR_LEN 6 /**< Length of Ethernet address. */ -#define ETHER_TYPE_LEN 2 /**< Length of Ethernet type field. */ -#define ETHER_CRC_LEN 4 /**< Length of Ethernet CRC. */ -#define ETHER_HDR_LEN \ - (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN) /**< Length of Ethernet header. */ -#define ETHER_MIN_LEN 64 /**< Minimum frame len, including CRC. */ -#define ETHER_MAX_LEN 1518 /**< Maximum frame len, including CRC. */ -#define ETHER_MTU \ - (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) /**< Ethernet MTU. */ - -#define ETHER_MAX_VLAN_FRAME_LEN \ - (ETHER_MAX_LEN + 4) /**< Maximum VLAN frame length, including CRC. */ - -#define ETHER_MAX_JUMBO_FRAME_LEN \ +#define RTE_ETHER_ADDR_LEN 6 /**< Length of Ethernet address. */ +#define RTE_ETHER_TYPE_LEN 2 /**< Length of Ethernet type field. */ +#define RTE_ETHER_CRC_LEN 4 /**< Length of Ethernet CRC. */ +#define RTE_ETHER_HDR_LEN \ + (RTE_ETHER_ADDR_LEN * 2 + RTE_ETHER_TYPE_LEN) /**< Length of Ethernet header. */ +#define RTE_ETHER_MIN_LEN 64 /**< Minimum frame len, including CRC. */ +#define RTE_ETHER_MAX_LEN 1518 /**< Maximum frame len, including CRC. */ +#define RTE_ETHER_MTU \ + (RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN) /**< Ethernet MTU. */ + +#define RTE_ETHER_MAX_VLAN_FRAME_LEN \ + (RTE_ETHER_MAX_LEN + 4) /**< Maximum VLAN frame length, including CRC. */ + +#define RTE_ETHER_MAX_JUMBO_FRAME_LEN \ 0x3F00 /**< Maximum Jumbo frame length, including CRC. */ -#define ETHER_MAX_VLAN_ID 4095 /**< Maximum VLAN ID. */ +#define RTE_ETHER_MAX_VLAN_ID 4095 /**< Maximum VLAN ID. */ -#define ETHER_MIN_MTU 68 /**< Minimum MTU for IPv4 packets, see RFC 791. */ +#define RTE_ETHER_MIN_MTU 68 /**< Minimum MTU for IPv4 packets, see RFC 791. */ /** * Ethernet address: @@ -55,11 +55,11 @@ extern "C" { * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ struct rte_ether_addr { - uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ + uint8_t addr_bytes[RTE_ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); -#define ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ -#define ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ +#define RTE_ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ +#define RTE_ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ /** * Check if two Ethernet addresses are the same. @@ -79,7 +79,7 @@ static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, const struct rte_ether_addr *ea2) { int i; - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) if (ea1->addr_bytes[i] != ea2->addr_bytes[i]) return 0; return 1; @@ -98,7 +98,7 @@ static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) if (ea->addr_bytes[i] != 0x00) return 0; return 1; @@ -116,7 +116,7 @@ static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_unicast_ether_addr(const struct rte_ether_addr *ea) { - return (ea->addr_bytes[0] & ETHER_GROUP_ADDR) == 0; + return (ea->addr_bytes[0] & RTE_ETHER_GROUP_ADDR) == 0; } /** @@ -131,7 +131,7 @@ static inline int rte_is_unicast_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_multicast_ether_addr(const struct rte_ether_addr *ea) { - return ea->addr_bytes[0] & ETHER_GROUP_ADDR; + return ea->addr_bytes[0] & RTE_ETHER_GROUP_ADDR; } /** @@ -164,7 +164,7 @@ static inline int rte_is_broadcast_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_universal_ether_addr(const struct rte_ether_addr *ea) { - return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) == 0; + return (ea->addr_bytes[0] & RTE_ETHER_LOCAL_ADMIN_ADDR) == 0; } /** @@ -179,7 +179,7 @@ static inline int rte_is_universal_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_local_admin_ether_addr(const struct rte_ether_addr *ea) { - return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) != 0; + return (ea->addr_bytes[0] & RTE_ETHER_LOCAL_ADMIN_ADDR) != 0; } /** @@ -209,9 +209,9 @@ static inline void rte_eth_random_addr(uint8_t *addr) uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; - rte_memcpy(addr, p, ETHER_ADDR_LEN); - addr[0] &= (uint8_t)~ETHER_GROUP_ADDR; /* clear multicast bit */ - addr[0] |= ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ + rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN); + addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR; /* clear multicast bit */ + addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ } /** @@ -240,7 +240,7 @@ static inline void rte_ether_addr_copy(const struct rte_ether_addr *ea_from, #endif } -#define ETHER_ADDR_FMT_SIZE 18 +#define RTE_ETHER_ADDR_FMT_SIZE 18 /** * Format 48bits Ethernet address in pattern xx:xx:xx:xx:xx:xx. * @@ -295,23 +295,23 @@ struct rte_vxlan_hdr { } __attribute__((__packed__)); /* Ethernet frame types */ -#define ETHER_TYPE_IPv4 0x0800 /**< IPv4 Protocol. */ -#define ETHER_TYPE_IPv6 0x86DD /**< IPv6 Protocol. */ -#define ETHER_TYPE_ARP 0x0806 /**< Arp Protocol. */ -#define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */ -#define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */ -#define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */ +#define RTE_ETHER_TYPE_IPv4 0x0800 /**< IPv4 Protocol. */ +#define RTE_ETHER_TYPE_IPv6 0x86DD /**< IPv6 Protocol. */ +#define RTE_ETHER_TYPE_ARP 0x0806 /**< Arp Protocol. */ +#define RTE_ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */ +#define RTE_ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */ +#define RTE_ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */ #define ETHER_TYPE_PPPOE_DISCOVERY 0x8863 /**< PPPoE Discovery Stage. */ #define ETHER_TYPE_PPPOE_SESSION 0x8864 /**< PPPoE Session Stage. */ -#define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */ -#define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */ -#define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */ -#define ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */ -#define ETHER_TYPE_LLDP 0x88CC /**< LLDP Protocol. */ -#define ETHER_TYPE_MPLS 0x8847 /**< MPLS ethertype. */ -#define ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */ - -#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) +#define RTE_ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */ +#define RTE_ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */ +#define RTE_ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */ +#define RTE_ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */ +#define RTE_ETHER_TYPE_LLDP 0x88CC /**< LLDP Protocol. */ +#define RTE_ETHER_TYPE_MPLS 0x8847 /**< MPLS ethertype. */ +#define RTE_ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */ + +#define RTE_ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -327,15 +327,15 @@ struct rte_vxlan_gpe_hdr { } __attribute__((__packed__)); /* VXLAN-GPE next protocol types */ -#define VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */ -#define VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */ -#define VXLAN_GPE_TYPE_ETH 3 /**< Ethernet Protocol. */ -#define VXLAN_GPE_TYPE_NSH 4 /**< NSH Protocol. */ -#define VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */ -#define VXLAN_GPE_TYPE_GBP 6 /**< GBP Protocol. */ -#define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ - -#define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ +#define RTE_VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */ +#define RTE_VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */ +#define RTE_VXLAN_GPE_TYPE_ETH 3 /**< Ethernet Protocol. */ +#define RTE_VXLAN_GPE_TYPE_NSH 4 /**< NSH Protocol. */ +#define RTE_VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */ +#define RTE_VXLAN_GPE_TYPE_GBP 6 /**< GBP Protocol. */ +#define RTE_VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ + +#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ @@ -356,7 +356,7 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); struct rte_vlan_hdr *vh; - if (eh->ether_type != rte_cpu_to_be_16(ETHER_TYPE_VLAN)) + if (eh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) return -1; vh = (struct rte_vlan_hdr *)(eh + 1); @@ -365,7 +365,7 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) /* Copy ether header over rather than moving whole packet */ memmove(rte_pktmbuf_adj(m, sizeof(struct rte_vlan_hdr)), - eh, 2 * ETHER_ADDR_LEN); + eh, 2 * RTE_ETHER_ADDR_LEN); return 0; } @@ -404,8 +404,8 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) if (nh == NULL) return -ENOSPC; - memmove(nh, oh, 2 * ETHER_ADDR_LEN); - nh->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + memmove(nh, oh, 2 * RTE_ETHER_ADDR_LEN); + nh->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); vh = (struct rte_vlan_hdr *) (nh + 1); vh->vlan_tci = rte_cpu_to_be_16((*m)->vlan_tci); diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 315c37c55..5551cce17 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -155,16 +155,16 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, *off += opt_len[flags]; *proto = gh->proto; - if (*proto == rte_cpu_to_be_16(ETHER_TYPE_TEB)) + if (*proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_TEB)) return RTE_PTYPE_TUNNEL_NVGRE; else return RTE_PTYPE_TUNNEL_GRE; } case IPPROTO_IPIP: - *proto = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + *proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); return RTE_PTYPE_TUNNEL_IP; case IPPROTO_IPV6: - *proto = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + *proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); return RTE_PTYPE_TUNNEL_IP; /* IP is also valid for IPv6 */ default: return 0; @@ -249,10 +249,10 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_L2_MASK) == 0) return 0; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) goto l3; /* fast path if packet is IPv4 */ - if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -263,7 +263,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, off += sizeof(*vh); hdr_lens->l2_len += sizeof(*vh); proto = vh->eth_proto; - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -275,8 +275,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, off += 2 * sizeof(*vh); hdr_lens->l2_len += 2 * sizeof(*vh); proto = vh->eth_proto; - } else if ((proto == rte_cpu_to_be_16(ETHER_TYPE_MPLS)) || - (proto == rte_cpu_to_be_16(ETHER_TYPE_MPLSM))) { + } else if ((proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) || + (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLSM))) { unsigned int i; const struct mpls_hdr *mh; struct mpls_hdr mh_copy; @@ -299,7 +299,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_L3_MASK) == 0) return pkt_type; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { const struct ipv4_hdr *ip4h; struct ipv4_hdr ip4h_copy; @@ -322,7 +322,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } proto = ip4h->next_proto_id; pkt_type |= ptype_l4(proto); - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { const struct ipv6_hdr *ip6h; struct ipv6_hdr ip6h_copy; int frag = 0; @@ -391,7 +391,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; hdr_lens->inner_l2_len = 0; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_TEB)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_TEB)) { eh = rte_pktmbuf_read(m, off, sizeof(*eh), &eh_copy); if (unlikely(eh == NULL)) return pkt_type; @@ -401,7 +401,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l2_len = sizeof(*eh); } - if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -413,7 +413,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, off += sizeof(*vh); hdr_lens->inner_l2_len += sizeof(*vh); proto = vh->eth_proto; - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -431,7 +431,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L3_MASK) == 0) return pkt_type; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { const struct ipv4_hdr *ip4h; struct ipv4_hdr ip4h_copy; @@ -454,7 +454,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } proto = ip4h->next_proto_id; pkt_type |= ptype_inner_l4(proto); - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { const struct ipv6_hdr *ip6h; struct ipv6_hdr ip6h_copy; int frag = 0; diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index d4318ecb0..224045e8a 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -611,8 +611,8 @@ encap_ether_apply(void *data, { struct encap_ether_data *d = data; uint16_t ethertype = (common_cfg->ip_version) ? - ETHER_TYPE_IPv4 : - ETHER_TYPE_IPv6; + RTE_ETHER_TYPE_IPv4 : + RTE_ETHER_TYPE_IPv6; /* Ethernet */ rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); @@ -629,13 +629,13 @@ encap_vlan_apply(void *data, { struct encap_vlan_data *d = data; uint16_t ethertype = (common_cfg->ip_version) ? - ETHER_TYPE_IPv4 : - ETHER_TYPE_IPv6; + RTE_ETHER_TYPE_IPv4 : + RTE_ETHER_TYPE_IPv6; /* Ethernet */ rte_ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* VLAN */ d->vlan.vlan_tci = rte_htons(VLAN(p->vlan.vlan.pcp, @@ -653,19 +653,19 @@ encap_qinq_apply(void *data, { struct encap_qinq_data *d = data; uint16_t ethertype = (common_cfg->ip_version) ? - ETHER_TYPE_IPv4 : - ETHER_TYPE_IPv6; + RTE_ETHER_TYPE_IPv4 : + RTE_ETHER_TYPE_IPv6; /* Ethernet */ rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_QINQ); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_QINQ); /* SVLAN */ d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp, p->qinq.svlan.dei, p->qinq.svlan.vid)); - d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN); + d->svlan.eth_proto = rte_htons(RTE_ETHER_TYPE_VLAN); /* CVLAN */ d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp, @@ -685,13 +685,13 @@ encap_qinq_pppoe_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* SVLAN */ d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp, p->qinq.svlan.dei, p->qinq.svlan.vid)); - d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN); + d->svlan.eth_proto = rte_htons(RTE_ETHER_TYPE_VLAN); /* CVLAN */ d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp, @@ -778,13 +778,13 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* VLAN */ d->vlan.vlan_tci = rte_htons(VLAN(p->vxlan.vlan.pcp, p->vxlan.vlan.dei, p->vxlan.vlan.vid)); - d->vlan.eth_proto = rte_htons(ETHER_TYPE_IPv4); + d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPv4); /* IPv4*/ d->ipv4.version_ihl = 0x45; @@ -817,7 +817,7 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_IPv4); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPv4); /* IPv4*/ d->ipv4.version_ihl = 0x45; @@ -852,13 +852,13 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* VLAN */ d->vlan.vlan_tci = rte_htons(VLAN(p->vxlan.vlan.pcp, p->vxlan.vlan.dei, p->vxlan.vlan.vid)); - d->vlan.eth_proto = rte_htons(ETHER_TYPE_IPv6); + d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPv6); /* IPv6*/ d->ipv6.vtc_flow = rte_htonl((6 << 28) | @@ -891,7 +891,7 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_IPv6); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPv6); /* IPv6*/ d->ipv6.vtc_flow = rte_htonl((6 << 28) | diff --git a/lib/librte_port/rte_port_source_sink.c b/lib/librte_port/rte_port_source_sink.c index 54045f952..74b7385a2 100644 --- a/lib/librte_port/rte_port_source_sink.c +++ b/lib/librte_port/rte_port_source_sink.c @@ -368,7 +368,7 @@ pcap_sink_write_pkt(struct rte_port_sink *port, struct rte_mbuf *mbuf) { uint8_t *pcap_dumper = (port->dumper); struct pcap_pkthdr pcap_hdr; - uint8_t jumbo_pkt_buf[ETHER_MAX_JUMBO_FRAME_LEN]; + uint8_t jumbo_pkt_buf[RTE_ETHER_MAX_JUMBO_FRAME_LEN]; uint8_t *pkt; /* Maximum num packets already reached */ @@ -385,10 +385,10 @@ pcap_sink_write_pkt(struct rte_port_sink *port, struct rte_mbuf *mbuf) struct rte_mbuf *jumbo_mbuf; uint32_t pkt_index = 0; - /* if packet size longer than ETHER_MAX_JUMBO_FRAME_LEN, + /* if packet size longer than RTE_ETHER_MAX_JUMBO_FRAME_LEN, * ignore it. */ - if (mbuf->pkt_len > ETHER_MAX_JUMBO_FRAME_LEN) + if (mbuf->pkt_len > RTE_ETHER_MAX_JUMBO_FRAME_LEN) return; for (jumbo_mbuf = mbuf; jumbo_mbuf != NULL; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index a71cf0cf7..e8f3edc07 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -977,7 +977,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) m->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); m->l2_len += sizeof(struct rte_vlan_hdr); @@ -987,14 +987,14 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) l3_hdr = (char *)eth_hdr + m->l2_len; switch (ethertype) { - case ETHER_TYPE_IPv4: + case RTE_ETHER_TYPE_IPv4: ipv4_hdr = l3_hdr; *l4_proto = ipv4_hdr->next_proto_id; m->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV4; break; - case ETHER_TYPE_IPv6: + case RTE_ETHER_TYPE_IPv6: ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; m->l3_len = sizeof(struct ipv6_hdr); -- 2.11.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 75E8CA0096 for ; Wed, 10 Apr 2019 11:02:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E88175F32; Wed, 10 Apr 2019 11:01:45 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id D1B1A4D27 for ; Wed, 10 Apr 2019 10:32:29 +0200 (CEST) Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 9CCA6295E69; Wed, 10 Apr 2019 10:32:29 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: Ferruh Yigit Date: Wed, 10 Apr 2019 10:32:09 +0200 Message-Id: <20190410083218.17531-6-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190410083218.17531-1-olivier.matz@6wind.com> References: <20181024081833.21432-1-olivier.matz@6wind.com> <20190410083218.17531-1-olivier.matz@6wind.com> X-Mailman-Approved-At: Wed, 10 Apr 2019 11:01:32 +0200 Subject: [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190410083209.E1FlVSHgo-EhmZuRgrEWhjtGBl0TorrCYlJk5ZQmwME@z> Add 'RTE_' prefix to defines: - rename ETHER_ADDR_LEN as RTE_ETHER_ADDR_LEN. - rename ETHER_TYPE_LEN as RTE_ETHER_TYPE_LEN. - rename ETHER_CRC_LEN as RTE_ETHER_CRC_LEN. - rename ETHER_HDR_LEN as RTE_ETHER_HDR_LEN. - rename ETHER_MIN_LEN as RTE_ETHER_MIN_LEN. - rename ETHER_MAX_LEN as RTE_ETHER_MAX_LEN. - rename ETHER_MTU as RTE_ETHER_MTU. - rename ETHER_MAX_VLAN_FRAME_LEN as RTE_ETHER_MAX_VLAN_FRAME_LEN. - rename ETHER_MAX_VLAN_ID as RTE_ETHER_MAX_VLAN_ID. - rename ETHER_MAX_JUMBO_FRAME_LEN as RTE_ETHER_MAX_JUMBO_FRAME_LEN. - rename ETHER_MIN_MTU as RTE_ETHER_MIN_MTU. - rename ETHER_LOCAL_ADMIN_ADDR as RTE_ETHER_LOCAL_ADMIN_ADDR. - rename ETHER_GROUP_ADDR as RTE_ETHER_GROUP_ADDR. - rename ETHER_TYPE_IPv4 as RTE_ETHER_TYPE_IPv4. - rename ETHER_TYPE_IPv6 as RTE_ETHER_TYPE_IPv6. - rename ETHER_TYPE_ARP as RTE_ETHER_TYPE_ARP. - rename ETHER_TYPE_VLAN as RTE_ETHER_TYPE_VLAN. - rename ETHER_TYPE_RARP as RTE_ETHER_TYPE_RARP. - rename ETHER_TYPE_QINQ as RTE_ETHER_TYPE_QINQ. - rename ETHER_TYPE_ETAG as RTE_ETHER_TYPE_ETAG. - rename ETHER_TYPE_1588 as RTE_ETHER_TYPE_1588. - rename ETHER_TYPE_SLOW as RTE_ETHER_TYPE_SLOW. - rename ETHER_TYPE_TEB as RTE_ETHER_TYPE_TEB. - rename ETHER_TYPE_LLDP as RTE_ETHER_TYPE_LLDP. - rename ETHER_TYPE_MPLS as RTE_ETHER_TYPE_MPLS. - rename ETHER_TYPE_MPLSM as RTE_ETHER_TYPE_MPLSM. - rename ETHER_VXLAN_HLEN as RTE_ETHER_VXLAN_HLEN. - rename ETHER_ADDR_FMT_SIZE as RTE_ETHER_ADDR_FMT_SIZE. - rename VXLAN_GPE_TYPE_IPV4 as RTE_VXLAN_GPE_TYPE_IPV4. - rename VXLAN_GPE_TYPE_IPV6 as RTE_VXLAN_GPE_TYPE_IPV6. - rename VXLAN_GPE_TYPE_ETH as RTE_VXLAN_GPE_TYPE_ETH. - rename VXLAN_GPE_TYPE_NSH as RTE_VXLAN_GPE_TYPE_NSH. - rename VXLAN_GPE_TYPE_MPLS as RTE_VXLAN_GPE_TYPE_MPLS. - rename VXLAN_GPE_TYPE_GBP as RTE_VXLAN_GPE_TYPE_GBP. - rename VXLAN_GPE_TYPE_VBNG as RTE_VXLAN_GPE_TYPE_VBNG. - rename ETHER_VXLAN_GPE_HLEN as RTE_ETHER_VXLAN_GPE_HLEN. Do not update the command line library to avoid adding a dependency to librte_net. Signed-off-by: Olivier Matz --- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 2 +- app/test-pmd/cmdline.c | 34 +++---- app/test-pmd/cmdline_flow.c | 80 +++++++-------- app/test-pmd/config.c | 4 +- app/test-pmd/csumonly.c | 46 ++++----- app/test-pmd/flowgen.c | 2 +- app/test-pmd/icmpecho.c | 12 +-- app/test-pmd/ieee1588fwd.c | 4 +- app/test-pmd/parameters.c | 6 +- app/test-pmd/testpmd.c | 10 +- app/test-pmd/testpmd.h | 20 ++-- app/test-pmd/txonly.c | 2 +- app/test-pmd/util.c | 4 +- app/test/packet_burst_generator.c | 14 +-- app/test/test_cmdline_etheraddr.c | 2 +- app/test/test_flow_classify.c | 6 +- app/test/test_link_bonding.c | 90 ++++++++--------- app/test/test_link_bonding_mode4.c | 28 +++--- app/test/test_link_bonding_rssconf.c | 4 +- app/test/test_pmd_perf.c | 8 +- app/test/test_sched.c | 2 +- app/test/virtual_pmd.c | 2 +- doc/guides/nics/kni.rst | 2 +- doc/guides/prog_guide/rte_flow.rst | 4 +- doc/guides/sample_app_ug/flow_classify.rst | 2 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- doc/guides/sample_app_ug/skeleton.rst | 2 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- drivers/net/ark/ark_ethdev.c | 4 +- drivers/net/atlantic/atl_ethdev.c | 6 +- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/avp/rte_avp_common.h | 2 +- drivers/net/axgbe/axgbe_dev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.h | 2 +- drivers/net/axgbe/axgbe_rxtx.c | 2 +- drivers/net/bnx2x/bnx2x.c | 4 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 4 +- drivers/net/bnxt/bnxt_ethdev.c | 64 ++++++------ drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 +- drivers/net/bnxt/bnxt_flow.c | 14 +-- drivers/net/bnxt/bnxt_hwrm.c | 34 +++---- drivers/net/bnxt/bnxt_ring.c | 8 +- drivers/net/bnxt/bnxt_rxq.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 2 +- drivers/net/bnxt/bnxt_vnic.c | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 8 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 8 +- drivers/net/bonding/rte_eth_bond_pmd.c | 40 ++++---- drivers/net/cxgbe/base/adapter.h | 4 +- drivers/net/cxgbe/base/t4_hw.c | 8 +- drivers/net/cxgbe/cxgbe.h | 4 +- drivers/net/cxgbe/cxgbe_ethdev.c | 12 +-- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 6 +- drivers/net/cxgbe/cxgbe_main.c | 4 +- drivers/net/cxgbe/cxgbevf_main.c | 2 +- drivers/net/cxgbe/l2t.c | 8 +- drivers/net/cxgbe/l2t.h | 2 +- drivers/net/cxgbe/mps_tcam.c | 14 +-- drivers/net/cxgbe/mps_tcam.h | 4 +- drivers/net/cxgbe/sge.c | 8 +- drivers/net/dpaa/dpaa_ethdev.c | 14 +-- drivers/net/dpaa/dpaa_rxtx.c | 8 +- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/e1000_ethdev.h | 4 +- drivers/net/e1000/em_ethdev.c | 20 ++-- drivers/net/e1000/em_rxtx.c | 16 +-- drivers/net/e1000/igb_ethdev.c | 42 ++++---- drivers/net/e1000/igb_flow.c | 4 +- drivers/net/e1000/igb_pf.c | 10 +- drivers/net/e1000/igb_rxtx.c | 12 +-- drivers/net/ena/ena_ethdev.h | 2 +- drivers/net/enetc/base/enetc_hw.h | 4 +- drivers/net/enetc/enetc_ethdev.c | 4 +- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_ethdev.c | 8 +- drivers/net/enic/enic_flow.c | 14 +-- drivers/net/enic/enic_res.c | 4 +- drivers/net/failsafe/failsafe_args.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 4 +- drivers/net/fm10k/fm10k.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 52 +++++----- drivers/net/i40e/i40e_ethdev.h | 2 +- drivers/net/i40e/i40e_ethdev_vf.c | 22 ++--- drivers/net/i40e/i40e_fdir.c | 14 +-- drivers/net/i40e/i40e_flow.c | 26 ++--- drivers/net/i40e/i40e_pf.c | 2 +- drivers/net/i40e/i40e_rxtx.c | 22 ++--- drivers/net/i40e/rte_pmd_i40e.c | 6 +- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_ethdev.c | 20 ++-- drivers/net/iavf/iavf_rxtx.c | 8 +- drivers/net/ice/ice_ethdev.c | 24 ++--- drivers/net/ice/ice_rxtx.c | 22 ++--- drivers/net/ixgbe/ixgbe_ethdev.c | 44 ++++----- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_flow.c | 14 +-- drivers/net/ixgbe/ixgbe_pf.c | 10 +- drivers/net/ixgbe/ixgbe_rxtx.c | 6 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 6 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 20 ++-- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_ethdev.c | 4 +- drivers/net/mlx4/mlx4_flow.c | 8 +- drivers/net/mlx4/mlx4_rxtx.c | 2 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 2 +- drivers/net/mlx5/mlx5_flow_dv.c | 12 +-- drivers/net/mlx5/mlx5_flow_tcf.c | 20 ++-- drivers/net/mlx5/mlx5_flow_verbs.c | 10 +- drivers/net/mlx5/mlx5_mac.c | 4 +- drivers/net/mlx5/mlx5_nl.c | 8 +- drivers/net/mlx5/mlx5_rxtx.c | 6 +- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- drivers/net/mlx5/mlx5_trigger.c | 2 +- drivers/net/mvneta/mvneta_ethdev.c | 12 +-- drivers/net/mvneta/mvneta_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 12 +-- drivers/net/mvpp2/mrvl_ethdev.h | 2 +- drivers/net/netvsc/hn_ethdev.c | 2 +- drivers/net/netvsc/hn_nvs.c | 2 +- drivers/net/netvsc/hn_rndis.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 4 +- drivers/net/nfp/nfp_net.c | 10 +- drivers/net/nfp/nfp_net_pmd.h | 2 +- drivers/net/octeontx/octeontx_ethdev.c | 6 +- drivers/net/octeontx/octeontx_ethdev.h | 2 +- drivers/net/pcap/rte_eth_pcap.c | 18 ++-- drivers/net/qede/base/bcm_osal.h | 2 +- drivers/net/qede/base/ecore_dev.c | 4 +- drivers/net/qede/qede_ethdev.c | 18 ++-- drivers/net/qede/qede_filter.c | 22 ++--- drivers/net/qede/qede_if.h | 2 +- drivers/net/qede/qede_main.c | 6 +- drivers/net/qede/qede_rxtx.c | 6 +- drivers/net/qede/qede_rxtx.h | 2 +- drivers/net/sfc/sfc_ethdev.c | 4 +- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/softnic/parser.c | 6 +- drivers/net/tap/rte_eth_tap.c | 22 ++--- drivers/net/tap/tap_flow.c | 8 +- drivers/net/thunderx/base/nicvf_plat.h | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 12 +-- drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/virtio/virtio_ethdev.c | 46 ++++----- drivers/net/virtio/virtio_pci.h | 4 +- drivers/net/virtio/virtio_rxtx.c | 10 +- drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 2 +- drivers/net/virtio/virtio_user/virtio_user_dev.c | 6 +- drivers/net/virtio/virtio_user/virtio_user_dev.h | 2 +- drivers/net/virtio/virtio_user_ethdev.c | 8 +- drivers/net/virtio/virtqueue.h | 2 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +- drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- examples/bbdev_app/main.c | 2 +- examples/bond/main.c | 22 ++--- examples/distributor/main.c | 2 +- examples/ethtool/ethtool-app/ethapp.c | 4 +- examples/eventdev_pipeline/main.c | 2 +- examples/flow_classify/flow_classify.c | 2 +- examples/flow_filtering/main.c | 4 +- examples/ip_fragmentation/main.c | 18 ++-- examples/ip_pipeline/kni.c | 2 +- examples/ip_pipeline/parser.c | 6 +- examples/ip_reassembly/main.c | 8 +- examples/ipsec-secgw/ipsec-secgw.c | 24 ++--- examples/ipv4_multicast/main.c | 6 +- examples/kni/main.c | 6 +- examples/l2fwd-cat/l2fwd-cat.c | 2 +- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 8 +- examples/l3fwd-power/main.c | 12 +-- examples/l3fwd-vf/main.c | 6 +- examples/l3fwd/l3fwd_em.c | 4 +- examples/l3fwd/l3fwd_lpm.c | 4 +- examples/l3fwd/main.c | 10 +- examples/performance-thread/l3fwd-thread/main.c | 14 +-- examples/ptpclient/ptpclient.c | 2 +- examples/qos_meter/main.c | 2 +- examples/qos_sched/init.c | 2 +- examples/rxtx_callbacks/main.c | 2 +- examples/skeleton/basicfwd.c | 2 +- examples/tep_termination/vxlan.c | 20 ++-- examples/tep_termination/vxlan_setup.c | 6 +- examples/vhost/main.c | 6 +- examples/vm_power_manager/channel_monitor.c | 6 +- examples/vm_power_manager/main.c | 2 +- lib/librte_ethdev/rte_ethdev.c | 18 ++-- lib/librte_ethdev/rte_ethdev.h | 2 +- lib/librte_ethdev/rte_flow.h | 6 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 10 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_kni/rte_kni.h | 2 +- lib/librte_net/rte_arp.c | 8 +- lib/librte_net/rte_ether.h | 114 +++++++++++----------- lib/librte_net/rte_net.c | 30 +++--- lib/librte_pipeline/rte_table_action.c | 34 +++---- lib/librte_port/rte_port_source_sink.c | 6 +- lib/librte_vhost/virtio_net.c | 6 +- 210 files changed, 1040 insertions(+), 1040 deletions(-) diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index 8dbfd8181..01f782820 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -658,7 +658,7 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt) struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .rx_adv_conf = { diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index 1e525643d..16c49b860 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -165,7 +165,7 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt) struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .rx_adv_conf = { .rss_conf = { diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b2c2b60dd..804479821 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1832,16 +1832,16 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, uint64_t rx_offloads = port->dev_conf.rxmode.offloads; if (!strcmp(res->name, "max-pkt-len")) { - if (res->value < ETHER_MIN_LEN) { + if (res->value < RTE_ETHER_MIN_LEN) { printf("max-pkt-len can not be less than %d\n", - ETHER_MIN_LEN); + RTE_ETHER_MIN_LEN); return; } if (res->value == port->dev_conf.rxmode.max_rx_pkt_len) return; port->dev_conf.rxmode.max_rx_pkt_len = res->value; - if (res->value > ETHER_MAX_LEN) + if (res->value > RTE_ETHER_MAX_LEN) rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -1903,8 +1903,8 @@ cmd_config_mtu_parsed(void *parsed_result, { struct cmd_config_mtu_result *res = parsed_result; - if (res->value < ETHER_MIN_LEN) { - printf("mtu cannot be less than %d\n", ETHER_MIN_LEN); + if (res->value < RTE_ETHER_MIN_LEN) { + printf("mtu cannot be less than %d\n", RTE_ETHER_MIN_LEN); return; } port_mtu_set(res->port_id, res->value); @@ -8143,7 +8143,7 @@ cmd_set_vf_macvlan_parsed(void *parsed_result, memset(&filter, 0, sizeof(struct rte_eth_mac_filter)); - rte_memcpy(&filter.mac_addr, &res->address, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, &res->address, RTE_ETHER_ADDR_LEN); /* set VF MAC filter */ filter.is_vf = 1; @@ -9117,7 +9117,7 @@ cmd_set_mirror_mask_parsed(void *parsed_result, return; for (i = 0; i < nb_item; i++) { - if (vlan_list[i] > ETHER_MAX_VLAN_ID) { + if (vlan_list[i] > RTE_ETHER_MAX_VLAN_ID) { printf("Invalid vlan_id: must be < 4096\n"); return; } @@ -15208,9 +15208,9 @@ static void cmd_set_vxlan_parsed(void *parsed_result, if (vxlan_encap_conf.select_vlan) vxlan_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_vxlan = { @@ -15399,9 +15399,9 @@ static void cmd_set_nvgre_parsed(void *parsed_result, if (nvgre_encap_conf.select_vlan) nvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_nvgre = { @@ -15516,9 +15516,9 @@ static void cmd_set_l2_encap_parsed(void *parsed_result, if (l2_encap_conf.select_vlan) l2_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_l2_encap = { @@ -15708,9 +15708,9 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, if (mplsogre_encap_conf.select_vlan) mplsogre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_mplsogre_encap = { @@ -15946,9 +15946,9 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, if (mplsoudp_encap_conf.select_vlan) mplsoudp_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); rte_memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } cmdline_parse_inst_t cmd_set_mplsoudp_encap = { diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 1b7fbd02c..b1b9b26fd 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3483,9 +3483,9 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token, .item_vxlan.flags = 0, }; memcpy(action_vxlan_encap_data->item_eth.dst.addr_bytes, - vxlan_encap_conf.eth_dst, ETHER_ADDR_LEN); + vxlan_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(action_vxlan_encap_data->item_eth.src.addr_bytes, - vxlan_encap_conf.eth_src, ETHER_ADDR_LEN); + vxlan_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); if (!vxlan_encap_conf.select_ipv4) { memcpy(&action_vxlan_encap_data->item_ipv6.hdr.src_addr, &vxlan_encap_conf.ipv6_src, @@ -3606,9 +3606,9 @@ parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token, .item_nvgre.flow_id = 0, }; memcpy(action_nvgre_encap_data->item_eth.dst.addr_bytes, - nvgre_encap_conf.eth_dst, ETHER_ADDR_LEN); + nvgre_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(action_nvgre_encap_data->item_eth.src.addr_bytes, - nvgre_encap_conf.eth_src, ETHER_ADDR_LEN); + nvgre_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); if (!nvgre_encap_conf.select_ipv4) { memcpy(&action_nvgre_encap_data->item_ipv6.hdr.src_addr, &nvgre_encap_conf.ipv6_src, @@ -3670,22 +3670,22 @@ parse_vc_action_l2_encap(struct context *ctx, const struct token *token, }; header = action_encap_data->data; if (l2_encap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (l2_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - l2_encap_conf.eth_dst, ETHER_ADDR_LEN); + l2_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - l2_encap_conf.eth_src, ETHER_ADDR_LEN); + l2_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (l2_encap_conf.select_vlan) { if (l2_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -3734,7 +3734,7 @@ parse_vc_action_l2_decap(struct context *ctx, const struct token *token, }; header = action_decap_data->data; if (l2_decap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (l2_decap_conf.select_vlan) { @@ -3805,22 +3805,22 @@ parse_vc_action_mplsogre_encap(struct context *ctx, const struct token *token, }; header = action_encap_data->data; if (mplsogre_encap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsogre_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsogre_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsogre_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsogre_encap_conf.select_vlan) { if (mplsogre_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -3900,22 +3900,22 @@ parse_vc_action_mplsogre_decap(struct context *ctx, const struct token *token, }; header = action_decap_data->data; if (mplsogre_decap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsogre_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsogre_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsogre_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsogre_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsogre_encap_conf.select_vlan) { if (mplsogre_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -3996,22 +3996,22 @@ parse_vc_action_mplsoudp_encap(struct context *ctx, const struct token *token, }; header = action_encap_data->data; if (mplsoudp_encap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsoudp_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsoudp_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsoudp_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsoudp_encap_conf.select_vlan) { if (mplsoudp_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } @@ -4093,22 +4093,22 @@ parse_vc_action_mplsoudp_decap(struct context *ctx, const struct token *token, }; header = action_decap_data->data; if (mplsoudp_decap_conf.select_vlan) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else if (mplsoudp_encap_conf.select_ipv4) - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + eth.type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(eth.dst.addr_bytes, - mplsoudp_encap_conf.eth_dst, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_dst, RTE_ETHER_ADDR_LEN); memcpy(eth.src.addr_bytes, - mplsoudp_encap_conf.eth_src, ETHER_ADDR_LEN); + mplsoudp_encap_conf.eth_src, RTE_ETHER_ADDR_LEN); memcpy(header, ð, sizeof(eth)); header += sizeof(eth); if (mplsoudp_encap_conf.select_vlan) { if (mplsoudp_encap_conf.select_ipv4) - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); else - vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + vlan.inner_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); memcpy(header, &vlan, sizeof(vlan)); header += sizeof(vlan); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 01a19d8e8..0f32a28fc 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -110,8 +110,8 @@ const struct rss_type_info rss_type_table[] = { static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index e052c7eb5..7080ff5d9 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -92,9 +92,9 @@ struct simple_gre_hdr { static uint16_t get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) { - if (ethertype == _htons(ETHER_TYPE_IPv4)) + if (ethertype == _htons(RTE_ETHER_TYPE_IPv4)) return rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr); } @@ -150,7 +150,7 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; - if (info->ethertype == _htons(ETHER_TYPE_VLAN)) { + if (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN)) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); info->l2_len += sizeof(struct rte_vlan_hdr); @@ -158,11 +158,11 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) } switch (info->ethertype) { - case _htons(ETHER_TYPE_IPv4): + case _htons(RTE_ETHER_TYPE_IPv4): ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv4(ipv4_hdr, info); break; - case _htons(ETHER_TYPE_IPv6): + case _htons(RTE_ETHER_TYPE_IPv6): ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv6(ipv6_hdr, info); break; @@ -200,7 +200,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); - info->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */ + info->l2_len += RTE_ETHER_VXLAN_HLEN; /* add udp + vxlan */ } /* Parse a vxlan-gpe header */ @@ -222,7 +222,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, sizeof(struct udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == - VXLAN_GPE_TYPE_IPV4) { + RTE_VXLAN_GPE_TYPE_IPV4) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -233,10 +233,10 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, vxlan_gpe_len); parse_ipv4(ipv4_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv4); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); info->l2_len = 0; - } else if (vxlan_gpe_hdr->proto == VXLAN_GPE_TYPE_IPV6) { + } else if (vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_IPV6) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -246,11 +246,11 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, ipv6_hdr = (struct ipv6_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); - info->ethertype = _htons(ETHER_TYPE_IPv6); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); info->l2_len = 0; - } else if (vxlan_gpe_hdr->proto == VXLAN_GPE_TYPE_ETH) { + } else if (vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_ETH) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -264,7 +264,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, } else return; - info->l2_len += ETHER_VXLAN_GPE_HLEN; + info->l2_len += RTE_ETHER_VXLAN_GPE_HLEN; } /* Parse a gre header */ @@ -285,7 +285,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) if (gre_hdr->flags & _htons(GRE_CHECKSUM_PRESENT)) gre_len += GRE_EXT_LEN; - if (gre_hdr->proto == _htons(ETHER_TYPE_IPv4)) { + if (gre_hdr->proto == _htons(RTE_ETHER_TYPE_IPv4)) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -295,10 +295,10 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len); parse_ipv4(ipv4_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv4); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); info->l2_len = 0; - } else if (gre_hdr->proto == _htons(ETHER_TYPE_IPv6)) { + } else if (gre_hdr->proto == _htons(RTE_ETHER_TYPE_IPv6)) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -307,11 +307,11 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len); - info->ethertype = _htons(ETHER_TYPE_IPv6); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); info->l2_len = 0; - } else if (gre_hdr->proto == _htons(ETHER_TYPE_TEB)) { + } else if (gre_hdr->proto == _htons(RTE_ETHER_TYPE_TEB)) { info->is_tunnel = 1; info->outer_ethertype = info->ethertype; info->outer_l2_len = info->l2_len; @@ -348,10 +348,10 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) if (ip_version == 4) { parse_ipv4(ipv4_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv4); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); } else { parse_ipv6(ipv6_hdr, info); - info->ethertype = _htons(ETHER_TYPE_IPv6); + info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); } info->l2_len = 0; } @@ -383,7 +383,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, tso_segsz = info->tunnel_tso_segsz; } - if (info->ethertype == _htons(ETHER_TYPE_IPv4)) { + if (info->ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = l3_hdr; ipv4_hdr->hdr_checksum = 0; @@ -397,7 +397,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } - } else if (info->ethertype == _htons(ETHER_TYPE_IPv6)) + } else if (info->ethertype == _htons(RTE_ETHER_TYPE_IPv6)) ol_flags |= PKT_TX_IPV6; else return 0; /* packet type not supported, nothing to do */ @@ -458,7 +458,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, struct udp_hdr *udp_hdr; uint64_t ol_flags = 0; - if (info->outer_ethertype == _htons(ETHER_TYPE_IPv4)) { + if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_OUTER_IPV4; @@ -494,7 +494,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; - if (info->outer_ethertype == _htons(ETHER_TYPE_IPv4)) + if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) udp_hdr->dgram_cksum = rte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr); else diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 69a3b5050..00acbaf70 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -173,7 +173,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); rte_ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); rte_ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); /* Initialize IP header. */ ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 879f6283d..e778de438 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -223,9 +223,9 @@ ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf) static void ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, ea); if (what) printf("%s", what); printf("%s", buf); @@ -330,7 +330,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_dump(" ETH: src=", ð_h->s_addr); ether_addr_dump(" dst=", ð_h->d_addr); } - if (eth_type == ETHER_TYPE_VLAN) { + if (eth_type == RTE_ETHER_TYPE_VLAN) { vlan_h = (struct rte_vlan_hdr *) ((char *)eth_h + sizeof(struct rte_ether_hdr)); l2_len += sizeof(struct rte_vlan_hdr); @@ -346,7 +346,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } /* Reply to ARP requests */ - if (eth_type == ETHER_TYPE_ARP) { + if (eth_type == RTE_ETHER_TYPE_ARP) { arp_h = (struct rte_arp_hdr *) ((char *)eth_h + l2_len); arp_opcode = RTE_BE_TO_CPU_16(arp_h->arp_opcode); arp_protocol = RTE_BE_TO_CPU_16(arp_h->arp_protocol); @@ -360,7 +360,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) } if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != RTE_ARP_HRD_ETHER) || - (arp_protocol != ETHER_TYPE_IPv4) || + (arp_protocol != RTE_ETHER_TYPE_IPv4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) ) { @@ -409,7 +409,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } - if (eth_type != ETHER_TYPE_IPv4) { + if (eth_type != RTE_ETHER_TYPE_IPv4) { rte_pktmbuf_free(pkt); continue; } diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index 2b7003be4..e3b98e3e0 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -115,7 +115,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) { - if (eth_type == ETHER_TYPE_1588) { + if (eth_type == RTE_ETHER_TYPE_1588) { printf("Port %u Received PTP packet not filtered" " by hardware\n", fs->rx_port); @@ -128,7 +128,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) rte_pktmbuf_free(mb); return; } - if (eth_type != ETHER_TYPE_1588) { + if (eth_type != RTE_ETHER_TYPE_1588) { printf("Port %u Received NON PTP packet incorrectly" " detected by hardware\n", fs->rx_port); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 7b6b60905..813abb2b0 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -823,15 +823,15 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) { n = atoi(optarg); - if (n >= ETHER_MIN_LEN) { + if (n >= RTE_ETHER_MIN_LEN) { rx_mode.max_rx_pkt_len = (uint32_t) n; - if (n > ETHER_MAX_LEN) + if (n > RTE_ETHER_MAX_LEN) rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; } else rte_exit(EXIT_FAILURE, "Invalid max-pkt-len=%d - should be > %d\n", - n, ETHER_MIN_LEN); + n, RTE_ETHER_MIN_LEN); } if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) { if (!strcmp(optarg, "signature")) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 831221c99..b18e2685f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -410,7 +410,7 @@ lcoreid_t latencystats_lcore_id = -1; * Ethernet device configuration. */ struct rte_eth_rxmode rx_mode = { - .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, /**< Default maximum frame length. */ }; struct rte_eth_txmode tx_mode = { @@ -523,7 +523,7 @@ static void dev_event_callback(const char *device_name, static int all_ports_started(void); struct gso_status gso_ports[RTE_MAX_ETHPORTS]; -uint16_t gso_max_segment_size = ETHER_MAX_LEN - ETHER_CRC_LEN; +uint16_t gso_max_segment_size = RTE_ETHER_MAX_LEN - RTE_ETHER_CRC_LEN; /* * Helper function to check if socket is already discovered. @@ -579,7 +579,7 @@ set_def_peer_eth_addrs(void) portid_t i; for (i = 0; i < RTE_MAX_ETHPORTS; i++) { - peer_eth_addrs[i].addr_bytes[0] = ETHER_LOCAL_ADMIN_ADDR; + peer_eth_addrs[i].addr_bytes[0] = RTE_ETHER_LOCAL_ADMIN_ADDR; peer_eth_addrs[i].addr_bytes[5] = i; } } @@ -1158,8 +1158,8 @@ init_config(void) fwd_lcores[lc_id]->gso_ctx.direct_pool = mbp; fwd_lcores[lc_id]->gso_ctx.indirect_pool = mbp; fwd_lcores[lc_id]->gso_ctx.gso_types = gso_types; - fwd_lcores[lc_id]->gso_ctx.gso_size = ETHER_MAX_LEN - - ETHER_CRC_LEN; + fwd_lcores[lc_id]->gso_ctx.gso_size = RTE_ETHER_MAX_LEN - + RTE_ETHER_CRC_LEN; fwd_lcores[lc_id]->gso_ctx.flag = 0; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2f1780216..82ed59a30 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -493,8 +493,8 @@ struct vxlan_encap_conf { rte_be16_t vlan_tci; uint8_t ip_tos; uint8_t ip_ttl; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct vxlan_encap_conf vxlan_encap_conf; @@ -508,8 +508,8 @@ struct nvgre_encap_conf { uint8_t ipv6_src[16]; uint8_t ipv6_dst[16]; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct nvgre_encap_conf nvgre_encap_conf; @@ -518,8 +518,8 @@ struct l2_encap_conf { uint32_t select_ipv4:1; uint32_t select_vlan:1; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct l2_encap_conf l2_encap_conf; @@ -539,8 +539,8 @@ struct mplsogre_encap_conf { uint8_t ipv6_src[16]; uint8_t ipv6_dst[16]; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct mplsogre_encap_conf mplsogre_encap_conf; @@ -563,8 +563,8 @@ struct mplsoudp_encap_conf { uint8_t ipv6_src[16]; uint8_t ipv6_dst[16]; rte_be16_t vlan_tci; - uint8_t eth_src[ETHER_ADDR_LEN]; - uint8_t eth_dst[ETHER_ADDR_LEN]; + uint8_t eth_src[RTE_ETHER_ADDR_LEN]; + uint8_t eth_dst[RTE_ETHER_ADDR_LEN]; }; struct mplsoudp_encap_conf mplsoudp_encap_conf; diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 3e3ead9fb..d5a46e8fc 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -266,7 +266,7 @@ pkt_burst_transmit(struct fwd_stream *fs) */ rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); - eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, nb_pkt_per_burst) == 0) { diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 55f3844dd..105c56090 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -16,8 +16,8 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", what, buf); } diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 2ef5d15a5..feee9e121 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -64,7 +64,7 @@ initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_ struct rte_vlan_hdr *vhdr = (struct rte_vlan_hdr *)((uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr)); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); vhdr->eth_proto = rte_cpu_to_be_16(ether_type); vhdr->vlan_tci = van_id; @@ -79,8 +79,8 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma uint32_t opcode) { arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); - arp_hdr->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hlen = ETHER_ADDR_LEN; + arp_hdr->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); + arp_hdr->arp_hlen = RTE_ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); rte_ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); @@ -318,10 +318,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, pkt->l2_len = eth_hdr_size; if (ipv4) { - pkt->vlan_tci = ETHER_TYPE_IPv4; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; pkt->l3_len = sizeof(struct ipv4_hdr); } else { - pkt->vlan_tci = ETHER_TYPE_IPv6; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; pkt->l3_len = sizeof(struct ipv6_hdr); } @@ -433,10 +433,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, pkt->l2_len = eth_hdr_size; if (ipv4) { - pkt->vlan_tci = ETHER_TYPE_IPv4; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; pkt->l3_len = sizeof(struct ipv4_hdr); } else { - pkt->vlan_tci = ETHER_TYPE_IPv6; + pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; pkt->l3_len = sizeof(struct ipv6_hdr); } diff --git a/app/test/test_cmdline_etheraddr.c b/app/test/test_cmdline_etheraddr.c index 90943c2b4..9a32fd7ec 100644 --- a/app/test/test_cmdline_etheraddr.c +++ b/app/test/test_cmdline_etheraddr.c @@ -85,7 +85,7 @@ static int is_addr_different(const struct rte_ether_addr addr, uint64_t num) { int i; - for (i = 0; i < ETHER_ADDR_LEN; i++, num >>= 8) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++, num >>= 8) if (addr.addr_bytes[i] != (num & 0xFF)) { return 1; } diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index f81bbba3a..3f06f3005 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -504,7 +504,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, printf("Set up IPv4 UDP traffic\n"); initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); @@ -541,7 +541,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, printf("Set up IPv4 TCP traffic\n"); initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); @@ -578,7 +578,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, printf("Set up IPv4 SCTP traffic\n"); initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 00ddb0efe..2490d5dd2 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -136,7 +136,7 @@ static struct rte_eth_conf default_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, .split_hdr_size = 0, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, @@ -236,7 +236,7 @@ test_setup(void) for (i = 0; i < TEST_MAX_NUMBER_OF_PORTS; i++) { char pmd_name[RTE_ETH_NAME_MAX_LEN]; - mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; + mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; snprintf(pmd_name, RTE_ETH_NAME_MAX_LEN, "eth_virt_%d", i); @@ -395,7 +395,7 @@ test_remove_slave_from_bonded_device(void) mac_addr = (struct rte_ether_addr *)slave_mac; - mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = + mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = test_params->bonded_slave_count-1; rte_eth_macaddr_get( @@ -751,7 +751,7 @@ test_set_primary_slave(void) test_params->bonded_port_id); expected_mac_addr = (struct rte_ether_addr *)&slave_mac; - expected_mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; + expected_mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; /* Check primary slave MAC */ rte_eth_macaddr_get(test_params->slave_port_ids[i], &read_mac_addr); @@ -897,7 +897,7 @@ test_set_bonded_port_initialization_mac_assignment(void) for (i = 0; i < BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT; i++) { char pmd_name[RTE_ETH_NAME_MAX_LEN]; - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = i + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = i + 100; snprintf(pmd_name, RTE_ETH_NAME_MAX_LEN, "eth_slave_%d", i); @@ -933,8 +933,8 @@ test_set_bonded_port_initialization_mac_assignment(void) /* * 3. Set explicit MAC address on bonded ethdev */ - bonded_mac_addr.addr_bytes[ETHER_ADDR_LEN-2] = 0xFF; - bonded_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 0xAA; + bonded_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-2] = 0xFF; + bonded_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0xAA; TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( bonded_port_id, &bonded_mac_addr), @@ -965,13 +965,13 @@ test_set_bonded_port_initialization_mac_assignment(void) sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 1 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 1 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 2 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), @@ -996,13 +996,13 @@ test_set_bonded_port_initialization_mac_assignment(void) sizeof(read_mac_addr)), "bonded port mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 0 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 1 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), @@ -1033,19 +1033,19 @@ test_set_bonded_port_initialization_mac_assignment(void) "Number of slaves (%d) is great than expected (%d).", slave_count, 0); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 0 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 0 + 100; rte_eth_macaddr_get(slave_port_ids[0], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 0 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 1 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 1 + 100; rte_eth_macaddr_get(slave_port_ids[1], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), "slave port 1 mac address not as expected"); - slave_mac_addr.addr_bytes[ETHER_ADDR_LEN-1] = 2 + 100; + slave_mac_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = 2 + 100; rte_eth_macaddr_get(slave_port_ids[2], &read_mac_addr); TEST_ASSERT_SUCCESS(memcmp(&slave_mac_addr, &read_mac_addr, sizeof(read_mac_addr)), @@ -1262,9 +1262,9 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, void *ip_hdr; if (ipv4) - ether_type = ETHER_TYPE_IPv4; + ether_type = RTE_ETHER_TYPE_IPv4; else - ether_type = ETHER_TYPE_IPv6; + ether_type = RTE_ETHER_TYPE_IPv6; if (toggle_dst_mac) initialize_eth_header(test_params->pkt_eth_hdr, @@ -1939,7 +1939,7 @@ test_roundrobin_verfiy_polling_slave_link_status_change(void) for (i = 0; i < TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT; i++) { /* Generate slave name / MAC address */ snprintf(slave_name, RTE_ETH_NAME_MAX_LEN, "eth_virt_poll_%d", i); - mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; + mac_addr->addr_bytes[RTE_ETHER_ADDR_LEN-1] = i; /* Create slave devices with no ISR Support */ if (polling_test_slaves[i] == -1) { @@ -2031,7 +2031,7 @@ test_activebackup_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, src_addr, @@ -2565,7 +2565,7 @@ test_balance_l2_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); pktlen = initialize_ipv4_header(test_params->pkt_ipv4_hdr, src_addr, @@ -2580,7 +2580,7 @@ test_balance_l2_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); /* Generate a burst 2 of packets to transmit */ TEST_ASSERT_EQUAL(generate_packet_burst(test_params->mbuf_pool, &pkts_burst[1][0], @@ -3403,7 +3403,7 @@ test_broadcast_tx_burst(void) initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, - ETHER_TYPE_IPv4, 0, 0); + RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -3986,11 +3986,11 @@ test_tlb_tx_burst(void) if (i % 2 == 0) { initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac_0, RTE_ETHER_TYPE_IPv4, 0, 0); } else { initialize_eth_header(test_params->pkt_eth_hdr, (struct rte_ether_addr *)test_params->default_slave_mac, - (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac_0, RTE_ETHER_TYPE_IPv4, 0, 0); } pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -4491,9 +4491,9 @@ test_alb_change_mac_in_reply_sent(void) * them through the bonding port. */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client1, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, @@ -4501,9 +4501,9 @@ test_alb_change_mac_in_reply_sent(void) rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client2, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, @@ -4511,9 +4511,9 @@ test_alb_change_mac_in_reply_sent(void) rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client3, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, @@ -4521,9 +4521,9 @@ test_alb_change_mac_in_reply_sent(void) rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client4, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, @@ -4604,9 +4604,9 @@ test_alb_reply_from_client(void) * them in the rx queue to be received by the bonding driver on rx_burst. */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client1, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, @@ -4615,9 +4615,9 @@ test_alb_reply_from_client(void) 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client2, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, @@ -4626,9 +4626,9 @@ test_alb_reply_from_client(void) 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client3, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, @@ -4637,9 +4637,9 @@ test_alb_reply_from_client(void) 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client4, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, @@ -4730,16 +4730,16 @@ test_alb_receive_vlan_reply(void) * Generating packet with double VLAN header and placing it in the rx queue. */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); - memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); + memcpy(client_mac.addr_bytes, mac_client1, RTE_ETHER_ADDR_LEN); eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_VLAN, 0, + initialize_eth_header(eth_pkt, &bond_mac, &client_mac, RTE_ETHER_TYPE_VLAN, 0, 0); vlan_pkt = (struct rte_vlan_hdr *)((char *)(eth_pkt + 1)); vlan_pkt->vlan_tci = rte_cpu_to_be_16(1); - vlan_pkt->eth_proto = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + vlan_pkt->eth_proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); vlan_pkt = vlan_pkt+1; vlan_pkt->vlan_tci = rte_cpu_to_be_16(2); - vlan_pkt->eth_proto = rte_cpu_to_be_16(ETHER_TYPE_ARP); + vlan_pkt->eth_proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, RTE_ARP_OP_REPLY); @@ -4764,7 +4764,7 @@ test_alb_receive_vlan_reply(void) retval = -1; goto test_end; } - if (vlan_pkt->eth_proto != rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { + if (vlan_pkt->eth_proto != rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { retval = -1; goto test_end; } @@ -4773,7 +4773,7 @@ test_alb_receive_vlan_reply(void) retval = -1; goto test_end; } - if (vlan_pkt->eth_proto != rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (vlan_pkt->eth_proto != rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { retval = -1; goto test_end; } diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index f5ac6c99f..6295b1874 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -108,7 +108,7 @@ static struct link_bonding_unittest_params test_params = { static struct rte_eth_conf default_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -233,7 +233,7 @@ add_slave(struct slave_conf *slave, uint8_t start) RTE_VERIFY(slave->port_id != INVALID_PORT_ID); rte_ether_addr_copy(&slave_mac_default, &addr); - addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; rte_eth_dev_mac_addr_remove(slave->port_id, &addr); @@ -299,7 +299,7 @@ lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) RTE_VERIFY(lacp_pkt != NULL); hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *); - RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW)); + RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW)); slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *); RTE_VERIFY(slow_hdr->slow_protocol.subtype == SLOW_SUBTYPE_LACP); @@ -480,7 +480,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) /* look for LACP */ hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW)) + if (hdr->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW)) return 1; slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *); @@ -492,7 +492,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) /* Change source address to partner address */ rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr); - slow_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + slow_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; lacp = (struct lacpdu *) &slow_hdr->slow_protocol; /* Save last received state */ @@ -926,11 +926,11 @@ test_mode4_rx(void) FOR_EACH_SLAVE(i, slave) { void *pkt = NULL; - dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1); TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst."); - src_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; + src_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = slave->port_id; retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1); TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst."); @@ -990,7 +990,7 @@ test_mode4_tx_burst(void) /* Prepare burst */ for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) { - dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt; + dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = pkts_cnt; retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]); if (retval != 1) @@ -1063,7 +1063,7 @@ test_mode4_tx_burst(void) /* Prepare burst. */ for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) { - dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt; + dst_mac.addr_bytes[RTE_ETHER_ADDR_LEN - 1] = pkts_cnt; retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]); if (retval != 1) @@ -1134,9 +1134,9 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) /* Init source address */ rte_ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr); - marker_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN-1] = slave->port_id; + marker_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN-1] = slave->port_id; - marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); + marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW); marker_hdr->marker.subtype = SLOW_SUBTYPE_MARKER; marker_hdr->marker.version_number = 1; @@ -1162,7 +1162,7 @@ test_mode4_marker(void) int retval; uint16_t nb_pkts; uint8_t i, j; - const uint16_t ethtype_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); + const uint16_t ethtype_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); retval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT, 0); @@ -1362,7 +1362,7 @@ test_mode4_ext_ctrl(void) rte_ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac, - ETHER_TYPE_SLOW, 0, 0); + RTE_ETHER_TYPE_SLOW, 0, 0); for (i = 0; i < SLAVE_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); @@ -1416,7 +1416,7 @@ test_mode4_ext_lacp(void) rte_ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac, - ETHER_TYPE_SLOW, 0, 0); + RTE_ETHER_TYPE_SLOW, 0, 0); for (i = 0; i < SLAVE_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index 4392522ea..65de3b98d 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -81,7 +81,7 @@ static struct link_bonding_rssconf_unittest_params test_params = { static struct rte_eth_conf default_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -93,7 +93,7 @@ static struct rte_eth_conf default_pmd_conf = { static struct rte_eth_conf rss_pmd_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index a0c3eb956..4b973ffc4 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -63,7 +63,7 @@ static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -173,8 +173,8 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -192,7 +192,7 @@ init_traffic(struct rte_mempool *mp, initialize_eth_header(&pkt_eth_hdr, (struct rte_ether_addr *)src_mac, - (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)dst_mac, RTE_ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, IPV4_ADDR(10, 0, 0, 1), diff --git a/app/test/test_sched.c b/app/test/test_sched.c index c4554aa74..58f42a2d8 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -91,7 +91,7 @@ prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip_hdr->dst_addr = IPv4(0,0,TC,QUEUE); diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 15ce64445..55c2bdb98 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -566,7 +566,7 @@ virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, eth_dev->data->dev_link.link_speed = ETH_SPEED_NUM_10G; eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; - eth_dev->data->mac_addrs = rte_zmalloc(name, ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc(name, RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) goto err; diff --git a/doc/guides/nics/kni.rst b/doc/guides/nics/kni.rst index a66c59531..7b482a5d4 100644 --- a/doc/guides/nics/kni.rst +++ b/doc/guides/nics/kni.rst @@ -56,7 +56,7 @@ configuration: Interface name: kni# force bind kernel thread to a core : NO mbuf size: (rte_pktmbuf_data_room_size(pktmbuf_pool) - RTE_PKTMBUF_HEADROOM) - mtu: (conf.mbuf_size - ETHER_HDR_LEN) + mtu: (conf.mbuf_size - RTE_ETHER_HDR_LEN) KNI control path is not supported with the PMD, since there is no physical backend device by default. diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 0203f4f61..19334d95f 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -863,7 +863,7 @@ Item: ``VLAN`` Matches an 802.1Q/ad VLAN tag. The corresponding standard outer EtherType (TPID) values are -``ETHER_TYPE_VLAN`` or ``ETHER_TYPE_QINQ``. It can be overridden by the +``RTE_ETHER_TYPE_VLAN`` or ``RTE_ETHER_TYPE_QINQ``. It can be overridden by the preceding pattern item. - ``tci``: tag control information. @@ -940,7 +940,7 @@ Item: ``E_TAG`` Matches an IEEE 802.1BR E-Tag header. The corresponding standard outer EtherType (TPID) value is -``ETHER_TYPE_ETAG``. It can be overridden by the preceding pattern item. +``RTE_ETHER_TYPE_ETAG``. It can be overridden by the preceding pattern item. - ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b), E-DEI (1b), ingress E-CID base (12b). diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 9582b9376..762c3844e 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -326,7 +326,7 @@ The Ethernet ports are configured with default settings using the .. code-block:: c static const struct rte_eth_conf port_conf_default = { - .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } + .rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN } }; For this example the ports are set up with 1 RX and 1 TX queue using the diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 0b44ab90b..a4cb4377f 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -229,7 +229,7 @@ The actual packet transmission is done in the mcast_send_pkt() function: rte_ether_addr_copy(dest_addr, ðdr->d_addr); rte_ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr); - ethdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + ethdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); /* Put new packet into the output queue */ diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst index 715f5e91a..59ca511d3 100644 --- a/doc/guides/sample_app_ug/skeleton.rst +++ b/doc/guides/sample_app_ug/skeleton.rst @@ -160,7 +160,7 @@ The Ethernet ports are configured with default settings using the .. code-block:: c static const struct rte_eth_conf port_conf_default = { - .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } + .rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN } }; For this example the ports are set up with 1 RX and 1 TX queue using the diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 8fa9b8cae..2556b0fb4 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -315,7 +315,7 @@ fman_if_init(const struct device_node *dpa_node) mname); goto err; } - memcpy(&__if->__if.mac_addr, mac_addr, ETHER_ADDR_LEN); + memcpy(&__if->__if.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); /* Extract the Tx port (it's the second of the two port handles) * and get its channel ID diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 9ab8e835d..a4c27786b 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -153,7 +153,7 @@ fman_if_add_mac_addr(struct fman_if *p, uint8_t *eth, uint8_t addr_num) void *reg; u32 val; - memcpy(&m->__if.mac_addr, eth, ETHER_ADDR_LEN); + memcpy(&m->__if.mac_addr, eth, RTE_ETHER_ADDR_LEN); if (addr_num) reg = &((struct memac_regs *)m->ccsr_map)-> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 4bd0392ef..1ffc9e5e1 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -796,7 +796,7 @@ get_iface_info(const char *if_name, if (ioctl(sock, SIOCGIFHWADDR, &ifr)) goto error; - rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(sock); return 0; diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index b2b1fd78a..15d813f61 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -318,7 +318,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) dev->dev_ops = &ark_eth_dev_ops; - dev->data->mac_addrs = rte_zmalloc("ark", ETHER_ADDR_LEN, 0); + dev->data->mac_addrs = rte_zmalloc("ark", RTE_ETHER_ADDR_LEN, 0); if (!dev->data->mac_addrs) { PMD_DRV_LOG(ERR, "Failed to allocated memory for storing mac address" @@ -385,7 +385,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev) rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->mac_addrs = rte_zmalloc(name, ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc(name, RTE_ETHER_ADDR_LEN, 0); if (!eth_dev->data->mac_addrs) { PMD_DRV_LOG(ERR, "Memory allocation for MAC failed!" diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index f1df8e7fa..13f8cd10d 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -366,7 +366,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) atl_disable_intr(hw); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("atlantic", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("atlantic", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "MAC Malloc failed"); return -ENOMEM; @@ -1264,11 +1264,11 @@ static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct rte_eth_dev_info dev_info; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; atl_dev_info_get(dev, &dev_info); - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; /* update max frame size */ diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 38e5eae05..e144c64ac 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -88,7 +88,7 @@ static void avp_dev_stats_reset(struct rte_eth_dev *dev); #define AVP_MAX_RX_BURST 64 #define AVP_MAX_TX_BURST 64 #define AVP_MAX_MAC_ADDRS 1 -#define AVP_MIN_RX_BUFSIZE ETHER_MIN_LEN +#define AVP_MIN_RX_BUFSIZE RTE_ETHER_MIN_LEN /* @@ -867,7 +867,7 @@ avp_dev_create(struct rte_pci_device *pci_dev, avp->host_features = host_info->features; rte_spinlock_init(&avp->lock); memcpy(&avp->ethaddr.addr_bytes[0], - host_info->ethaddr, ETHER_ADDR_LEN); + host_info->ethaddr, RTE_ETHER_ADDR_LEN); /* adjust max values to not exceed our max */ avp->max_tx_queues = RTE_MIN(host_info->max_tx_queues, RTE_AVP_MAX_QUEUES); @@ -1006,10 +1006,10 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("avp_ethdev", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("avp_ethdev", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_DRV_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses\n", - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); return -ENOMEM; } diff --git a/drivers/net/avp/rte_avp_common.h b/drivers/net/avp/rte_avp_common.h index aa95159c4..478c01a16 100644 --- a/drivers/net/avp/rte_avp_common.h +++ b/drivers/net/avp/rte_avp_common.h @@ -345,7 +345,7 @@ struct rte_avp_device_info { /* Ethernet info */ char ethaddr[ETH_ALEN]; #else - char ethaddr[ETHER_ADDR_LEN]; + char ethaddr[RTE_ETHER_ADDR_LEN]; #endif uint8_t mode; /**< device mode, i.e guest, host, trace */ diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c index 707f1ee9d..b1f0bbc8e 100644 --- a/drivers/net/axgbe/axgbe_dev.c +++ b/drivers/net/axgbe/axgbe_dev.c @@ -10,8 +10,8 @@ static inline unsigned int axgbe_get_max_frame(struct axgbe_port *pdata) { - return pdata->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_HLEN; + return pdata->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_HLEN; } /* query busy bit */ diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 237b75c5d..221979c5e 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -626,11 +626,11 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) pdata->mac_addr.addr_bytes[5] = (mac_hi >> 8) & 0xff; eth_dev->data->mac_addrs = rte_zmalloc("axgbe_mac_addr", - ETHER_ADDR_LEN, 0); + RTE_ETHER_ADDR_LEN, 0); if (!eth_dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to alloc %u bytes needed to store MAC addr tbl", - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); return -ENOMEM; } diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index 810ac4a74..e3cfaf36f 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -15,7 +15,7 @@ #define AXGBE_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1)) #define AXGBE_RX_MAX_BUF_SIZE (0x3fff & ~(64 - 1)) -#define AXGBE_RX_MIN_BUF_SIZE (ETHER_MAX_LEN + VLAN_HLEN) +#define AXGBE_RX_MIN_BUF_SIZE (RTE_ETHER_MAX_LEN + VLAN_HLEN) #define AXGBE_MAX_MAC_ADDRS 1 #define AXGBE_RX_BUF_ALIGN 64 diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index b5a29a95f..e76601d14 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -75,7 +75,7 @@ int axgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, rxq->dma_tail_reg = (volatile uint32_t *)((uint8_t *)rxq->dma_regs + DMA_CH_RDTR_LO); if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index d83d3e686..c09cb93aa 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -9745,13 +9745,13 @@ int bnx2x_attach(struct bnx2x_softc *sc) bnx2x_get_phy_info(sc); } else { /* Left mac of VF unfilled, PF should set it for VF */ - memset(sc->link_params.mac_addr, 0, ETHER_ADDR_LEN); + memset(sc->link_params.mac_addr, 0, RTE_ETHER_ADDR_LEN); } sc->wol = 0; /* set the default MTU (changed via ifconfig) */ - sc->mtu = ETHER_MTU; + sc->mtu = RTE_ETHER_MTU; bnx2x_set_modes_bitmap(sc); diff --git a/drivers/net/bnx2x/ecore_sp.h b/drivers/net/bnx2x/ecore_sp.h index f295bf5af..a73116151 100644 --- a/drivers/net/bnx2x/ecore_sp.h +++ b/drivers/net/bnx2x/ecore_sp.h @@ -38,7 +38,7 @@ typedef rte_iova_t ecore_dma_addr_t; /* expected to be 64 bit wide */ typedef volatile int ecore_atomic_t; -#define ETH_ALEN ETHER_ADDR_LEN /* 6 */ +#define ETH_ALEN RTE_ETHER_ADDR_LEN /* 6 */ #define ECORE_SWCID_SHIFT 17 #define ECORE_SWCID_MASK ((0x1 << ECORE_SWCID_SHIFT) - 1) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 5535c376e..caacc7258 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -309,7 +309,7 @@ struct bnxt { struct bnxt_irq *irq_tbl; #define MAX_NUM_MAC_ADDR 32 - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; uint16_t hwrm_cmd_seq; uint16_t kong_cmd_seq; @@ -326,7 +326,7 @@ struct bnxt { uint8_t tx_cosq_id; uint16_t fw_fid; - uint8_t dflt_mac_addr[ETHER_ADDR_LEN]; + uint8_t dflt_mac_addr[RTE_ETHER_ADDR_LEN]; uint16_t max_rsscos_ctx; uint16_t max_cp_rings; uint16_t max_tx_rings; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 0cad7a144..cf1f9beb7 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -214,7 +214,7 @@ static int bnxt_init_chip(struct bnxt *bp) /* disable uio/vfio intr/eventfd mapping */ rte_intr_disable(intr_handle); - if (bp->eth_dev->data->mtu > ETHER_MTU) { + if (bp->eth_dev->data->mtu > RTE_ETHER_MTU) { bp->eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; bp->flags |= BNXT_FLAG_JUMBO; @@ -462,7 +462,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, /* Fast path specifics */ dev_info->min_rx_bufsize = 1; - dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN + dev_info->max_rx_pktlen = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT; @@ -596,7 +596,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { eth_dev->data->mtu = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE * + RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN - VLAN_TAG_SIZE * BNXT_NUM_VLANS; bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu); } @@ -750,7 +750,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, bnxt_filter_info, next); bnxt_hwrm_clear_l2_filter(bp, filter); filter->mac_index = INVALID_MAC_INDEX; - memset(&filter->l2_addr, 0, ETHER_ADDR_LEN); + memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next); } @@ -791,7 +791,7 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, } STAILQ_INSERT_TAIL(&vnic->filter, filter, next); filter->mac_index = index; - memcpy(filter->l2_addr, mac_addr, ETHER_ADDR_LEN); + memcpy(filter->l2_addr, mac_addr, RTE_ETHER_ADDR_LEN); return bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); } @@ -1312,7 +1312,7 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id) new_filter->mac_index = filter->mac_index; memcpy(new_filter->l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); /* MAC only filter */ rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, @@ -1381,7 +1381,7 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) /* Inherit MAC from the previous filter */ new_filter->mac_index = filter->mac_index; memcpy(new_filter->l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); /* MAC + VLAN ID filter */ new_filter->l2_ivlan = vlan_id; new_filter->l2_ivlan_mask = 0xF000; @@ -1471,8 +1471,8 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct rte_ether_addr *add rc = bnxt_hwrm_clear_l2_filter(bp, filter); if (rc) return rc; - memcpy(filter->l2_addr, bp->mac_addr, ETHER_ADDR_LEN); - memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN); + memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | @@ -1507,8 +1507,8 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev, /* TODO Check for Duplicate mcast addresses */ vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI; for (i = 0; i < nb_mc_addr; i++) { - memcpy(vnic->mc_list + off, &mc_addr_list[i], ETHER_ADDR_LEN); - off += ETHER_ADDR_LEN; + memcpy(vnic->mc_list + off, &mc_addr_list[i], RTE_ETHER_ADDR_LEN); + off += RTE_ETHER_ADDR_LEN; } vnic->mc_addr_cnt = i; @@ -1581,13 +1581,13 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) bnxt_dev_info_get_op(eth_dev, &dev_info); - if (new_mtu < ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) { + if (new_mtu < RTE_ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) { PMD_DRV_LOG(ERR, "MTU requested must be within (%d, %d)\n", - ETHER_MIN_MTU, BNXT_MAX_MTU); + RTE_ETHER_MIN_MTU, BNXT_MAX_MTU); return -EINVAL; } - if (new_mtu > ETHER_MTU) { + if (new_mtu > RTE_ETHER_MTU) { bp->flags |= BNXT_FLAG_JUMBO; bp->eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -1598,7 +1598,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) } eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = - new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; + new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; eth_dev->data->mtu = new_mtu; PMD_DRV_LOG(INFO, "New MTU is %d\n", eth_dev->data->mtu); @@ -1607,8 +1607,8 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) struct bnxt_vnic_info *vnic = &bp->vnic_info[i]; uint16_t size = 0; - vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; + vnic->mru = bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * 2; rc = bnxt_hwrm_vnic_cfg(bp, vnic); if (rc) break; @@ -1793,8 +1793,8 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, int match = 0; *ret = 0; - if (efilter->ether_type == ETHER_TYPE_IPv4 || - efilter->ether_type == ETHER_TYPE_IPv6) { + if (efilter->ether_type == RTE_ETHER_TYPE_IPv4 || + efilter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "invalid ether_type(0x%04x) in" " ethertype filter.", efilter->ether_type); *ret = -EINVAL; @@ -1817,7 +1817,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, if (efilter->flags & RTE_ETHTYPE_FLAGS_DROP) { STAILQ_FOREACH(mfilter, &vnic0->filter, next) { if ((!memcmp(efilter->mac_addr.addr_bytes, - mfilter->l2_addr, ETHER_ADDR_LEN) && + mfilter->l2_addr, RTE_ETHER_ADDR_LEN) && mfilter->flags == HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DROP && mfilter->ethertype == efilter->ether_type)) { @@ -1828,7 +1828,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, } else { STAILQ_FOREACH(mfilter, &vnic->filter, next) if ((!memcmp(efilter->mac_addr.addr_bytes, - mfilter->l2_addr, ETHER_ADDR_LEN) && + mfilter->l2_addr, RTE_ETHER_ADDR_LEN) && mfilter->ethertype == efilter->ether_type && mfilter->flags == HWRM_CFA_L2_FILTER_CFG_INPUT_FLAGS_PATH_RX)) { @@ -1883,9 +1883,9 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev, } bfilter->filter_type = HWRM_CFA_NTUPLE_FILTER; memcpy(bfilter->l2_addr, efilter->mac_addr.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(bfilter->dst_macaddr, efilter->mac_addr.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_DST_MACADDR; bfilter->ethertype = efilter->ether_type; bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE; @@ -2396,7 +2396,7 @@ bnxt_parse_fdir_filter(struct bnxt *bp, //filter1 = bnxt_get_l2_filter(bp, filter, vnic0); } else { filter->dst_id = vnic->fw_vnic_id; - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) if (filter->dst_macaddr[i] == 0x00) filter1 = STAILQ_FIRST(&vnic0->filter); else @@ -2440,13 +2440,13 @@ bnxt_match_fdir(struct bnxt *bp, struct bnxt_filter_info *nf, mf->l2_ovlan_mask == nf->l2_ovlan_mask && mf->l2_ivlan == nf->l2_ivlan && mf->l2_ivlan_mask == nf->l2_ivlan_mask && - !memcmp(mf->l2_addr, nf->l2_addr, ETHER_ADDR_LEN) && + !memcmp(mf->l2_addr, nf->l2_addr, RTE_ETHER_ADDR_LEN) && !memcmp(mf->l2_addr_mask, nf->l2_addr_mask, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_macaddr, nf->src_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->dst_macaddr, nf->dst_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_ipaddr, nf->src_ipaddr, sizeof(nf->src_ipaddr)) && !memcmp(mf->src_ipaddr_mask, nf->src_ipaddr_mask, @@ -3353,16 +3353,16 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) goto error_free; } eth_dev->data->mac_addrs = rte_zmalloc("bnxt_mac_addr_tbl", - ETHER_ADDR_LEN * bp->max_l2_ctx, 0); + RTE_ETHER_ADDR_LEN * bp->max_l2_ctx, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_DRV_LOG(ERR, "Failed to alloc %u bytes needed to store MAC addr tbl", - ETHER_ADDR_LEN * bp->max_l2_ctx); + RTE_ETHER_ADDR_LEN * bp->max_l2_ctx); rc = -ENOMEM; goto error_free; } - if (bnxt_check_zero_bytes(bp->dflt_mac_addr, ETHER_ADDR_LEN)) { + if (bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN)) { PMD_DRV_LOG(ERR, "Invalid MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n", bp->dflt_mac_addr[0], bp->dflt_mac_addr[1], @@ -3373,7 +3373,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC from the qcap response address now. */ memcpy(bp->mac_addr, bp->dflt_mac_addr, sizeof(bp->mac_addr)); - memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN); + memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, RTE_ETHER_ADDR_LEN); if (bp->max_ring_grps < bp->rx_cp_nr_rings) { /* 1 ring is for default completion ring */ diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index f43fe0db0..0aed29fb0 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -39,8 +39,8 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp) filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; memcpy(filter->l2_addr, bp->eth_dev->data->mac_addrs->addr_bytes, - ETHER_ADDR_LEN); - memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); + memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); return filter; } diff --git a/drivers/net/bnxt/bnxt_filter.h b/drivers/net/bnxt/bnxt_filter.h index a1ecfb19d..f8bad29de 100644 --- a/drivers/net/bnxt/bnxt_filter.h +++ b/drivers/net/bnxt/bnxt_filter.h @@ -25,14 +25,14 @@ struct bnxt_filter_info { /* Filter Characteristics */ uint32_t flags; uint32_t enables; - uint8_t l2_addr[ETHER_ADDR_LEN]; - uint8_t l2_addr_mask[ETHER_ADDR_LEN]; + uint8_t l2_addr[RTE_ETHER_ADDR_LEN]; + uint8_t l2_addr_mask[RTE_ETHER_ADDR_LEN]; uint16_t l2_ovlan; uint16_t l2_ovlan_mask; uint16_t l2_ivlan; uint16_t l2_ivlan_mask; - uint8_t t_l2_addr[ETHER_ADDR_LEN]; - uint8_t t_l2_addr_mask[ETHER_ADDR_LEN]; + uint8_t t_l2_addr[RTE_ETHER_ADDR_LEN]; + uint8_t t_l2_addr_mask[RTE_ETHER_ADDR_LEN]; uint16_t t_l2_ovlan; uint16_t t_l2_ovlan_mask; uint16_t t_l2_ivlan; diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index a1f527d4f..947bf79c3 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -682,7 +682,7 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, f0 = STAILQ_FIRST(&vnic0->filter); /* This flow has same DST MAC as the port/l2 filter. */ - if (memcmp(f0->l2_addr, nf->dst_macaddr, ETHER_ADDR_LEN) == 0) + if (memcmp(f0->l2_addr, nf->dst_macaddr, RTE_ETHER_ADDR_LEN) == 0) return f0; /* This flow needs DST MAC which is not same as port/l2 */ @@ -694,8 +694,8 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, filter1->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter1->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | L2_FILTER_ALLOC_INPUT_EN_L2_ADDR_MASK; - memcpy(filter1->l2_addr, nf->dst_macaddr, ETHER_ADDR_LEN); - memset(filter1->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + memcpy(filter1->l2_addr, nf->dst_macaddr, RTE_ETHER_ADDR_LEN); + memset(filter1->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter1); if (rc) { @@ -951,13 +951,13 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf) mf->l2_ovlan_mask == nf->l2_ovlan_mask && mf->l2_ivlan == nf->l2_ivlan && mf->l2_ivlan_mask == nf->l2_ivlan_mask && - !memcmp(mf->l2_addr, nf->l2_addr, ETHER_ADDR_LEN) && + !memcmp(mf->l2_addr, nf->l2_addr, RTE_ETHER_ADDR_LEN) && !memcmp(mf->l2_addr_mask, nf->l2_addr_mask, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_macaddr, nf->src_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->dst_macaddr, nf->dst_macaddr, - ETHER_ADDR_LEN) && + RTE_ETHER_ADDR_LEN) && !memcmp(mf->src_ipaddr, nf->src_ipaddr, sizeof(nf->src_ipaddr)) && !memcmp(mf->src_ipaddr_mask, nf->src_ipaddr_mask, diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index e2fe4f7a0..279424072 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -393,11 +393,11 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp, if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR) memcpy(req.l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK) memcpy(req.l2_addr_mask, filter->l2_addr_mask, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN) req.l2_ovlan = filter->l2_ovlan; @@ -571,7 +571,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) } bp->fw_fid = rte_le_to_cpu_32(resp->fid); - memcpy(bp->dflt_mac_addr, &resp->mac_address, ETHER_ADDR_LEN); + memcpy(bp->dflt_mac_addr, &resp->mac_address, RTE_ETHER_ADDR_LEN); bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->max_rsscos_ctx); bp->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings); bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings); @@ -1329,8 +1329,8 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic) vnic->rss_rule = (uint16_t)HWRM_NA_SIGNATURE; vnic->cos_rule = (uint16_t)HWRM_NA_SIGNATURE; vnic->lb_rule = (uint16_t)HWRM_NA_SIGNATURE; - vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE; + vnic->mru = bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; HWRM_PREP(req, VNIC_ALLOC, BNXT_USE_CHIMP_MB); if (vnic->func_default) @@ -2516,8 +2516,8 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings) HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS); req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags); req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU); - req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx); req.num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx); @@ -2554,11 +2554,11 @@ static void populate_vf_func_cfg_req(struct bnxt *bp, HWRM_FUNC_CFG_INPUT_ENABLES_NUM_VNICS | HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS); - req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); - req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN + - ETHER_CRC_LEN + VLAN_TAG_SIZE * + req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS); req->num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx / (num_vfs + 1)); @@ -2589,7 +2589,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, rte_eth_random_addr(cfg_req->dflt_mac_addr); bp->pf.vf_info[vf].random_mac = true; } else { - memcpy(cfg_req->dflt_mac_addr, mac.addr_bytes, ETHER_ADDR_LEN); + memcpy(cfg_req->dflt_mac_addr, mac.addr_bytes, RTE_ETHER_ADDR_LEN); } } @@ -3125,7 +3125,7 @@ int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, HWRM_CHECK_RESULT(); - memcpy(mac->addr_bytes, resp->mac_address, ETHER_ADDR_LEN); + memcpy(mac->addr_bytes, resp->mac_address, RTE_ETHER_ADDR_LEN); HWRM_UNLOCK(); @@ -3696,11 +3696,11 @@ int bnxt_hwrm_set_em_filter(struct bnxt *bp, if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_SRC_MACADDR) memcpy(req.src_macaddr, filter->src_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_DST_MACADDR) memcpy(req.dst_macaddr, filter->dst_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_OVLAN_VID) req.ovlan_vid = filter->l2_ovlan; @@ -3799,11 +3799,11 @@ int bnxt_hwrm_set_ntuple_filter(struct bnxt *bp, if (enables & HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR) memcpy(req.src_macaddr, filter->src_macaddr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); //if (enables & //HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_MACADDR) //memcpy(req.dst_macaddr, filter->dst_macaddr, - //ETHER_ADDR_LEN); + //RTE_ETHER_ADDR_LEN); if (enables & HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_ETHERTYPE) req.ethertype = rte_cpu_to_be_16(filter->ethertype); diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index fcbd6bc6e..51fe35f3e 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -344,8 +344,8 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id; B_RX_DB(rxr->ag_doorbell, rxr->ag_prod); - rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN + - ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); + rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); if (bp->eth_dev->data->rx_queue_state[queue_index] == RTE_ETH_QUEUE_STATE_STARTED) { @@ -452,8 +452,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) bp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id; B_RX_DB(rxr->ag_doorbell, rxr->ag_prod); - rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN + - ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); + rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); if (bnxt_init_one_rx_ring(rxq)) { PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n"); bnxt_rx_queue_release_op(rxq); diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 17e2909a7..f1ee9eede 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -334,7 +334,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, rxq->queue_id = queue_idx; rxq->port_id = eth_dev->data->port_id; if (rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index dc695e177..089fbc7fb 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -640,7 +640,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) struct bnxt_rx_ring_info *rxr; struct bnxt_ring *ring; - rxq->rx_buf_use_size = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN + + rxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE); rxq->rx_buf_size = rxq->rx_buf_use_size + sizeof(struct rte_mbuf); diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index aebfb1f1c..2cf5f0b5b 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -116,7 +116,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) uint32_t entry_length = RTE_CACHE_LINE_ROUNDUP( HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table) + HW_HASH_KEY_SIZE + - BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN); + BNXT_MAX_MC_ADDRS * RTE_ETHER_ADDR_LEN); uint16_t max_vnics; int i; rte_iova_t mz_phys_addr; diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index 5e3d1bfb1..f07789670 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -698,7 +698,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, filter->enables == (HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK) && - memcmp(addr, filter->l2_addr, ETHER_ADDR_LEN) == 0) { + memcmp(addr, filter->l2_addr, RTE_ETHER_ADDR_LEN) == 0) { bnxt_hwrm_clear_l2_filter(bp, filter); break; } @@ -711,12 +711,12 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, filter->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; - memcpy(filter->l2_addr, addr, ETHER_ADDR_LEN); - memset(filter->l2_addr_mask, 0xff, ETHER_ADDR_LEN); + memcpy(filter->l2_addr, addr, RTE_ETHER_ADDR_LEN); + memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); /* Do not add a filter for the default MAC */ if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf_id, &dflt_mac) || - memcmp(filter->l2_addr, dflt_mac.addr_bytes, ETHER_ADDR_LEN)) + memcmp(filter->l2_addr, dflt_mac.addr_bytes, RTE_ETHER_ADDR_LEN)) rc = bnxt_hwrm_set_l2_filter(bp, vnic.fw_vnic_id, filter); exit: diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 7a775cd0c..fd61b0bd3 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -577,7 +577,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) /* Source and destination MAC */ rte_ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.d_addr); rte_eth_macaddr_get(slave_id, &hdr->eth_hdr.s_addr); - hdr->eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); + hdr->eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_SLOW); lacpdu = &hdr->lacpdu; memset(lacpdu, 0, sizeof(*lacpdu)); diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 5b7c3296e..4be742c91 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -205,9 +205,9 @@ bond_mode_alb_arp_upd(struct client_data *client_info, rte_ether_addr_copy(&client_info->app_mac, ð_h->s_addr); rte_ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); if (client_info->vlan_count > 0) - eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + eth_h->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); else - eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); + eth_h->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct rte_ether_hdr) + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); @@ -221,8 +221,8 @@ bond_mode_alb_arp_upd(struct client_data *client_info, arp_h->arp_data.arp_tip = client_info->cli_ip; arp_h->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); - arp_h->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_h->arp_hlen = ETHER_ADDR_LEN; + arp_h->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); + arp_h->arp_hlen = RTE_ETHER_ADDR_LEN; arp_h->arp_plen = sizeof(uint32_t); arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index fc905776c..58c23a970 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -37,14 +37,14 @@ get_vlan_offset(struct rte_ether_hdr *eth_hdr, uint16_t *proto) { size_t vlan_offset = 0; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto || - rte_cpu_to_be_16(ETHER_TYPE_QINQ) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto || + rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ) == *proto) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; vlan_offset += sizeof(struct rte_vlan_hdr); @@ -107,7 +107,7 @@ bond_ethdev_rx_burst_active_backup(void *queue, struct rte_mbuf **bufs, static inline uint8_t is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf) { - const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); + const uint16_t ether_type_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); return !((mbuf->ol_flags & PKT_RX_VLAN) ? mbuf->vlan_tci : 0) && (ethertype == ether_type_slow_be && @@ -121,7 +121,7 @@ is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf) static struct rte_flow_item_eth flow_item_eth_type_8023ad = { .dst.addr_bytes = { 0 }, .src.addr_bytes = { 0 }, - .type = RTE_BE16(ETHER_TYPE_SLOW), + .type = RTE_BE16(RTE_ETHER_TYPE_SLOW), }; static struct rte_flow_item_eth flow_item_eth_mask_type_8023ad = { @@ -397,7 +397,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, struct rte_ether_addr *bond_mac = bonded_eth_dev->data->mac_addrs; struct rte_ether_hdr *hdr; - const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); + const uint16_t ether_type_slow_be = rte_be_to_cpu_16(RTE_ETHER_TYPE_SLOW); uint16_t num_rx_total = 0; /* Total number of received packets */ uint16_t slaves[RTE_MAX_ETHPORTS]; uint16_t slave_count, idx; @@ -603,7 +603,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ strlcpy(buf, info, 16); #endif - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String); #ifdef RTE_LIBRTE_BOND_DEBUG_ALB @@ -613,7 +613,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ update_client_stats(ipv4_h->src_addr, port, burstnumber); } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { arp_h = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String); ipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String); @@ -642,14 +642,14 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) mode6_debug("RX ARP:", eth_h, bufs[i]->port, &burstnumberRX); #endif bond_mode_alb_arp_recv(eth_h, offset, internals); } #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) mode6_debug("RX IPv4:", eth_h, bufs[i]->port, &burstnumberRX); #endif } @@ -807,12 +807,12 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, vlan_offset = get_vlan_offset(eth_hdr, &proto); - if (rte_cpu_to_be_16(ETHER_TYPE_IPv4) == proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv4_hash(ipv4_hdr); - } else if (rte_cpu_to_be_16(ETHER_TYPE_IPv6) == proto) { + } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); @@ -846,7 +846,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l3hash = 0; l4hash = 0; - if (rte_cpu_to_be_16(ETHER_TYPE_IPv4) == proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); size_t ip_hdr_offset; @@ -873,7 +873,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = HASH_L4_PORTS(udp_hdr); } } - } else if (rte_cpu_to_be_16(ETHER_TYPE_IPv6) == proto) { + } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); @@ -1097,7 +1097,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { slave_idx = bond_mode_alb_arp_xmit(eth_h, offset, internals); /* Change src mac in eth header */ @@ -2236,7 +2236,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_pktlen = internals->candidate_max_rx_pktlen ? internals->candidate_max_rx_pktlen : - ETHER_MAX_JUMBO_FRAME_LEN; + RTE_ETHER_MAX_JUMBO_FRAME_LEN; /* Max number of tx/rx queues that the bonded device can support is the * minimum values of the bonded slaves, as all slaves must be capable @@ -3066,12 +3066,12 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) eth_dev->data->nb_tx_queues = (uint16_t)1; /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc_socket(name, RTE_ETHER_ADDR_LEN * BOND_MAX_MAC_ADDRS, 0, socket_id); if (eth_dev->data->mac_addrs == NULL) { RTE_BOND_LOG(ERR, "Failed to allocate %u bytes needed to store MAC addresses", - ETHER_ADDR_LEN * BOND_MAX_MAC_ADDRS); + RTE_ETHER_ADDR_LEN * BOND_MAX_MAC_ADDRS); goto err; } @@ -3130,7 +3130,7 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) } vlan_filter_bmp_size = - rte_bitmap_get_memory_footprint(ETHER_MAX_VLAN_ID + 1); + rte_bitmap_get_memory_footprint(RTE_ETHER_MAX_VLAN_ID + 1); internals->vlan_filter_bmpmem = rte_malloc(name, vlan_filter_bmp_size, RTE_CACHE_LINE_SIZE); if (internals->vlan_filter_bmpmem == NULL) { @@ -3140,7 +3140,7 @@ bond_alloc(struct rte_vdev_device *dev, uint8_t mode) goto err; } - internals->vlan_filter_bmp = rte_bitmap_init(ETHER_MAX_VLAN_ID + 1, + internals->vlan_filter_bmp = rte_bitmap_init(RTE_ETHER_MAX_VLAN_ID + 1, internals->vlan_filter_bmpmem, vlan_filter_bmp_size); if (internals->vlan_filter_bmp == NULL) { RTE_BOND_LOG(ERR, diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 122166410..66966a60d 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -204,8 +204,8 @@ struct eth_coalesce { unsigned int len; unsigned int flits; unsigned int max; - __u8 ethmacdst[ETHER_ADDR_LEN]; - __u8 ethmacsrc[ETHER_ADDR_LEN]; + __u8 ethmacdst[RTE_ETHER_ADDR_LEN]; + __u8 ethmacsrc[RTE_ETHER_ADDR_LEN]; __be16 ethtype; __be16 vlantci; }; diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c index 71ad1cb0f..608dd4f4c 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -4204,8 +4204,8 @@ int t4_alloc_raw_mac_filt(struct adapter *adap, unsigned int viid, V_DATAPORTNUM(M_DATAPORTNUM)); /* Copy the address and the mask */ - memcpy((u8 *)&p->data1[0] + 2, addr, ETHER_ADDR_LEN); - memcpy((u8 *)&p->data1m[0] + 2, mask, ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1[0] + 2, addr, RTE_ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1m[0] + 2, mask, RTE_ETHER_ADDR_LEN); ret = t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); if (ret == 0) { @@ -4261,8 +4261,8 @@ int t4_free_raw_mac_filt(struct adapter *adap, unsigned int viid, V_DATAPORTNUM(M_DATAPORTNUM)); /* Copy the address and the mask */ - memcpy((u8 *)&p->data1[0] + 2, addr, ETHER_ADDR_LEN); - memcpy((u8 *)&p->data1m[0] + 2, mask, ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1[0] + 2, addr, RTE_ETHER_ADDR_LEN); + memcpy((u8 *)&p->data1m[0] + 2, mask, RTE_ETHER_ADDR_LEN); return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, sleep_ok); } diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h index 5a7490f91..5d5baace4 100644 --- a/drivers/net/cxgbe/cxgbe.h +++ b/drivers/net/cxgbe/cxgbe.h @@ -15,8 +15,8 @@ #define CXGBE_DEFAULT_TX_DESC_SIZE 1024 /* Default TX ring size */ #define CXGBE_DEFAULT_RX_DESC_SIZE 1024 /* Default RX ring size */ -#define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU /* min buf size */ -#define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */ +#define CXGBE_MIN_RX_BUFSIZE RTE_ETHER_MIN_MTU /* min buf size */ +#define CXGBE_MAX_RX_PKTLEN (9000 + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN) /* max pkt */ /* Max poll time is 100 * 100msec = 10 sec */ #define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */ diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index bdda51894..ae30b92f8 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -276,16 +276,16 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) struct adapter *adapter = pi->adapter; struct rte_eth_dev_info dev_info; int err; - uint16_t new_mtu = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint16_t new_mtu = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; cxgbe_dev_info_get(eth_dev, &dev_info); - /* Must accommodate at least ETHER_MIN_MTU */ - if ((new_mtu < ETHER_MIN_MTU) || (new_mtu > dev_info.max_rx_pktlen)) + /* Must accommodate at least RTE_ETHER_MIN_MTU */ + if ((new_mtu < RTE_ETHER_MIN_MTU) || (new_mtu > dev_info.max_rx_pktlen)) return -EINVAL; /* set to jumbo mode if needed */ - if (new_mtu > ETHER_MAX_LEN) + if (new_mtu > RTE_ETHER_MAX_LEN) eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -586,7 +586,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, cxgbe_dev_info_get(eth_dev, &dev_info); - /* Must accommodate at least ETHER_MIN_MTU */ + /* Must accommodate at least RTE_ETHER_MIN_MTU */ if ((pkt_len < dev_info.min_rx_bufsize) || (pkt_len > dev_info.max_rx_pktlen)) { dev_err(adap, "%s: max pkt len must be > %d and <= %d\n", @@ -625,7 +625,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, rxq->fl.size = temp_nb_desc; /* Set to jumbo mode if necessary */ - if (pkt_len > ETHER_MAX_LEN) + if (pkt_len > RTE_ETHER_MAX_LEN) eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else diff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h index 6f6e25c63..0c67d2d15 100644 --- a/drivers/net/cxgbe/cxgbe_filter.h +++ b/drivers/net/cxgbe/cxgbe_filter.h @@ -102,7 +102,7 @@ struct ch_filter_specification { uint32_t eport:2; /* egress port to switch packet out */ uint32_t swapmac:1; /* swap SMAC/DMAC for loopback packet */ uint32_t newvlan:2; /* rewrite VLAN Tag */ - uint8_t dmac[ETHER_ADDR_LEN]; /* new destination MAC address */ + uint8_t dmac[RTE_ETHER_ADDR_LEN]; /* new destination MAC address */ uint16_t vlan; /* VLAN Tag to insert */ /* diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index a7b053b4a..4f23468b8 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -233,7 +233,7 @@ ch_rte_parsetype_ipv4(const void *dmask, const struct rte_flow_item *item, item, "ttl/tos are not supported"); fs->type = FILTER_TYPE_IPV4; - CXGBE_FILL_FS(ETHER_TYPE_IPv4, 0xffff, ethtype); + CXGBE_FILL_FS(RTE_ETHER_TYPE_IPv4, 0xffff, ethtype); if (!val) return 0; /* ipv4 wild card */ @@ -262,7 +262,7 @@ ch_rte_parsetype_ipv6(const void *dmask, const struct rte_flow_item *item, "tc/flow/hop are not supported"); fs->type = FILTER_TYPE_IPV6; - CXGBE_FILL_FS(ETHER_TYPE_IPv6, 0xffff, ethtype); + CXGBE_FILL_FS(RTE_ETHER_TYPE_IPv6, 0xffff, ethtype); if (!val) return 0; /* ipv6 wild card */ @@ -448,7 +448,7 @@ ch_rte_parse_atype_switch(const struct rte_flow_action *a, case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: pushvlan = (const struct rte_flow_action_of_push_vlan *) a->conf; - if (pushvlan->ethertype != ETHER_TYPE_VLAN) + if (pushvlan->ethertype != RTE_ETHER_TYPE_VLAN) return rte_flow_error_set(e, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, a, "only ethertype 0x8100 " diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index fd0707b95..57212a89c 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -1348,7 +1348,7 @@ int link_start(struct port_info *pi) int ret; mtu = pi->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - - (ETHER_HDR_LEN + ETHER_CRC_LEN); + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN); conf_offloads = pi->eth_dev->data->dev_conf.rxmode.offloads; @@ -1841,7 +1841,7 @@ int cxgbe_probe(struct adapter *adapter) rte_eth_copy_pci_info(pi->eth_dev, adapter->pdev); pi->eth_dev->data->mac_addrs = rte_zmalloc(name, - ETHER_ADDR_LEN, 0); + RTE_ETHER_ADDR_LEN, 0); if (!pi->eth_dev->data->mac_addrs) { dev_err(adapter, "%s: Mem allocation failed for storing mac addr, aborting\n", __func__); diff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c index f440b4345..46432c26c 100644 --- a/drivers/net/cxgbe/cxgbevf_main.c +++ b/drivers/net/cxgbe/cxgbevf_main.c @@ -245,7 +245,7 @@ int cxgbevf_probe(struct adapter *adapter) rte_eth_copy_pci_info(pi->eth_dev, adapter->pdev); pi->eth_dev->data->mac_addrs = rte_zmalloc(name, - ETHER_ADDR_LEN, 0); + RTE_ETHER_ADDR_LEN, 0); if (!pi->eth_dev->data->mac_addrs) { dev_err(adapter, "%s: Mem allocation failed for storing mac addr, aborting\n", __func__); diff --git a/drivers/net/cxgbe/l2t.c b/drivers/net/cxgbe/l2t.c index 27cdf6f33..6faf624f7 100644 --- a/drivers/net/cxgbe/l2t.c +++ b/drivers/net/cxgbe/l2t.c @@ -81,10 +81,10 @@ static int write_l2e(struct rte_eth_dev *dev, struct l2t_entry *e, int sync, V_L2T_W_NOREPLY(!sync)); req->l2t_idx = cpu_to_be16(l2t_idx); req->vlan = cpu_to_be16(e->vlan); - rte_memcpy(req->dst_mac, e->dmac, ETHER_ADDR_LEN); + rte_memcpy(req->dst_mac, e->dmac, RTE_ETHER_ADDR_LEN); if (loopback) - memset(req->dst_mac, 0, ETHER_ADDR_LEN); + memset(req->dst_mac, 0, RTE_ETHER_ADDR_LEN); t4_mgmt_tx(ctrlq, mbuf); @@ -116,7 +116,7 @@ static struct l2t_entry *find_or_alloc_l2e(struct l2t_data *d, u16 vlan, first_free = e; } else { if (e->state == L2T_STATE_SWITCHING) { - if ((!memcmp(e->dmac, dmac, ETHER_ADDR_LEN)) && + if ((!memcmp(e->dmac, dmac, RTE_ETHER_ADDR_LEN)) && e->vlan == vlan && e->lport == port) goto exists; } @@ -154,7 +154,7 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev, e->state = L2T_STATE_SWITCHING; e->vlan = vlan; e->lport = port; - rte_memcpy(e->dmac, eth_addr, ETHER_ADDR_LEN); + rte_memcpy(e->dmac, eth_addr, RTE_ETHER_ADDR_LEN); rte_atomic32_set(&e->refcnt, 1); ret = write_l2e(dev, e, 0, !L2T_LPBK, !L2T_ARPMISS); if (ret < 0) diff --git a/drivers/net/cxgbe/l2t.h b/drivers/net/cxgbe/l2t.h index ee40dc1f6..326abfde4 100644 --- a/drivers/net/cxgbe/l2t.h +++ b/drivers/net/cxgbe/l2t.h @@ -28,7 +28,7 @@ struct l2t_entry { u16 idx; /* entry index within in-memory table */ u16 vlan; /* VLAN TCI (id: bits 0-11, prio: 13-15 */ u8 lport; /* destination port */ - u8 dmac[ETHER_ADDR_LEN]; /* destination MAC address */ + u8 dmac[RTE_ETHER_ADDR_LEN]; /* destination MAC address */ rte_spinlock_t lock; /* entry lock */ rte_atomic32_t refcnt; /* entry reference count */ }; diff --git a/drivers/net/cxgbe/mps_tcam.c b/drivers/net/cxgbe/mps_tcam.c index 71c8070b3..5302d1343 100644 --- a/drivers/net/cxgbe/mps_tcam.c +++ b/drivers/net/cxgbe/mps_tcam.c @@ -8,8 +8,8 @@ static inline bool match_entry(struct mps_tcam_entry *entry, const u8 *eth_addr, const u8 *mask) { - if (!memcmp(eth_addr, entry->eth_addr, ETHER_ADDR_LEN) && - !memcmp(mask, entry->mask, ETHER_ADDR_LEN)) + if (!memcmp(eth_addr, entry->eth_addr, RTE_ETHER_ADDR_LEN) && + !memcmp(mask, entry->mask, RTE_ETHER_ADDR_LEN)) return true; return false; } @@ -95,8 +95,8 @@ int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *eth_addr, /* Fill in the new values */ entry = &mpstcam->entry[ret]; - memcpy(entry->eth_addr, eth_addr, ETHER_ADDR_LEN); - memcpy(entry->mask, mask, ETHER_ADDR_LEN); + memcpy(entry->eth_addr, eth_addr, RTE_ETHER_ADDR_LEN); + memcpy(entry->mask, mask, RTE_ETHER_ADDR_LEN); rte_atomic32_set(&entry->refcnt, 1); entry->state = MPS_ENTRY_USED; @@ -139,7 +139,7 @@ int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr) /* idx can now be different from what user provided */ entry = &mpstcam->entry[idx]; - memcpy(entry->eth_addr, addr, ETHER_ADDR_LEN); + memcpy(entry->eth_addr, addr, RTE_ETHER_ADDR_LEN); /* NOTE: we have considered the case that idx returned by t4_change_mac * will be different from the user provided value only if user * provided value is -1 @@ -161,8 +161,8 @@ int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr) */ static inline void reset_mpstcam_entry(struct mps_tcam_entry *entry) { - memset(entry->eth_addr, 0, ETHER_ADDR_LEN); - memset(entry->mask, 0, ETHER_ADDR_LEN); + memset(entry->eth_addr, 0, RTE_ETHER_ADDR_LEN); + memset(entry->mask, 0, RTE_ETHER_ADDR_LEN); rte_atomic32_clear(&entry->refcnt); entry->state = MPS_ENTRY_UNUSED; } diff --git a/drivers/net/cxgbe/mps_tcam.h b/drivers/net/cxgbe/mps_tcam.h index f86bac7bd..3d1e8d3db 100644 --- a/drivers/net/cxgbe/mps_tcam.h +++ b/drivers/net/cxgbe/mps_tcam.h @@ -24,8 +24,8 @@ struct mps_tcam_entry { u16 idx; /* add data here which uniquely defines an entry */ - u8 eth_addr[ETHER_ADDR_LEN]; - u8 mask[ETHER_ADDR_LEN]; + u8 eth_addr[RTE_ETHER_ADDR_LEN]; + u8 mask[RTE_ETHER_ADDR_LEN]; struct mpstcam_table *mpstcam; /* backptr */ rte_atomic32_t refcnt; diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 3a0eba5df..4f02f0647 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -73,7 +73,7 @@ static inline unsigned int fl_mtu_bufsize(struct adapter *adapter, { struct sge *s = &adapter->sge; - return CXGBE_ALIGN(s->pktshift + ETHER_HDR_LEN + VLAN_HLEN + mtu, + return CXGBE_ALIGN(s->pktshift + RTE_ETHER_HDR_LEN + VLAN_HLEN + mtu, s->fl_align); } @@ -1128,7 +1128,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, * The chip min packet length is 10 octets but play safe and reject * anything shorter than an Ethernet header. */ - if (unlikely(m->pkt_len < ETHER_HDR_LEN)) { + if (unlikely(m->pkt_len < RTE_ETHER_HDR_LEN)) { out_free: rte_pktmbuf_free(m); return 0; @@ -1145,7 +1145,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, /* align the end of coalesce WR to a 512 byte boundary */ txq->q.coalesce.max = (8 - (txq->q.pidx & 7)) * 8; - if (!((m->ol_flags & PKT_TX_TCP_SEG) || (m->pkt_len > ETHER_MAX_LEN))) { + if (!((m->ol_flags & PKT_TX_TCP_SEG) || (m->pkt_len > RTE_ETHER_MAX_LEN))) { if (should_tx_packet_coalesce(txq, mbuf, &cflits, adap)) { if (unlikely(map_mbuf(mbuf, addr) < 0)) { dev_warn(adap, "%s: mapping err for coalesce\n", @@ -1230,7 +1230,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, v6 = (m->ol_flags & PKT_TX_IPV6) != 0; l3hdr_len = m->l3_len; l4hdr_len = m->l4_len; - eth_xtra_len = m->l2_len - ETHER_HDR_LEN; + eth_xtra_len = m->l2_len - RTE_ETHER_HDR_LEN; len += sizeof(*lso); wr->op_immdlen = htonl(V_FW_WR_OP(is_pf4(adap) ? FW_ETH_TX_PKT_WR : diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 6716dd0cf..2cc163eaf 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -146,13 +146,13 @@ static int dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct dpaa_if *dpaa_intf = dev->data->dev_private; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; uint32_t buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM; PMD_INIT_FUNC_TRACE(); - if (mtu < ETHER_MIN_MTU || frame_size > DPAA_MAX_RX_PKT_LEN) + if (mtu < RTE_ETHER_MIN_MTU || frame_size > DPAA_MAX_RX_PKT_LEN) return -EINVAL; /* * Refuse mtu that requires the support of scattered packets @@ -172,7 +172,7 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EINVAL; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads &= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -230,7 +230,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) fman_if_set_maxfrm(dpaa_intf->fif, max_len); dev->data->mtu = max_len - - ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE; + - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN - VLAN_TAG_SIZE; } if (rx_offloads & DEV_RX_OFFLOAD_SCATTER) { @@ -1364,11 +1364,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) /* Allocate memory for storing MAC addresses */ eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", - ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0); + RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER, 0); if (eth_dev->data->mac_addrs == NULL) { DPAA_PMD_ERR("Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER); + RTE_ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER); ret = -ENOMEM; goto free_tx; } @@ -1396,7 +1396,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) fman_if_stats_reset(fman_intf); /* Disable SG by default */ fman_if_set_sg(fman_intf, 0); - fman_if_set_maxfrm(fman_intf, ETHER_MAX_LEN + VLAN_TAG_SIZE); + fman_if_set_maxfrm(fman_intf, RTE_ETHER_MAX_LEN + VLAN_TAG_SIZE); return 0; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index dd8fd8fd5..ff061df25 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -221,10 +221,10 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + mbuf->l3_len); tcp_hdr->cksum = 0; - if (eth_hdr->ether_type == htons(ETHER_TYPE_IPv4)) + if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) tcp_hdr->cksum = rte_ipv4_udptcp_cksum(ipv4_hdr, tcp_hdr); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ tcp_hdr->cksum = rte_ipv6_udptcp_cksum(ipv6_hdr, tcp_hdr); } else if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == @@ -232,10 +232,10 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) struct udp_hdr *udp_hdr = (struct udp_hdr *)(l3_hdr + mbuf->l3_len); udp_hdr->dgram_cksum = 0; - if (eth_hdr->ether_type == htons(ETHER_TYPE_IPv4)) + if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) udp_hdr->dgram_cksum = rte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ udp_hdr->dgram_cksum = rte_ipv6_udptcp_cksum(ipv6_hdr, udp_hdr); } diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 40e357127..3488aa63c 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1086,7 +1086,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) int ret; struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; - uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; PMD_INIT_FUNC_TRACE(); @@ -1097,10 +1097,10 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > DPAA2_MAX_RX_PKT_LEN)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > DPAA2_MAX_RX_PKT_LEN)) return -EINVAL; - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads &= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -2185,11 +2185,11 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) * can add MAC entries when rte_eth_dev_mac_addr_add is called. */ eth_dev->data->mac_addrs = rte_zmalloc("dpni", - ETHER_ADDR_LEN * attr.mac_filter_entries, 0); + RTE_ETHER_ADDR_LEN * attr.mac_filter_entries, 0); if (eth_dev->data->mac_addrs == NULL) { DPAA2_PMD_ERR( "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN * attr.mac_filter_entries); + RTE_ETHER_ADDR_LEN * attr.mac_filter_entries); ret = -ENOMEM; goto init_err; } diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index 3e74cd8fe..8f19f0434 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -92,7 +92,7 @@ * The overhead from MTU to max frame size. * Considering VLAN so a tag needs to be counted. */ -#define E1000_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE) +#define E1000_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE) /* * Maximum number of Ring Descriptors. @@ -155,7 +155,7 @@ struct e1000_vfta { */ #define E1000_MAX_VF_MC_ENTRIES 30 struct e1000_vf_info { - uint8_t vf_mac_addresses[ETHER_ADDR_LEN]; + uint8_t vf_mac_addresses[RTE_ETHER_ADDR_LEN]; uint16_t vf_mc_hashes[E1000_MAX_VF_MC_ENTRIES]; uint16_t num_vf_mc_hashes; uint16_t default_vf_vlan_id; diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 355ffc8b1..c8e42c98b 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -283,12 +283,12 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("e1000", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("e1000", RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * hw->mac.rar_entry_count); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count); return -ENOMEM; } @@ -575,7 +575,7 @@ eth_em_start(struct rte_eth_dev *dev) return -EIO; } - E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN); + E1000_WRITE_REG(hw, E1000_VET, RTE_ETHER_TYPE_VLAN); /* Configure for OS presence */ em_init_manageability(hw); @@ -820,7 +820,7 @@ em_hardware_init(struct e1000_hw *hw) */ rx_buf_size = em_get_rx_buffer_size(hw); - hw->fc.high_water = rx_buf_size - PMD_ROUNDUP(ETHER_MAX_LEN * 2, 1024); + hw->fc.high_water = rx_buf_size - PMD_ROUNDUP(RTE_ETHER_MAX_LEN * 2, 1024); hw->fc.low_water = hw->fc.high_water - 1500; if (hw->mac.type == e1000_80003es2lan) @@ -1036,7 +1036,7 @@ em_get_max_pktlen(struct rte_eth_dev *dev) return 0x1000; /* Adapters that do not support jumbo frames */ case e1000_ich8lan: - return ETHER_MAX_LEN; + return RTE_ETHER_MAX_LEN; default: return MAX_JUMBO_FRAME_SIZE; } @@ -1696,7 +1696,7 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x", rx_buf_size); /* At least reserve one Ethernet frame for watermark */ - max_high_water = rx_buf_size - ETHER_MAX_LEN; + max_high_water = rx_buf_size - RTE_ETHER_MAX_LEN; if ((fc_conf->high_water > max_high_water) || (fc_conf->high_water < fc_conf->low_water)) { PMD_INIT_LOG(ERR, "e1000 incorrect high/low water value"); @@ -1746,7 +1746,7 @@ eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) { - uint8_t addr[ETHER_ADDR_LEN]; + uint8_t addr[RTE_ETHER_ADDR_LEN]; struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); memset(addr, 0, sizeof(addr)); @@ -1772,10 +1772,10 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t rctl; eth_em_infos_get(dev, &dev_info); - frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE; + frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; /* refuse mtu that requires the support of scattered packets when this @@ -1788,7 +1788,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) rctl = E1000_READ_REG(hw, E1000_RCTL); /* switch to jumbo mode if needed */ - if (frame_size > ETHER_MAX_LEN) { + if (frame_size > RTE_ETHER_MAX_LEN) { dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; rctl |= E1000_RCTL_LPE; diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 005e1ea96..e09cc8d49 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -1005,17 +1005,17 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (data_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (data_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t) (last_seg->data_len - - (ETHER_CRC_LEN - data_len)); + (RTE_ETHER_CRC_LEN - data_len)); last_seg->next = NULL; } else rxm->data_len = - (uint16_t) (data_len - ETHER_CRC_LEN); + (uint16_t) (data_len - RTE_ETHER_CRC_LEN); } /* @@ -1368,7 +1368,7 @@ em_get_rx_port_offloads_capa(struct rte_eth_dev *dev) DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_KEEP_CRC | DEV_RX_OFFLOAD_SCATTER; - if (max_rx_pktlen > ETHER_MAX_LEN) + if (max_rx_pktlen > RTE_ETHER_MAX_LEN) rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME; return rx_offload_capa; @@ -1463,7 +1463,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev, rxq->queue_id = queue_idx; rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -1799,7 +1799,7 @@ eth_em_rx_init(struct rte_eth_dev *dev) * call to configure */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -1832,7 +1832,7 @@ eth_em_rx_init(struct rte_eth_dev *dev) * one buffer. */ if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME || - rctl_bsize < ETHER_MAX_LEN) { + rctl_bsize < RTE_ETHER_MAX_LEN) { if (!dev->data->scattered_rx) PMD_INIT_LOG(DEBUG, "forcing scatter mode"); dev->rx_pkt_burst = diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index e5d69251f..089eb79b3 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -830,11 +830,11 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) /* Allocate memory for storing MAC addresses */ eth_dev->data->mac_addrs = rte_zmalloc("e1000", - ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * hw->mac.rar_entry_count); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count); error = -ENOMEM; goto err_late; } @@ -1026,13 +1026,13 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) diag = hw->mac.ops.reset_hw(hw); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("igbvf", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("igbvf", RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC " "addresses", - ETHER_ADDR_LEN * hw->mac.rar_entry_count); + RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count); return -ENOMEM; } @@ -1320,7 +1320,7 @@ eth_igb_start(struct rte_eth_dev *dev) } adapter->stopped = 0; - E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN << 16 | ETHER_TYPE_VLAN); + E1000_WRITE_REG(hw, E1000_VET, RTE_ETHER_TYPE_VLAN << 16 | RTE_ETHER_TYPE_VLAN); ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); /* Set PF Reset Done bit so PF/VF Mail Ops can work */ @@ -1687,7 +1687,7 @@ igb_hardware_init(struct e1000_hw *hw) */ rx_buf_size = igb_get_rx_buffer_size(hw); - hw->fc.high_water = rx_buf_size - (ETHER_MAX_LEN * 2); + hw->fc.high_water = rx_buf_size - (RTE_ETHER_MAX_LEN * 2); hw->fc.low_water = hw->fc.high_water - 1500; hw->fc.pause_time = IGB_FC_PAUSE_TIME; hw->fc.send_xon = 1; @@ -1706,7 +1706,7 @@ igb_hardware_init(struct e1000_hw *hw) if (diag < 0) return diag; - E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN << 16 | ETHER_TYPE_VLAN); + E1000_WRITE_REG(hw, E1000_VET, RTE_ETHER_TYPE_VLAN << 16 | RTE_ETHER_TYPE_VLAN); e1000_get_phy_info(hw); e1000_check_for_link(hw); @@ -1770,10 +1770,10 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats) /* Workaround CRC bytes included in size, take away 4 bytes/packet */ stats->gorc += E1000_READ_REG(hw, E1000_GORCL); stats->gorc += ((uint64_t)E1000_READ_REG(hw, E1000_GORCH) << 32); - stats->gorc -= (stats->gprc - old_gprc) * ETHER_CRC_LEN; + stats->gorc -= (stats->gprc - old_gprc) * RTE_ETHER_CRC_LEN; stats->gotc += E1000_READ_REG(hw, E1000_GOTCL); stats->gotc += ((uint64_t)E1000_READ_REG(hw, E1000_GOTCH) << 32); - stats->gotc -= (stats->gptc - old_gptc) * ETHER_CRC_LEN; + stats->gotc -= (stats->gptc - old_gptc) * RTE_ETHER_CRC_LEN; stats->rnbc += E1000_READ_REG(hw, E1000_RNBC); stats->ruc += E1000_READ_REG(hw, E1000_RUC); @@ -1786,10 +1786,10 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats) stats->tor += E1000_READ_REG(hw, E1000_TORL); stats->tor += ((uint64_t)E1000_READ_REG(hw, E1000_TORH) << 32); - stats->tor -= (stats->tpr - old_tpr) * ETHER_CRC_LEN; + stats->tor -= (stats->tpr - old_tpr) * RTE_ETHER_CRC_LEN; stats->tot += E1000_READ_REG(hw, E1000_TOTL); stats->tot += ((uint64_t)E1000_READ_REG(hw, E1000_TOTH) << 32); - stats->tot -= (stats->tpt - old_tpt) * ETHER_CRC_LEN; + stats->tot -= (stats->tpt - old_tpt) * RTE_ETHER_CRC_LEN; stats->ptc64 += E1000_READ_REG(hw, E1000_PTC64); stats->ptc127 += E1000_READ_REG(hw, E1000_PTC127); @@ -1823,10 +1823,10 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats) stats->htcbdpc += E1000_READ_REG(hw, E1000_HTCBDPC); stats->hgorc += E1000_READ_REG(hw, E1000_HGORCL); stats->hgorc += ((uint64_t)E1000_READ_REG(hw, E1000_HGORCH) << 32); - stats->hgorc -= (stats->rpthc - old_rpthc) * ETHER_CRC_LEN; + stats->hgorc -= (stats->rpthc - old_rpthc) * RTE_ETHER_CRC_LEN; stats->hgotc += E1000_READ_REG(hw, E1000_HGOTCL); stats->hgotc += ((uint64_t)E1000_READ_REG(hw, E1000_HGOTCH) << 32); - stats->hgotc -= (stats->hgptc - old_hgptc) * ETHER_CRC_LEN; + stats->hgotc -= (stats->hgptc - old_hgptc) * RTE_ETHER_CRC_LEN; stats->lenerrs += E1000_READ_REG(hw, E1000_LENERRS); stats->scvpc += E1000_READ_REG(hw, E1000_SCVPC); stats->hrmpc += E1000_READ_REG(hw, E1000_HRMPC); @@ -2286,7 +2286,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) ETH_LINK_SPEED_1G; dev_info->max_mtu = dev_info->max_rx_pktlen - E1000_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; } @@ -3079,7 +3079,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x", rx_buf_size); /* At least reserve one Ethernet frame for watermark */ - max_high_water = rx_buf_size - ETHER_MAX_LEN; + max_high_water = rx_buf_size - RTE_ETHER_MAX_LEN; if ((fc_conf->high_water > max_high_water) || (fc_conf->high_water < fc_conf->low_water)) { PMD_INIT_LOG(ERR, "e1000 incorrect high/low water value"); @@ -3135,7 +3135,7 @@ eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) { - uint8_t addr[ETHER_ADDR_LEN]; + uint8_t addr[RTE_ETHER_ADDR_LEN]; struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); memset(addr, 0, sizeof(addr)); @@ -4483,7 +4483,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) eth_igb_infos_get(dev, &dev_info); /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; @@ -4496,7 +4496,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) rctl = E1000_READ_REG(hw, E1000_RCTL); /* switch to jumbo mode if needed */ - if (frame_size > ETHER_MAX_LEN) { + if (frame_size > RTE_ETHER_MAX_LEN) { dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; rctl |= E1000_RCTL_LPE; @@ -4742,8 +4742,8 @@ igb_add_del_ethertype_filter(struct rte_eth_dev *dev, uint32_t etqf = 0; int ret; - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in" " ethertype filter.", filter->ether_type); return -EINVAL; @@ -5154,7 +5154,7 @@ igb_timesync_enable(struct rte_eth_dev *dev) /* Enable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ E1000_WRITE_REG(hw, E1000_ETQF(E1000_ETQF_FILTER_1588), - (ETHER_TYPE_1588 | + (RTE_ETHER_TYPE_1588 | E1000_ETQF_FILTER_ENABLE | E1000_ETQF_1588)); diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index 8dcfc71c5..342986121 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -700,8 +700,8 @@ igb_parse_ethertype_filter(struct rte_eth_dev *dev, } } - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { memset(filter, 0, sizeof(struct rte_eth_ethertype_filter)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index ab48a269f..f026d83a9 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -37,7 +37,7 @@ dev_num_vf(struct rte_eth_dev *eth_dev) static inline int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) { - unsigned char vf_mac_addr[ETHER_ADDR_LEN]; + unsigned char vf_mac_addr[RTE_ETHER_ADDR_LEN]; struct e1000_vf_info *vfinfo = *E1000_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); uint16_t vfn; @@ -46,7 +46,7 @@ int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) rte_eth_random_addr(vf_mac_addr); /* keep the random address as default */ memcpy(vfinfo[vfn].vf_mac_addresses, vf_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } return 0; @@ -290,7 +290,7 @@ igb_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, ETHER_ADDR_LEN); + rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); e1000_write_mbx(hw, msgbuf, 3, vf); return 0; @@ -400,10 +400,10 @@ igb_vf_set_rlpml(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint16_t rlpml = msgbuf[1] & E1000_VMOLR_RLPML_MASK; - uint32_t max_frame = rlpml + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t max_frame = rlpml + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; uint32_t vmolr; - if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) + if ((max_frame < RTE_ETHER_MIN_LEN) || (max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)) return -1; vmolr = E1000_READ_REG(hw, E1000_VMOLR(vf)); diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index ab0a80e15..ee51eca97 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1147,17 +1147,17 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (data_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (data_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t) (last_seg->data_len - - (ETHER_CRC_LEN - data_len)); + (RTE_ETHER_CRC_LEN - data_len)); last_seg->next = NULL; } else rxm->data_len = - (uint16_t) (data_len - ETHER_CRC_LEN); + (uint16_t) (data_len - RTE_ETHER_CRC_LEN); } /* @@ -1725,7 +1725,7 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev, queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx); rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -2378,7 +2378,7 @@ eth_igb_rx_init(struct rte_eth_dev *dev) * call to configure */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index 221760c62..dcc8690a5 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -198,7 +198,7 @@ struct ena_adapter { int id_number; char name[ENA_NAME_MAX_LEN]; - u8 mac_addr[ETHER_ADDR_LEN]; + u8 mac_addr[RTE_ETHER_ADDR_LEN]; void *regs; void *dev_mem_base; diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h index f36fa11e0..3c876963c 100644 --- a/drivers/net/enetc/base/enetc_hw.h +++ b/drivers/net/enetc/base/enetc_hw.h @@ -170,8 +170,8 @@ struct enetc_hw { }; struct enetc_eth_mac_info { - uint8_t addr[ETHER_ADDR_LEN]; - uint8_t perm_addr[ETHER_ADDR_LEN]; + uint8_t addr[RTE_ETHER_ADDR_LEN]; + uint8_t perm_addr[RTE_ETHER_ADDR_LEN]; uint8_t get_link_status; }; diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 3aa4977ff..b45b3b65c 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -88,11 +88,11 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("enetc_eth", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("enetc_eth", RTE_ETHER_ADDR_LEN, 0); if (!eth_dev->data->mac_addrs) { ENETC_PMD_ERR("Failed to allocate %d bytes needed to " "store MAC addresses", - ETHER_ADDR_LEN * 1); + RTE_ETHER_ADDR_LEN * 1); error = -ENOMEM; return -1; } diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 20080af6f..bd2783430 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -204,7 +204,7 @@ struct enic { static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu) { /* ethdev max size includes eth whereas NIC MTU does not */ - return mtu + ETHER_HDR_LEN; + return mtu + RTE_ETHER_HDR_LEN; } /* Get the CQ index from a Start of Packet(SOP) RQ index */ diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 597c1f214..29025a12a 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -646,9 +646,9 @@ static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { - char mac_str[ETHER_ADDR_FMT_SIZE]; + char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(DEBUG, " %s address %s\n", add ? "add" : "remove", mac_str); } @@ -658,7 +658,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, uint32_t nb_mc_addr) { struct enic *enic = pmd_priv(eth_dev); - char mac_str[ETHER_ADDR_FMT_SIZE]; + char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; struct rte_ether_addr *addr; uint32_t i, j; int ret; @@ -670,7 +670,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, addr = &mc_addr_set[i]; if (!rte_is_multicast_ether_addr(addr) || rte_is_broadcast_ether_addr(addr)) { - rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(ERR, " invalid multicast address %s\n", mac_str); return -EINVAL; diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 94c443a98..4996fdf8a 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -592,7 +592,7 @@ enic_copy_item_inner_vlan_v2(struct copy_item_args *arg) arg->l2_proto_off = *off + offsetof(struct rte_vlan_hdr, eth_proto); return copy_inner_common(&arg->filter->u.generic_1, off, arg->item->spec, mask, sizeof(struct rte_vlan_hdr), - eth_type_off, rte_cpu_to_be_16(ETHER_TYPE_VLAN), 2); + eth_type_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN), 2); } static int @@ -608,7 +608,7 @@ enic_copy_item_inner_ipv4_v2(struct copy_item_args *arg) arg->l3_proto_off = *off + offsetof(struct ipv4_hdr, next_proto_id); return copy_inner_common(&arg->filter->u.generic_1, off, arg->item->spec, mask, sizeof(struct ipv4_hdr), - arg->l2_proto_off, rte_cpu_to_be_16(ETHER_TYPE_IPv4), 2); + arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4), 2); } static int @@ -624,7 +624,7 @@ enic_copy_item_inner_ipv6_v2(struct copy_item_args *arg) arg->l3_proto_off = *off + offsetof(struct ipv6_hdr, proto); return copy_inner_common(&arg->filter->u.generic_1, off, arg->item->spec, mask, sizeof(struct ipv6_hdr), - arg->l2_proto_off, rte_cpu_to_be_16(ETHER_TYPE_IPv6), 2); + arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6), 2); } static int @@ -678,14 +678,14 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) mask = &rte_flow_item_eth_mask; memcpy(enic_spec.d_addr.addr_bytes, spec->dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(enic_spec.s_addr.addr_bytes, spec->src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(enic_mask.d_addr.addr_bytes, mask->dst.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); memcpy(enic_mask.s_addr.addr_bytes, mask->src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); enic_spec.ether_type = spec->type; enic_mask.ether_type = mask->type; diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c index f7cbc90fb..b92b8232e 100644 --- a/drivers/net/enic/enic_res.c +++ b/drivers/net/enic/enic_res.c @@ -61,9 +61,9 @@ int enic_get_vnic_config(struct enic *enic) * and will be 0 for legacy firmware and VICs */ if (c->max_pkt_size > ENIC_DEFAULT_RX_MAX_PKT_SIZE) - enic->max_mtu = c->max_pkt_size - ETHER_HDR_LEN; + enic->max_mtu = c->max_pkt_size - RTE_ETHER_HDR_LEN; else - enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - ETHER_HDR_LEN; + enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - RTE_ETHER_HDR_LEN; if (c->mtu == 0) c->mtu = 1500; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 5fc6be403..d2e725bce 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -376,7 +376,7 @@ fs_get_mac_addr_arg(const char *key __rte_unused, &ea->addr_bytes[0], &ea->addr_bytes[1], &ea->addr_bytes[2], &ea->addr_bytes[3], &ea->addr_bytes[4], &ea->addr_bytes[5]); - return ret != ETHER_ADDR_LEN; + return ret != RTE_ETHER_ADDR_LEN; } int diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 325c67ca9..217c93672 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -172,9 +172,9 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, ret = rte_eth_dev_mac_addr_add(PORT_ID(sdev), ea, PRIV(dev)->mac_addr_pool[i]); if (ret) { - char ea_fmt[ETHER_ADDR_FMT_SIZE]; + char ea_fmt[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(ea_fmt, RTE_ETHER_ADDR_FMT_SIZE, ea); ERROR("Adding MAC address %s failed", ea_fmt); return ret; } diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index dc814855d..99dedd98d 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -305,7 +305,7 @@ fm10k_addr_alignment_valid(struct rte_mbuf *mb) /* 8B aligned, and max Ethernet frame would not cross a 4KB boundary? */ if (RTE_ALIGN(addr, 8) == addr) { boundary1 = RTE_ALIGN_FLOOR(addr, 4096); - boundary2 = RTE_ALIGN_FLOOR(addr + ETHER_MAX_VLAN_FRAME_LEN, + boundary2 = RTE_ALIGN_FLOOR(addr + RTE_ETHER_MAX_VLAN_FRAME_LEN, 4096); if (boundary1 == boundary2) return 1; diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index e6956cbdb..b6bcebea9 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -613,7 +613,7 @@ fm10k_dev_mq_rx_configure(struct rte_eth_dev *dev) /* reset MAC/VLAN as it's based on VMDQ or PF main VSI */ memset(dev->data->mac_addrs, 0, - ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM); + RTE_ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM); rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); @@ -3072,7 +3072,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Initialize MAC address(es) */ dev->data->mac_addrs = rte_zmalloc("fm10k", - ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM, 0); + RTE_ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM, 0); if (dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Cannot allocate memory for MAC addresses"); return -ENOMEM; diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 5d0343a42..7d841d183 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1477,7 +1477,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) /* Set the global registers with default ether type value */ if (!pf->support_multi_driver) { ret = i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_OUTER, - ETHER_TYPE_VLAN); + RTE_ETHER_TYPE_VLAN); if (ret != I40E_SUCCESS) { PMD_INIT_LOG(ERR, "Failed to set the default outer " @@ -1508,9 +1508,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) } if (!vsi->max_macaddrs) - len = ETHER_ADDR_LEN; + len = RTE_ETHER_ADDR_LEN; else - len = ETHER_ADDR_LEN * vsi->max_macaddrs; + len = RTE_ETHER_ADDR_LEN * vsi->max_macaddrs; /* Should be after VSI initialized */ dev->data->mac_addrs = rte_zmalloc("i40e", len, 0); @@ -2824,7 +2824,7 @@ i40e_update_vsi_stats(struct i40e_vsi *vsi) &nes->rx_broadcast); /* exclude CRC bytes */ nes->rx_bytes -= (nes->rx_unicast + nes->rx_multicast + - nes->rx_broadcast) * ETHER_CRC_LEN; + nes->rx_broadcast) * RTE_ETHER_CRC_LEN; i40e_stat_update_32(hw, I40E_GLV_RDPC(idx), vsi->offset_loaded, &oes->rx_discards, &nes->rx_discards); @@ -2924,7 +2924,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) /* exclude CRC size */ pf->internal_stats.rx_bytes -= (pf->internal_stats.rx_unicast + pf->internal_stats.rx_multicast + - pf->internal_stats.rx_broadcast) * ETHER_CRC_LEN; + pf->internal_stats.rx_broadcast) * RTE_ETHER_CRC_LEN; /* Get statistics of struct i40e_eth_stats */ i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -2944,10 +2944,10 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) pf->offset_loaded, &os->eth.rx_broadcast, &ns->eth.rx_broadcast); /* Workaround: CRC size should not be included in byte statistics, - * so subtract ETHER_CRC_LEN from the byte counter for each rx packet. + * so subtract RTE_ETHER_CRC_LEN from the byte counter for each rx packet. */ ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast) * ETHER_CRC_LEN; + ns->eth.rx_broadcast) * RTE_ETHER_CRC_LEN; /* exclude internal rx bytes * Workaround: it is possible I40E_GLV_GORCH[H/L] is updated before @@ -3001,7 +3001,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) pf->offset_loaded, &os->eth.tx_broadcast, &ns->eth.tx_broadcast); ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast) * ETHER_CRC_LEN; + ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN; /* exclude internal tx bytes * Workaround: it is possible I40E_GLV_GOTCH[H/L] is updated before @@ -3500,7 +3500,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_mac_addrs = vsi->max_macaddrs; dev_info->max_vfs = pci_dev->max_vfs; dev_info->max_mtu = dev_info->max_rx_pktlen - I40E_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->rx_queue_offload_capa = 0; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP | @@ -3766,9 +3766,9 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask) i40e_vsi_config_double_vlan(vsi, TRUE); /* Set global registers with default ethertype. */ i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_OUTER, - ETHER_TYPE_VLAN); + RTE_ETHER_TYPE_VLAN); i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_INNER, - ETHER_TYPE_VLAN); + RTE_ETHER_TYPE_VLAN); } else i40e_vsi_config_double_vlan(vsi, FALSE); @@ -4026,7 +4026,7 @@ i40e_macaddr_add(struct rte_eth_dev *dev, return -EINVAL; } - rte_memcpy(&mac_filter.mac_addr, mac_addr, ETHER_ADDR_LEN); + rte_memcpy(&mac_filter.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; else @@ -4131,11 +4131,11 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } if (add) { - rte_memcpy(&old_mac, hw->mac.addr, ETHER_ADDR_LEN); + rte_memcpy(&old_mac, hw->mac.addr, RTE_ETHER_ADDR_LEN); rte_memcpy(hw->mac.addr, new_mac->addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(&mac_filter.mac_addr, &filter->mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); mac_filter.filter_type = filter->filter_type; ret = i40e_vsi_add_mac(vf->vsi, &mac_filter); @@ -4146,7 +4146,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, rte_ether_addr_copy(new_mac, &pf->dev_addr); } else { rte_memcpy(hw->mac.addr, hw->mac.perm_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ret = i40e_vsi_delete_mac(vf->vsi, &filter->mac_addr); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to delete MAC filter."); @@ -5814,7 +5814,7 @@ i40e_vsi_setup(struct i40e_pf *pf, } /* MAC/VLAN configuration */ - rte_memcpy(&filter.mac_addr, &broadcast, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; ret = i40e_vsi_add_mac(vsi, &filter); @@ -7100,7 +7100,7 @@ i40e_vsi_add_vlan(struct i40e_vsi *vsi, uint16_t vlan) int mac_num; int ret = I40E_SUCCESS; - if (!vsi || vlan > ETHER_MAX_VLAN_ID) + if (!vsi || vlan > RTE_ETHER_MAX_VLAN_ID) return I40E_ERR_PARAM; /* If it's already set, just return */ @@ -7151,7 +7151,7 @@ i40e_vsi_delete_vlan(struct i40e_vsi *vsi, uint16_t vlan) * Vlan 0 is the generic filter for untagged packets * and can't be removed. */ - if (!vsi || vlan == 0 || vlan > ETHER_MAX_VLAN_ID) + if (!vsi || vlan == 0 || vlan > RTE_ETHER_MAX_VLAN_ID) return I40E_ERR_PARAM; /* If can't find it, just return */ @@ -8610,7 +8610,7 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, return -EINVAL; } - if (filter->inner_vlan > ETHER_MAX_VLAN_ID) { + if (filter->inner_vlan > RTE_ETHER_MAX_VLAN_ID) { PMD_DRV_LOG(ERR, "Invalid inner VLAN ID"); return -EINVAL; } @@ -9890,7 +9890,7 @@ static int i40e_ethertype_filter_convert(const struct rte_eth_ethertype_filter *input, struct i40e_ethertype_filter *filter) { - rte_memcpy(&filter->input.mac_addr, &input->mac_addr, ETHER_ADDR_LEN); + rte_memcpy(&filter->input.mac_addr, &input->mac_addr, RTE_ETHER_ADDR_LEN); filter->input.ether_type = input->ether_type; filter->flags = input->flags; filter->queue = input->queue; @@ -9982,14 +9982,14 @@ i40e_ethertype_filter_set(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "Invalid queue ID"); return -EINVAL; } - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in control packet filter.", filter->ether_type); return -EINVAL; } - if (filter->ether_type == ETHER_TYPE_VLAN) + if (filter->ether_type == RTE_ETHER_TYPE_VLAN) PMD_DRV_LOG(WARNING, "filter vlan ether_type in first tag is not supported."); @@ -11996,7 +11996,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) int ret = 0; /* check if mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -12006,7 +12006,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 0b8cb780d..d8251ac24 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -269,7 +269,7 @@ enum i40e_flxpld_layer_idx { * Considering QinQ packet, the VLAN tag needs to be counted twice. */ #define I40E_ETH_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE * 2) struct i40e_adapter; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index ba9dd348f..9dc6a2774 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1503,12 +1503,12 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) /* copy mac addr */ eth_dev->data->mac_addrs = rte_zmalloc("i40evf_mac", - ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX, + RTE_ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to" " store MAC addresses", - ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); + RTE_ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, @@ -1765,21 +1765,21 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq) * Check if the jumbo frame and maximum packet length are set correctly */ if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (rxq->max_pkt_len <= ETHER_MAX_LEN || + if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN || rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, as jumbo " - "frame is enabled", (uint32_t)ETHER_MAX_LEN, + "frame is enabled", (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)I40E_FRAME_SIZE_MAX); return I40E_ERR_CONFIG; } } else { - if (rxq->max_pkt_len < ETHER_MIN_LEN || - rxq->max_pkt_len > ETHER_MAX_LEN) { + if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || + rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, as jumbo " - "frame is disabled", (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + "frame is disabled", (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return I40E_ERR_CONFIG; } } @@ -2217,7 +2217,7 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize = I40E_BUF_SIZE_MIN; dev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX; dev_info->max_mtu = dev_info->max_rx_pktlen - I40E_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->hash_key_size = (I40E_VFQF_HKEY_MAX_INDEX + 1) * sizeof(uint32_t); dev_info->reta_size = ETH_RSS_RETA_SIZE_64; dev_info->flow_type_rss_offloads = vf->adapter->flow_types_mask; @@ -2679,7 +2679,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) int ret = 0; /* check if mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX)) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -2689,7 +2689,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index dd940cecb..4aaf27f7c 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -113,7 +113,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq) #endif rx_ctx.dtype = i40e_header_split_none; rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE; - rx_ctx.rxmax = ETHER_MAX_LEN; + rx_ctx.rxmax = RTE_ETHER_MAX_LEN; rx_ctx.tphrdesc_ena = 1; rx_ctx.tphwdesc_ena = 1; rx_ctx.tphdata_ena = 1; @@ -725,7 +725,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_FRAG_IPV4: ip = (struct ipv4_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; /* set len to by default */ ip->total_length = rte_cpu_to_be_16(I40E_FDIR_IP_DEFAULT_LEN); @@ -752,7 +752,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_FRAG_IPV6: ip6 = (struct ipv6_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW | (fdir_input->flow.ipv6_flow.tc << @@ -910,7 +910,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, * starts after the whole ARP header */ if (fdir_input->flow.l2_flow.ether_type == - rte_cpu_to_be_16(ETHER_TYPE_ARP)) + rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; break; @@ -1009,7 +1009,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, is_customized_pctype) { ip = (struct ipv4_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; /* set len to by default */ ip->total_length = rte_cpu_to_be_16(I40E_FDIR_IP_DEFAULT_LEN); @@ -1042,7 +1042,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, pctype == I40E_FILTER_PCTYPE_FRAG_IPV6) { ip6 = (struct ipv6_hdr *)raw_pkt; - *ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = rte_cpu_to_be_32(I40E_FDIR_IPv6_DEFAULT_VTC_FLOW | (fdir_input->flow.ipv6_flow.tc << @@ -1196,7 +1196,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, * starts after the whole ARP header */ if (fdir_input->flow.l2_flow.ether_type == - rte_cpu_to_be_16(ETHER_TYPE_ARP)) + rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; } else if (fdir_input->flow_ext.customized_pctype) { diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index e21a8f63b..eab451447 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2036,9 +2036,9 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, } filter->ether_type = rte_be_to_cpu_16(eth_spec->type); - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6 || - filter->ether_type == ETHER_TYPE_LLDP || + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6 || + filter->ether_type == RTE_ETHER_TYPE_LLDP || filter->ether_type == outer_tpid) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2508,9 +2508,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, ether_type = rte_be_to_cpu_16(eth_spec->type); if (next == RTE_FLOW_ITEM_TYPE_VLAN || - ether_type == ETHER_TYPE_IPv4 || - ether_type == ETHER_TYPE_IPv6 || - ether_type == ETHER_TYPE_ARP || + ether_type == RTE_ETHER_TYPE_IPv4 || + ether_type == RTE_ETHER_TYPE_IPv6 || + ether_type == RTE_ETHER_TYPE_ARP || ether_type == outer_tpid) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2553,9 +2553,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, ether_type = rte_be_to_cpu_16(vlan_spec->inner_type); - if (ether_type == ETHER_TYPE_IPv4 || - ether_type == ETHER_TYPE_IPv6 || - ether_type == ETHER_TYPE_ARP || + if (ether_type == RTE_ETHER_TYPE_IPv4 || + ether_type == RTE_ETHER_TYPE_IPv6 || + ether_type == RTE_ETHER_TYPE_ARP || ether_type == outer_tpid) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -3339,12 +3339,12 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, if (!vxlan_flag) { rte_memcpy(&filter->outer_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_OMAC; } else { rte_memcpy(&filter->inner_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_IMAC; } } @@ -3569,12 +3569,12 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, if (!nvgre_flag) { rte_memcpy(&filter->outer_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_OMAC; } else { rte_memcpy(&filter->inner_mac, ð_spec->dst, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); filter_type |= ETH_TUNNEL_FILTER_IMAC; } } diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 6a86ec57b..f2d98d8c7 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -843,7 +843,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, for (i = 0; i < addr_list->num_elements; i++) { mac = (struct rte_ether_addr *)(addr_list->list[i].addr); - rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, mac, RTE_ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; if (rte_is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, &filter)) { diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 8f727fae6..52ce536e0 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -889,17 +889,17 @@ i40e_recv_scattered_pkts(void *rx_queue, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (rx_packet_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (rx_packet_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t)(last_seg->data_len - - (ETHER_CRC_LEN - rx_packet_len)); + (RTE_ETHER_CRC_LEN - rx_packet_len)); last_seg->next = NULL; } else rxm->data_len = (uint16_t)(rx_packet_len - - ETHER_CRC_LEN); + RTE_ETHER_CRC_LEN); } first_seg->port = rxq->port_id; @@ -1839,7 +1839,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, rxq->reg_idx = reg_idx; rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; rxq->drop_en = rx_conf->rx_drop_en; @@ -2619,23 +2619,23 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) len = hw->func_caps.rx_buf_chain_len * rxq->rx_buf_len; rxq->max_pkt_len = RTE_MIN(len, data->dev_conf.rxmode.max_rx_pkt_len); if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (rxq->max_pkt_len <= ETHER_MAX_LEN || + if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN || rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must " "be larger than %u and smaller than %u," "as jumbo frame is enabled", - (uint32_t)ETHER_MAX_LEN, + (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)I40E_FRAME_SIZE_MAX); return I40E_ERR_CONFIG; } } else { - if (rxq->max_pkt_len < ETHER_MIN_LEN || - rxq->max_pkt_len > ETHER_MAX_LEN) { + if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || + rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is disabled", - (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return I40E_ERR_CONFIG; } } diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index c4ba8f89a..6393fc10c 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -663,7 +663,7 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id, RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - if (vlan_id > ETHER_MAX_VLAN_ID) { + if (vlan_id > RTE_ETHER_MAX_VLAN_ID) { PMD_DRV_LOG(ERR, "Invalid VLAN ID."); return -EINVAL; } @@ -765,7 +765,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, } if (on) { - rte_memcpy(&filter.mac_addr, &broadcast, ETHER_ADDR_LEN); + rte_memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; ret = i40e_vsi_add_mac(vsi, &filter); } else { @@ -893,7 +893,7 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id, if (!is_i40e_supported(dev)) return -ENOTSUP; - if (vlan_id > ETHER_MAX_VLAN_ID || !vlan_id) { + if (vlan_id > RTE_ETHER_MAX_VLAN_ID || !vlan_id) { PMD_DRV_LOG(ERR, "Invalid VLAN ID."); return -EINVAL; } diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index e8f453bd8..a965f9a61 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -56,7 +56,7 @@ */ #define IAVF_VLAN_TAG_SIZE 4 #define IAVF_ETH_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IAVF_VLAN_TAG_SIZE * 2) struct iavf_adapter; struct iavf_rx_queue; diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index b56fbcb13..a75f3e54d 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -223,23 +223,23 @@ iavf_init_rxq(struct rte_eth_dev *dev, struct iavf_rx_queue *rxq) * correctly. */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (max_pkt_len <= ETHER_MAX_LEN || + if (max_pkt_len <= RTE_ETHER_MAX_LEN || max_pkt_len > IAVF_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is enabled", - (uint32_t)ETHER_MAX_LEN, + (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)IAVF_FRAME_SIZE_MAX); return -EINVAL; } } else { - if (max_pkt_len < ETHER_MIN_LEN || - max_pkt_len > ETHER_MAX_LEN) { + if (max_pkt_len < RTE_ETHER_MIN_LEN || + max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is disabled", - (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return -EINVAL; } } @@ -907,7 +907,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t frame_size = mtu + IAVF_ETH_OVERHEAD; int ret = 0; - if (mtu < ETHER_MIN_MTU || frame_size > IAVF_FRAME_SIZE_MAX) + if (mtu < RTE_ETHER_MIN_MTU || frame_size > IAVF_FRAME_SIZE_MAX) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -916,7 +916,7 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -1233,12 +1233,12 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* copy mac addr */ eth_dev->data->mac_addrs = rte_zmalloc( "iavf_mac", - ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX, + RTE_ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX, 0); if (!eth_dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to" " store MAC addresses", - ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX); + RTE_ETHER_ADDR_LEN * IAVF_NUM_MACADDR_MAX); return -ENOMEM; } /* If the MAC address is not configured by host, diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index db7070fb5..103a020c8 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1025,17 +1025,17 @@ iavf_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (rx_packet_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (rx_packet_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t)(last_seg->data_len - - (ETHER_CRC_LEN - rx_packet_len)); + (RTE_ETHER_CRC_LEN - rx_packet_len)); last_seg->next = NULL; } else rxm->data_len = (uint16_t)(rx_packet_len - - ETHER_CRC_LEN); + RTE_ETHER_CRC_LEN); } first_seg->port = rxq->port_id; diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 91f052852..0ddc89b08 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -647,7 +647,7 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) struct ice_hw *hw = ICE_VSI_TO_HW(vsi); int ret = 0; - if (!vsi || vlan_id > ETHER_MAX_VLAN_ID) + if (!vsi || vlan_id > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; /* If it's added and configured, return. */ @@ -716,7 +716,7 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) * Vlan 0 is the generic filter for untagged packets * and can't be removed. */ - if (!vsi || vlan_id == 0 || vlan_id > ETHER_MAX_VLAN_ID) + if (!vsi || vlan_id == 0 || vlan_id > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; /* Can't find it, return an error */ @@ -1216,12 +1216,12 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) hw->port_info->mac.perm_addr, ETH_ADDR_LEN); - rte_memcpy(&mac_addr, &pf->dev_addr, ETHER_ADDR_LEN); + rte_memcpy(&mac_addr, &pf->dev_addr, RTE_ETHER_ADDR_LEN); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add dflt MAC filter"); - rte_memcpy(&mac_addr, &broadcast, ETHER_ADDR_LEN); + rte_memcpy(&mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add MAC filter"); @@ -2206,11 +2206,11 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct rte_eth_dev_data *dev_data = pf->dev_data; - uint32_t frame_size = mtu + ETHER_HDR_LEN - + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE; + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE; /* check if mtu is within the allowed range */ - if (mtu < ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX) + if (mtu < RTE_ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -2221,7 +2221,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -3073,7 +3073,7 @@ ice_update_vsi_stats(struct ice_vsi *vsi) &nes->rx_broadcast); /* exclude CRC bytes */ nes->rx_bytes -= (nes->rx_unicast + nes->rx_multicast + - nes->rx_broadcast) * ETHER_CRC_LEN; + nes->rx_broadcast) * RTE_ETHER_CRC_LEN; ice_stat_update_32(hw, GLV_RDPC(idx), vsi->offset_loaded, &oes->rx_discards, &nes->rx_discards); @@ -3146,10 +3146,10 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) &ns->eth.rx_discards); /* Workaround: CRC size should not be included in byte statistics, - * so subtract ETHER_CRC_LEN from the byte counter for each rx packet. + * so subtract RTE_ETHER_CRC_LEN from the byte counter for each rx packet. */ ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + - ns->eth.rx_broadcast) * ETHER_CRC_LEN; + ns->eth.rx_broadcast) * RTE_ETHER_CRC_LEN; /* GLPRT_REPC not supported */ /* GLPRT_RMPC not supported */ @@ -3174,7 +3174,7 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) pf->offset_loaded, &os->eth.tx_broadcast, &ns->eth.tx_broadcast); ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + - ns->eth.tx_broadcast) * ETHER_CRC_LEN; + ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN; /* GLPRT_TEPC not supported */ diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index f45b8248f..9fc98b401 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -47,23 +47,23 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq) dev->data->dev_conf.rxmode.max_rx_pkt_len); if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { - if (rxq->max_pkt_len <= ETHER_MAX_LEN || + if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN || rxq->max_pkt_len > ICE_FRAME_SIZE_MAX) { PMD_DRV_LOG(ERR, "maximum packet length must " "be larger than %u and smaller than %u," "as jumbo frame is enabled", - (uint32_t)ETHER_MAX_LEN, + (uint32_t)RTE_ETHER_MAX_LEN, (uint32_t)ICE_FRAME_SIZE_MAX); return -EINVAL; } } else { - if (rxq->max_pkt_len < ETHER_MIN_LEN || - rxq->max_pkt_len > ETHER_MAX_LEN) { + if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || + rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { PMD_DRV_LOG(ERR, "maximum packet length must be " "larger than %u and smaller than %u, " "as jumbo frame is disabled", - (uint32_t)ETHER_MIN_LEN, - (uint32_t)ETHER_MAX_LEN); + (uint32_t)RTE_ETHER_MIN_LEN, + (uint32_t)RTE_ETHER_MAX_LEN); return -EINVAL; } } @@ -629,7 +629,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, rxq->reg_idx = vsi->base_queue + queue_idx; rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; @@ -1411,17 +1411,17 @@ ice_recv_scattered_pkts(void *rx_queue, */ rxm->next = NULL; if (unlikely(rxq->crc_len > 0)) { - first_seg->pkt_len -= ETHER_CRC_LEN; - if (rx_packet_len <= ETHER_CRC_LEN) { + first_seg->pkt_len -= RTE_ETHER_CRC_LEN; + if (rx_packet_len <= RTE_ETHER_CRC_LEN) { rte_pktmbuf_free_seg(rxm); first_seg->nb_segs--; last_seg->data_len = (uint16_t)(last_seg->data_len - - (ETHER_CRC_LEN - rx_packet_len)); + (RTE_ETHER_CRC_LEN - rx_packet_len)); last_seg->next = NULL; } else rxm->data_len = (uint16_t)(rx_packet_len - - ETHER_CRC_LEN); + RTE_ETHER_CRC_LEN); } first_seg->port = rxq->port_id; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 6b44ca4c1..3afa43aae 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1212,13 +1212,13 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) ixgbe_reset_qstat_mappings(hw); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %u bytes needed to store " "MAC addresses", - ETHER_ADDR_LEN * hw->mac.num_rar_entries); + RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries); return -ENOMEM; } /* Copy the permanent MAC address */ @@ -1226,12 +1226,12 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ - eth_dev->data->hash_mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN * + eth_dev->data->hash_mac_addrs = rte_zmalloc("ixgbe", RTE_ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC, 0); if (eth_dev->data->hash_mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC); + RTE_ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC); return -ENOMEM; } @@ -1498,7 +1498,7 @@ static int ixgbe_l2_tn_filter_init(struct rte_eth_dev *eth_dev) } l2_tn_info->e_tag_en = FALSE; l2_tn_info->e_tag_fwd_en = FALSE; - l2_tn_info->e_tag_ether_type = ETHER_TYPE_ETAG; + l2_tn_info->e_tag_ether_type = RTE_ETHER_TYPE_ETAG; return 0; } @@ -1539,7 +1539,7 @@ generate_random_mac_addr(struct rte_ether_addr *mac_addr) mac_addr->addr_bytes[1] = 0x09; mac_addr->addr_bytes[2] = 0xC0; /* Force indication of locally assigned MAC address. */ - mac_addr->addr_bytes[0] |= ETHER_LOCAL_ADMIN_ADDR; + mac_addr->addr_bytes[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR; /* Generate the last 3 bytes of the MAC address with a random number. */ random = rte_rand(); memcpy(&mac_addr->addr_bytes[3], &random, 3); @@ -1645,13 +1645,13 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) ixgbevf_get_queues(hw, &tcs, &tc); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %u bytes needed to store " "MAC addresses", - ETHER_ADDR_LEN * hw->mac.num_rar_entries); + RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries); return -ENOMEM; } @@ -3050,7 +3050,7 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw, hw_stats->qbrc[i] += ((uint64_t)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32); if (crc_strip == 0) - hw_stats->qbrc[i] -= delta_qprc * ETHER_CRC_LEN; + hw_stats->qbrc[i] -= delta_qprc * RTE_ETHER_CRC_LEN; hw_stats->qbtc[i] += IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)); hw_stats->qbtc[i] += @@ -3095,12 +3095,12 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw, hw_stats->tpt += IXGBE_READ_REG(hw, IXGBE_TPT); if (crc_strip == 0) - hw_stats->gorc -= delta_gprc * ETHER_CRC_LEN; + hw_stats->gorc -= delta_gprc * RTE_ETHER_CRC_LEN; uint64_t delta_gptc = IXGBE_READ_REG(hw, IXGBE_GPTC); hw_stats->gptc += delta_gptc; - hw_stats->gotc -= delta_gptc * ETHER_CRC_LEN; - hw_stats->tor -= (hw_stats->tpr - old_tpr) * ETHER_CRC_LEN; + hw_stats->gotc -= delta_gptc * RTE_ETHER_CRC_LEN; + hw_stats->tor -= (hw_stats->tpr - old_tpr) * RTE_ETHER_CRC_LEN; /* * Workaround: mprc hardware is incorrectly counting @@ -3130,7 +3130,7 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw, hw_stats->gptc -= total; hw_stats->mptc -= total; hw_stats->ptc64 -= total; - hw_stats->gotc -= total * ETHER_MIN_LEN; + hw_stats->gotc -= total * RTE_ETHER_MIN_LEN; hw_stats->ruc += IXGBE_READ_REG(hw, IXGBE_RUC); hw_stats->rfc += IXGBE_READ_REG(hw, IXGBE_RFC); @@ -3752,7 +3752,7 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) else dev_info->max_vmdq_pools = ETH_64_POOLS; dev_info->max_mtu = dev_info->max_rx_pktlen - IXGBE_ETH_OVERHEAD; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->vmdq_queue_num = dev_info->max_rx_queues; dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | @@ -4553,7 +4553,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) * At least reserve one Ethernet frame for watermark * high_water/low_water in kilo bytes for ixgbe */ - max_high_water = (rx_buf_size - ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; + max_high_water = (rx_buf_size - RTE_ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; if ((fc_conf->high_water > max_high_water) || (fc_conf->high_water < fc_conf->low_water)) { PMD_INIT_LOG(ERR, "Invalid high/low water setup value in KB"); @@ -4774,7 +4774,7 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p * At least reserve one Ethernet frame for watermark * high_water/low_water in kilo bytes for ixgbe */ - max_high_water = (rx_buf_size - ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; + max_high_water = (rx_buf_size - RTE_ETHER_MAX_LEN) >> IXGBE_RXPBSIZE_SHIFT; if ((pfc_conf->fc.high_water > max_high_water) || (pfc_conf->fc.high_water <= pfc_conf->fc.low_water)) { PMD_INIT_LOG(ERR, "Invalid high/low water setup value in KB"); @@ -4955,7 +4955,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) ixgbe_dev_info_get(dev, &dev_info); /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) return -EINVAL; /* If device is started, refuse mtu that requires the support of @@ -4972,7 +4972,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); /* switch to jumbo mode if needed */ - if (frame_size > ETHER_MAX_LEN) { + if (frame_size > RTE_ETHER_MAX_LEN) { dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; hlreg0 |= IXGBE_HLREG0_JUMBOEN; @@ -6357,7 +6357,7 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if ((mtu < ETHER_MIN_MTU) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) + if ((mtu < RTE_ETHER_MIN_MTU) || (max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)) return -EINVAL; /* If device is started, refuse mtu that requires the support of @@ -6654,8 +6654,8 @@ ixgbe_add_del_ethertype_filter(struct rte_eth_dev *dev, if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM) return -EINVAL; - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in" " ethertype filter.", filter->ether_type); return -EINVAL; @@ -7063,7 +7063,7 @@ ixgbe_timesync_enable(struct rte_eth_dev *dev) /* Enable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_1588), - (ETHER_TYPE_1588 | + (RTE_ETHER_TYPE_1588 | IXGBE_ETQF_FILTER_EN | IXGBE_ETQF_1588)); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index d1f61e85e..fdad94d58 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -102,7 +102,7 @@ #define IXGBE_5TUPLE_MIN_PRI 1 /* The overhead from MTU to max frame size. */ -#define IXGBE_ETH_OVERHEAD (ETHER_HDR_LEN + ETHER_CRC_LEN) +#define IXGBE_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN) /* bit of VXLAN tunnel type | 7 bits of zeros | 8 bits of zeros*/ #define IXGBE_FDIR_VXLAN_TUNNEL_TYPE 0x8000 @@ -258,7 +258,7 @@ struct ixgbe_mirror_info { }; struct ixgbe_vf_info { - uint8_t vf_mac_addresses[ETHER_ADDR_LEN]; + uint8_t vf_mac_addresses[RTE_ETHER_ADDR_LEN]; uint16_t vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES]; uint16_t num_vf_mc_hashes; uint16_t default_vf_vlan_id; diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 7024354cd..23aba0a47 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -887,8 +887,8 @@ ixgbe_parse_ethertype_filter(struct rte_eth_dev *dev, return -rte_errno; } - if (filter->ether_type == ETHER_TYPE_IPv4 || - filter->ether_type == ETHER_TYPE_IPv6) { + if (filter->ether_type == RTE_ETHER_TYPE_IPv4 || + filter->ether_type == RTE_ETHER_TYPE_IPv6) { memset(filter, 0, sizeof(struct rte_eth_ethertype_filter)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -1705,7 +1705,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev, eth_spec = item->spec; /* Get the dst MAC. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { rule->ixgbe_fdir.formatted.inner_mac[j] = eth_spec->dst.addr_bytes[j]; } @@ -1734,7 +1734,7 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev, * src MAC address must be masked, * and don't support dst MAC address mask. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { if (eth_mask->src.addr_bytes[j] || eth_mask->dst.addr_bytes[j] != 0xFF) { memset(rule, 0, @@ -2660,7 +2660,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, } /* src MAC address should be masked. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { if (eth_mask->src.addr_bytes[j]) { memset(rule, 0, sizeof(struct ixgbe_fdir_rule)); @@ -2671,7 +2671,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, } } rule->mask.mac_addr_byte_mask = 0; - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { /* It's a per byte mask. */ if (eth_mask->dst.addr_bytes[j] == 0xFF) { rule->mask.mac_addr_byte_mask |= 0x1 << j; @@ -2692,7 +2692,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, eth_spec = item->spec; /* Get the dst MAC. */ - for (j = 0; j < ETHER_ADDR_LEN; j++) { + for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) { rule->ixgbe_fdir.formatted.inner_mac[j] = eth_spec->dst.addr_bytes[j]; } diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 37521af7c..646b3434c 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -40,7 +40,7 @@ dev_num_vf(struct rte_eth_dev *eth_dev) static inline int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) { - unsigned char vf_mac_addr[ETHER_ADDR_LEN]; + unsigned char vf_mac_addr[RTE_ETHER_ADDR_LEN]; struct ixgbe_vf_info *vfinfo = *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); uint16_t vfn; @@ -49,7 +49,7 @@ int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) rte_eth_random_addr(vf_mac_addr); /* keep the random address as default */ memcpy(vfinfo[vfn].vf_mac_addresses, vf_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } return 0; @@ -443,7 +443,7 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, ETHER_ADDR_LEN); + rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); /* * Piggyback the multicast filter type so VF can compute the * correct vectors @@ -546,7 +546,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t new_mtu = msgbuf[1]; uint32_t max_frs; - int max_frame = new_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + int max_frame = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; /* X540 and X550 support jumbo frames in IOV mode */ if (hw->mac.type != ixgbe_mac_X540 && @@ -555,7 +555,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms hw->mac.type != ixgbe_mac_X550EM_a) return -1; - if ((max_frame < ETHER_MIN_LEN) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) + if ((max_frame < RTE_ETHER_MIN_LEN) || (max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)) return -1; max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) & diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index e71d3c188..5b7953a7f 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2940,7 +2940,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx); rxq->port_id = dev->data->port_id; if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; rxq->drop_en = rx_conf->rx_drop_en; @@ -3965,7 +3965,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev, uint16_t max[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0}; uint8_t map[IXGBE_DCB_MAX_TRAFFIC_CLASS] = {0}; struct ixgbe_dcb_tc_config *tc; - uint32_t max_frame = dev->data->mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t max_frame = dev->data->mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ixgbe_bw_conf *bw_conf = @@ -4948,7 +4948,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) * call to configure. */ if (rx_conf->offloads & DEV_RX_OFFLOAD_KEEP_CRC) - rxq->crc_len = ETHER_CRC_LEN; + rxq->crc_len = RTE_ETHER_CRC_LEN; else rxq->crc_len = 0; diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 45fc3a4ad..12bf9b750 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -37,7 +37,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } @@ -154,7 +154,7 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint16_t port, uint16_t vf, uint16_t vlan_id) if (vf >= pci_dev->max_vfs) return -EINVAL; - if (vlan_id > ETHER_MAX_VLAN_ID) + if (vlan_id > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -476,7 +476,7 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint16_t port, uint16_t vlan, if (!is_ixgbe_supported(dev)) return -ENOTSUP; - if ((vlan > ETHER_MAX_VLAN_ID) || (vf_mask == 0)) + if ((vlan > RTE_ETHER_MAX_VLAN_ID) || (vf_mask == 0)) return -EINVAL; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 0e304fd00..d9fa28030 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -20,7 +20,7 @@ #define MAX_KNI_PORTS 8 #define KNI_ETHER_MTU(mbuf_size) \ - ((mbuf_size) - ETHER_HDR_LEN) /**< Ethernet MTU. */ + ((mbuf_size) - RTE_ETHER_HDR_LEN) /**< Ethernet MTU. */ #define ETH_KNI_NO_REQUEST_THREAD_ARG "no_request_thread" static const char * const valid_arguments[] = { diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index fea9f4922..5b0da7845 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -430,7 +430,7 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) { struct lio_device *lio_dev = LIO_DEV(eth_dev); uint16_t pf_mtu = lio_dev->linfo.link.s.mtu; - uint32_t frame_len = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t frame_len = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; struct lio_dev_ctrl_cmd ctrl_cmd; struct lio_ctrl_pkt ctrl_pkt; @@ -445,9 +445,9 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) /* check if VF MTU is within allowed range. * New value should not exceed PF MTU. */ - if ((mtu < ETHER_MIN_MTU) || (mtu > pf_mtu)) { + if ((mtu < RTE_ETHER_MIN_MTU) || (mtu > pf_mtu)) { lio_dev_err(lio_dev, "VF MTU should be >= %d and <= %d\n", - ETHER_MIN_MTU, pf_mtu); + RTE_ETHER_MIN_MTU, pf_mtu); return -EINVAL; } @@ -476,7 +476,7 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) return -1; } - if (frame_len > ETHER_MAX_LEN) + if (frame_len > RTE_ETHER_MAX_LEN) eth_dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else @@ -1429,9 +1429,9 @@ lio_dev_start(struct rte_eth_dev *eth_dev) goto dev_mtu_set_error; } - mtu = (uint16_t)(frame_len - ETHER_HDR_LEN - ETHER_CRC_LEN); - if (mtu < ETHER_MIN_MTU) - mtu = ETHER_MIN_MTU; + mtu = (uint16_t)(frame_len - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN); + if (mtu < RTE_ETHER_MIN_MTU) + mtu = RTE_ETHER_MIN_MTU; if (eth_dev->data->mtu != mtu) { ret = lio_dev_mtu_set(eth_dev, mtu); @@ -1712,7 +1712,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) struct lio_device *lio_dev = LIO_DEV(eth_dev); uint16_t timeout = LIO_MAX_CMD_TIMEOUT; int retval, num_iqueues, num_oqueues; - uint8_t mac[ETHER_ADDR_LEN], i; + uint8_t mac[RTE_ETHER_ADDR_LEN], i; struct lio_if_cfg_resp *resp; struct lio_soft_command *sc; union lio_if_cfg if_cfg; @@ -1830,7 +1830,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) /* 64-bit swap required on LE machines */ lio_swap_8B_data(&lio_dev->linfo.hw_addr, 1); - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) mac[i] = *((uint8_t *)(((uint8_t *)&lio_dev->linfo.hw_addr) + 2 + i)); @@ -2089,7 +2089,7 @@ lio_eth_dev_init(struct rte_eth_dev *eth_dev) } eth_dev->dev_ops = &liovf_eth_dev_ops; - eth_dev->data->mac_addrs = rte_zmalloc("lio", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("lio", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { lio_dev_err(lio_dev, "MAC addresses memory allocation failed\n"); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 01678df2d..547fbd541 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -1073,7 +1073,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) priv->device_attr = device_attr; priv->port = port; priv->pd = pd; - priv->mtu = ETHER_MTU; + priv->mtu = RTE_ETHER_MTU; priv->vf = vf; priv->hw_csum = !!(device_attr.device_cap_flags & IBV_DEVICE_RAW_IP_CSUM); diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 13e1b31e2..eb3c02269 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -201,7 +201,7 @@ struct mlx4_priv { /* mlx4_ethdev.c */ int mlx4_get_ifname(const struct mlx4_priv *priv, char (*ifname)[IF_NAMESIZE]); -int mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]); +int mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]); int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t *mtu); int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); int mlx4_dev_set_link_down(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 20715390e..7b70f4587 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -176,14 +176,14 @@ mlx4_ifreq(const struct mlx4_priv *priv, int req, struct ifreq *ifr) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]) +mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]) { struct ifreq request; int ret = mlx4_ifreq(priv, SIOCGIFHWADDR, &request); if (ret) return ret; - memcpy(mac, request.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); return 0; } diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 9c87694a2..7c554daeb 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -225,7 +225,7 @@ mlx4_flow_merge_eth(struct rte_flow *flow, goto error; } flow->allmulti = 1; - } else if (sum_dst != (UINT8_C(0xff) * ETHER_ADDR_LEN)) { + } else if (sum_dst != (UINT8_C(0xff) * RTE_ETHER_ADDR_LEN)) { msg = "mlx4 does not support matching partial" " Ethernet fields"; goto error; @@ -253,10 +253,10 @@ mlx4_flow_merge_eth(struct rte_flow *flow, flow->promisc = 1; return 0; } - memcpy(eth->val.dst_mac, spec->dst.addr_bytes, ETHER_ADDR_LEN); - memcpy(eth->mask.dst_mac, mask->dst.addr_bytes, ETHER_ADDR_LEN); + memcpy(eth->val.dst_mac, spec->dst.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(eth->mask.dst_mac, mask->dst.addr_bytes, RTE_ETHER_ADDR_LEN); /* Remove unwanted bits from values. */ - for (i = 0; i < ETHER_ADDR_LEN; ++i) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) { eth->val.dst_mac[i] &= eth->mask.dst_mac[i]; } return 0; diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index f22f1ba55..6ca4e5c02 100644 --- a/drivers/net/mlx4/mlx4_rxtx.c +++ b/drivers/net/mlx4/mlx4_rxtx.c @@ -1281,7 +1281,7 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) pkt->ol_flags = PKT_RX_RSS_HASH; pkt->hash.rss = cqe->immed_rss_invalid; if (rxq->crc_present) - len -= ETHER_CRC_LEN; + len -= RTE_ETHER_CRC_LEN; pkt->pkt_len = len; if (rxq->csum | rxq->csum_l2tun) { uint32_t flags = diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 194c87aae..801274c18 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1335,7 +1335,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } priv->sh = sh; priv->ibv_port = spawn->ibv_port; - priv->mtu = ETHER_MTU; + priv->mtu = RTE_ETHER_MTU; #ifndef RTE_ARCH_64 /* Initialize UAR access locks for 32bit implementations. */ rte_spinlock_init(&priv->uar_lock_cq); diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index d9d3179df..01bde9a90 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -401,7 +401,7 @@ bool mlx5_translate_port_name(const char *port_name_in, /* mlx5_mac.c */ -int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN]); +int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]); void mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq); diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index fbcb2880b..8110e9e3e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1086,7 +1086,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, (void *)items->type, "eth header not found"); if (!eth->ether_type) - eth->ether_type = RTE_BE16(ETHER_TYPE_VLAN); + eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: ipv4 = (struct ipv4_hdr *)&buf[temp_size]; @@ -1097,9 +1097,9 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, "neither eth nor vlan" " header found"); if (vlan && !vlan->eth_proto) - vlan->eth_proto = RTE_BE16(ETHER_TYPE_IPv4); + vlan->eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPv4); else if (eth && !eth->ether_type) - eth->ether_type = RTE_BE16(ETHER_TYPE_IPv4); + eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_IPv4); if (!ipv4->version_ihl) ipv4->version_ihl = MLX5_ENCAP_IPV4_VERSION | MLX5_ENCAP_IPV4_IHL_MIN; @@ -1115,9 +1115,9 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, "neither eth nor vlan" " header found"); if (vlan && !vlan->eth_proto) - vlan->eth_proto = RTE_BE16(ETHER_TYPE_IPv6); + vlan->eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPv6); else if (eth && !eth->ether_type) - eth->ether_type = RTE_BE16(ETHER_TYPE_IPv6); + eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_IPv6); if (!ipv6->vtc_flow) ipv6->vtc_flow = RTE_BE32(MLX5_ENCAP_IPV6_VTC_FLOW); @@ -2779,7 +2779,7 @@ flow_dv_translate_item_mpls(void *matcher, void *key, case MLX5_FLOW_LAYER_GRE: MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, 0xffff); MLX5_SET(fte_match_set_misc, misc_v, gre_protocol, - ETHER_TYPE_MPLS); + RTE_ETHER_TYPE_MPLS); break; default: MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 938f68c19..595c13e1f 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -707,7 +707,7 @@ flow_tcf_pedit_key_set_mac(const struct rte_flow_action *actions, p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_SET; memcpy(&p_parser->keys[idx].val, conf->mac_addr + SZ_PEDIT_KEY_VAL, - ETHER_ADDR_LEN - SZ_PEDIT_KEY_VAL); + RTE_ETHER_ADDR_LEN - SZ_PEDIT_KEY_VAL); p_parser->sel.nkeys = (++idx); } @@ -984,11 +984,11 @@ flow_tcf_get_pedit_actions_size(const struct rte_flow_action **actions, flags |= MLX5_FLOW_ACTION_DEC_TTL; break; case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC: - keys += NUM_OF_PEDIT_KEYS(ETHER_ADDR_LEN); + keys += NUM_OF_PEDIT_KEYS(RTE_ETHER_ADDR_LEN); flags |= MLX5_FLOW_ACTION_SET_MAC_SRC; break; case RTE_FLOW_ACTION_TYPE_SET_MAC_DST: - keys += NUM_OF_PEDIT_KEYS(ETHER_ADDR_LEN); + keys += NUM_OF_PEDIT_KEYS(RTE_ETHER_ADDR_LEN); flags |= MLX5_FLOW_ACTION_SET_MAC_DST; break; default: @@ -2521,7 +2521,7 @@ flow_tcf_get_items_size(const struct rte_flow_attr *attr, case RTE_FLOW_ITEM_TYPE_PORT_ID: break; case RTE_FLOW_ITEM_TYPE_ETH: - size += SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) * 4; + size += SZ_NLATTR_DATA_OF(RTE_ETHER_ADDR_LEN) * 4; /* dst/src MAC addr and mask. */ break; case RTE_FLOW_ITEM_TYPE_VLAN: @@ -3336,18 +3336,18 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, } if (!rte_is_zero_ether_addr(&mask.eth->dst)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, spec.eth->dst.addr_bytes); mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST_MASK, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, mask.eth->dst.addr_bytes); } if (!rte_is_zero_ether_addr(&mask.eth->src)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, spec.eth->src.addr_bytes); mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC_MASK, - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, mask.eth->src.addr_bytes); } assert(dev_flow->tcf.nlsize >= nlh->nlmsg_len); @@ -4395,7 +4395,7 @@ flow_tcf_collect_neigh_cb(const struct nlmsghdr *nlh, void *arg) /* Neigh rule with permenent attribute found. */ size = MNL_ALIGN(sizeof(struct nlmsghdr)) + MNL_ALIGN(sizeof(struct ndmsg)) + - SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) + + SZ_NLATTR_DATA_OF(RTE_ETHER_ADDR_LEN) + (family == AF_INET6 ? SZ_NLATTR_DATA_OF(IPV6_ADDR_LEN) : SZ_NLATTR_TYPE_OF(uint32_t)); cmd = flow_tcf_alloc_nlcmd(ctx, size); @@ -4419,7 +4419,7 @@ flow_tcf_collect_neigh_cb(const struct nlmsghdr *nlh, void *arg) mnl_attr_put(cmd, NDA_DST, IPV6_ADDR_LEN, mnl_attr_get_payload(na_ip)); } - mnl_attr_put(cmd, NDA_LLADDR, ETHER_ADDR_LEN, + mnl_attr_put(cmd, NDA_LLADDR, RTE_ETHER_ADDR_LEN, mnl_attr_get_payload(na_mac)); assert(size == cmd->nlmsg_len); return 1; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 49dd13e6d..252febf35 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -290,14 +290,14 @@ flow_verbs_translate_item_eth(struct mlx5_flow *dev_flow, if (spec) { unsigned int i; - memcpy(ð.val.dst_mac, spec->dst.addr_bytes, ETHER_ADDR_LEN); - memcpy(ð.val.src_mac, spec->src.addr_bytes, ETHER_ADDR_LEN); + memcpy(ð.val.dst_mac, spec->dst.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(ð.val.src_mac, spec->src.addr_bytes, RTE_ETHER_ADDR_LEN); eth.val.ether_type = spec->type; - memcpy(ð.mask.dst_mac, mask->dst.addr_bytes, ETHER_ADDR_LEN); - memcpy(ð.mask.src_mac, mask->src.addr_bytes, ETHER_ADDR_LEN); + memcpy(ð.mask.dst_mac, mask->dst.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(ð.mask.src_mac, mask->src.addr_bytes, RTE_ETHER_ADDR_LEN); eth.mask.ether_type = mask->type; /* Remove unwanted bits from values. */ - for (i = 0; i < ETHER_ADDR_LEN; ++i) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) { eth.val.dst_mac[i] &= eth.mask.dst_mac[i]; eth.val.src_mac[i] &= eth.mask.src_mac[i]; } diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 9204c5f52..0ffef5c5d 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -44,7 +44,7 @@ * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN]) +mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]) { struct ifreq request; int ret; @@ -52,7 +52,7 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[ETHER_ADDR_LEN]) ret = mlx5_ifreq(dev, SIOCGIFHWADDR, &request); if (ret) return ret; - memcpy(mac, request.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); return 0; } diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index 19b4e346f..94efbf2a0 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -344,7 +344,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], - RTA_DATA(attribute), ETHER_ADDR_LEN); + RTA_DATA(attribute), RTE_ETHER_ADDR_LEN); } } return 0; @@ -433,7 +433,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, struct nlmsghdr hdr; struct ndmsg ndm; struct rtattr rta; - uint8_t buffer[ETHER_ADDR_LEN]; + uint8_t buffer[RTE_ETHER_ADDR_LEN]; } req = { .hdr = { .nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)), @@ -449,7 +449,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, }, .rta = { .rta_type = NDA_LLADDR, - .rta_len = RTA_LENGTH(ETHER_ADDR_LEN), + .rta_len = RTA_LENGTH(RTE_ETHER_ADDR_LEN), }, }; int fd; @@ -459,7 +459,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, if (priv->nl_socket_route == -1) return 0; fd = priv->nl_socket_route; - memcpy(RTA_DATA(&req.rta), mac, ETHER_ADDR_LEN); + memcpy(RTA_DATA(&req.rta), mac, RTE_ETHER_ADDR_LEN); req.hdr.nlmsg_len = NLMSG_ALIGN(req.hdr.nlmsg_len) + RTA_ALIGN(req.rta.rta_len); ret = mlx5_nl_send(fd, &req.hdr, sn); diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 3da3f62fa..7174ffc91 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -632,7 +632,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n) if (buf->ol_flags & PKT_TX_VLAN_PKT) { uint32_t vlan = rte_cpu_to_be_32(0x81000000 | buf->vlan_tci); - unsigned int len = 2 * ETHER_ADDR_LEN - 2; + unsigned int len = 2 * RTE_ETHER_ADDR_LEN - 2; addr += 2; length -= 2; @@ -2058,7 +2058,7 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) mcqe->rx_hash_result); rxq_cq_to_mbuf(rxq, pkt, cqe, rss_hash_res); if (rxq->crc_present) - len -= ETHER_CRC_LEN; + len -= RTE_ETHER_CRC_LEN; PKT_LEN(pkt) = len; } DATA_LEN(rep) = DATA_LEN(seg); @@ -2264,7 +2264,7 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) len = (byte_cnt & MLX5_MPRQ_LEN_MASK) >> MLX5_MPRQ_LEN_SHIFT; assert((int)len >= (rxq->crc_present << 2)); if (rxq->crc_present) - len -= ETHER_CRC_LEN; + len -= RTE_ETHER_CRC_LEN; offset = strd_idx * strd_sz + strd_shift; addr = RTE_PTR_ADD(mlx5_mprq_buf_addr(buf), offset); /* Initialize the offload flag. */ diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h index 38e915c5c..b2cc71088 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -379,7 +379,7 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, }; /* Restore the compressed count. Must be 16 bits. */ const uint16_t mcqe_n = t_pkt->data_len + - (rxq->crc_present * ETHER_CRC_LEN); + (rxq->crc_present * RTE_ETHER_CRC_LEN); const uint64x2_t rearm = vld1q_u64((void *)&t_pkt->rearm_data); const uint32x4_t rxdf_mask = { @@ -393,8 +393,8 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, vreinterpretq_u8_u32(rxdf_mask)); const uint16x8_t crc_adj = { 0, 0, - rxq->crc_present * ETHER_CRC_LEN, 0, - rxq->crc_present * ETHER_CRC_LEN, 0, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0, 0 }; const uint32_t flow_tag = t_pkt->hash.fdir.hi; @@ -717,7 +717,7 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n, 12, 13, 14, -1 /* 1st CQE */ }; const uint16x8_t crc_adj = { - 0, 0, rxq->crc_present * ETHER_CRC_LEN, 0, 0, 0, 0, 0 + 0, 0, rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0, 0, 0, 0 }; const uint32x4_t flow_mark_adj = { 0, 0, 0, rxq->mark * (-1) }; diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h index fb384efde..dce3ee4b4 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -374,16 +374,16 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, -1, -1, -1, -1 /* skip packet_type */); /* Restore the compressed count. Must be 16 bits. */ const uint16_t mcqe_n = t_pkt->data_len + - (rxq->crc_present * ETHER_CRC_LEN); + (rxq->crc_present * RTE_ETHER_CRC_LEN); const __m128i rearm = _mm_loadu_si128((__m128i *)&t_pkt->rearm_data); const __m128i rxdf = _mm_loadu_si128((__m128i *)&t_pkt->rx_descriptor_fields1); const __m128i crc_adj = _mm_set_epi16(0, 0, 0, - rxq->crc_present * ETHER_CRC_LEN, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, - rxq->crc_present * ETHER_CRC_LEN, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, 0); const uint32_t flow_tag = t_pkt->hash.fdir.hi; #ifdef MLX5_PMD_SOFT_COUNTERS @@ -699,9 +699,9 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, uint16_t pkts_n, const __m128i ones = _mm_cmpeq_epi32(zero, zero); const __m128i crc_adj = _mm_set_epi16(0, 0, 0, 0, 0, - rxq->crc_present * ETHER_CRC_LEN, + rxq->crc_present * RTE_ETHER_CRC_LEN, 0, - rxq->crc_present * ETHER_CRC_LEN); + rxq->crc_present * RTE_ETHER_CRC_LEN); const __m128i flow_mark_adj = _mm_set_epi32(rxq->mark * (-1), 0, 0, 0); assert(rxq->sges_n == 0); diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index d8a6b50b0..7fca9a125 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -343,7 +343,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) continue; memcpy(&unicast.dst.addr_bytes, mac->addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); for (j = 0; j != vlan_filter_n; ++j) { uint16_t vlan = priv->vlan_filter[j]; diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 9ec71c3c1..965744406 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -261,7 +261,7 @@ mvneta_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) mbuf_data_size, mtu, mru); } - if (mtu < ETHER_MIN_MTU || mru > MVNETA_PKT_SIZE_MAX) { + if (mtu < RTE_ETHER_MIN_MTU || mru > MVNETA_PKT_SIZE_MAX) { MVNETA_LOG(ERR, "Invalid MTU [%u] or MRU [%u]", mtu, mru); return -EINVAL; } @@ -586,7 +586,7 @@ static void mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct mvneta_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (!priv->ppio) @@ -621,7 +621,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct mvneta_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (index == 0) @@ -660,7 +660,7 @@ mvneta_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = neta_ppio_set_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to set mac to %s", buf); } @@ -794,7 +794,7 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name) eth_dev->data->mac_addrs = rte_zmalloc("mac_addrs", - ETHER_ADDR_LEN * MVNETA_MAC_ADDRS_MAX, 0); + RTE_ETHER_ADDR_LEN * MVNETA_MAC_ADDRS_MAX, 0); if (!eth_dev->data->mac_addrs) { MVNETA_LOG(ERR, "Failed to allocate space for eth addrs"); ret = -ENOMEM; @@ -808,7 +808,7 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name) goto out_free; memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - req.ifr_addr.sa_data, ETHER_ADDR_LEN); + req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN); eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->device = &vdev->device; diff --git a/drivers/net/mvneta/mvneta_ethdev.h b/drivers/net/mvneta/mvneta_ethdev.h index 101b0a817..c39d15eec 100644 --- a/drivers/net/mvneta/mvneta_ethdev.h +++ b/drivers/net/mvneta/mvneta_ethdev.h @@ -46,7 +46,7 @@ #define MRVL_NETA_RXD_ALIGN 32 #define MRVL_NETA_VLAN_TAG_LEN 4 -#define MRVL_NETA_ETH_HDRS_LEN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ +#define MRVL_NETA_ETH_HDRS_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \ MRVL_NETA_VLAN_TAG_LEN) #define MRVL_NETA_HDRS_LEN (MV_MH_SIZE + MRVL_NETA_ETH_HDRS_LEN) diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 4c6edb41d..d1d0d4186 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -448,7 +448,7 @@ mrvl_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) mbuf_data_size, mtu, mru); } - if (mtu < ETHER_MIN_MTU || mru > MRVL_PKT_SIZE_MAX) { + if (mtu < RTE_ETHER_MIN_MTU || mru > MRVL_PKT_SIZE_MAX) { MRVL_LOG(ERR, "Invalid MTU [%u] or MRU [%u]", mtu, mru); return -EINVAL; } @@ -1068,7 +1068,7 @@ static void mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct mrvl_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (!priv->ppio) @@ -1106,7 +1106,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct mrvl_priv *priv = dev->data->dev_private; - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; int ret; if (priv->isolated) @@ -1167,7 +1167,7 @@ mrvl_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = pp2_ppio_set_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to set mac to %s", buf); } @@ -2787,7 +2787,7 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name) eth_dev->data->mac_addrs = rte_zmalloc("mac_addrs", - ETHER_ADDR_LEN * MRVL_MAC_ADDRS_MAX, 0); + RTE_ETHER_ADDR_LEN * MRVL_MAC_ADDRS_MAX, 0); if (!eth_dev->data->mac_addrs) { MRVL_LOG(ERR, "Failed to allocate space for eth addrs"); ret = -ENOMEM; @@ -2801,7 +2801,7 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name) goto out_free; memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - req.ifr_addr.sa_data, ETHER_ADDR_LEN); + req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN); eth_dev->data->kdrv = RTE_KDRV_NONE; eth_dev->device = &vdev->device; diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h index 0120b9e8a..7bc450c41 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.h +++ b/drivers/net/mvpp2/mrvl_ethdev.h @@ -73,7 +73,7 @@ #define MRVL_PP2_BUF_RELEASE_BURST_SIZE 64 #define MRVL_PP2_VLAN_TAG_LEN 4 -#define MRVL_PP2_ETH_HDRS_LEN (ETHER_HDR_LEN + ETHER_CRC_LEN + \ +#define MRVL_PP2_ETH_HDRS_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + \ (2 * MRVL_PP2_VLAN_TAG_LEN)) #define MRVL_PP2_HDRS_LEN (MV_MH_SIZE + MRVL_PP2_ETH_HDRS_LEN) #define MRVL_PP2_MTU_TO_MRU(mtu) ((mtu) + MRVL_PP2_HDRS_LEN) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index dadff166e..863053d99 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -762,7 +762,7 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) if (!hv->primary) return -ENOMEM; - err = hn_attach(hv, ETHER_MTU); + err = hn_attach(hv, RTE_ETHER_MTU); if (err) goto failed; diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c index d58770e04..6b518685a 100644 --- a/drivers/net/netvsc/hn_nvs.c +++ b/drivers/net/netvsc/hn_nvs.c @@ -323,7 +323,7 @@ hn_nvs_conf_ndis(struct hn_data *hv, unsigned int mtu) memset(&conf, 0, sizeof(conf)); conf.type = NVS_TYPE_NDIS_CONF; - conf.mtu = mtu + ETHER_HDR_LEN; + conf.mtu = mtu + RTE_ETHER_HDR_LEN; conf.caps = NVS_NDIS_CONF_VLAN; /* enable SRIOV */ diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c index 0134ecb67..4a1d49ffc 100644 --- a/drivers/net/netvsc/hn_rndis.c +++ b/drivers/net/netvsc/hn_rndis.c @@ -1093,7 +1093,7 @@ hn_rndis_get_eaddr(struct hn_data *hv, uint8_t *eaddr) uint32_t eaddr_len; int error; - eaddr_len = ETHER_ADDR_LEN; + eaddr_len = RTE_ETHER_ADDR_LEN; error = hn_rndis_query(hv, OID_802_3_PERMANENT_ADDRESS, NULL, 0, eaddr, eaddr_len); if (error) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index ef5abd37b..b8ed7b18c 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -100,7 +100,7 @@ struct hn_txdesc { /* Minimum space required for a packet */ #define HN_PKTSIZE_MIN(align) \ - RTE_ALIGN(ETHER_MIN_LEN + HN_RNDIS_PKT_LEN, align) + RTE_ALIGN(RTE_ETHER_MIN_LEN + HN_RNDIS_PKT_LEN, align) #define DEFAULT_TX_FREE_THRESH 32U @@ -606,7 +606,7 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq, if (unlikely(data_off + data_len > pkt->len)) goto error; - if (unlikely(data_len < ETHER_HDR_LEN)) + if (unlikely(data_len < RTE_ETHER_HDR_LEN)) goto error; hn_rxpkt(rxq, rxb, data, data_off, data_len, &info); diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index a54243392..5c7814a12 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1213,7 +1213,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues; dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues; - dev_info->min_rx_bufsize = ETHER_MIN_MTU; + dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU; dev_info->max_rx_pktlen = hw->max_mtu; /* Next should change when PF support is implemented */ dev_info->max_mac_addrs = 1; @@ -1486,7 +1486,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); /* check that mtu is within the allowed range */ - if ((mtu < ETHER_MIN_MTU) || ((uint32_t)mtu > hw->max_mtu)) + if ((mtu < RTE_ETHER_MIN_MTU) || ((uint32_t)mtu > hw->max_mtu)) return -EINVAL; /* mtu setting is forbidden if port is started */ @@ -1497,7 +1497,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } /* switch to jumbo mode if needed */ - if ((uint32_t)mtu > ETHER_MAX_LEN) + if ((uint32_t)mtu > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -2905,7 +2905,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); - hw->mtu = ETHER_MTU; + hw->mtu = RTE_ETHER_MTU; /* VLAN insertion is incompatible with LSOv2 */ if (hw->cap & NFP_NET_CFG_CTRL_LSO2) @@ -2948,7 +2948,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) rte_spinlock_init(&hw->reconfig_lock); /* Allocating memory for mac addr */ - eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to space for MAC address"); err = -ENOMEM; diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h index 7913a29c2..9e2032698 100644 --- a/drivers/net/nfp/nfp_net_pmd.h +++ b/drivers/net/nfp/nfp_net_pmd.h @@ -436,7 +436,7 @@ struct nfp_net_hw { #endif #endif - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* Records starting point for counters */ struct rte_eth_stats eth_stats_base; diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 643479254..1055f3702 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -142,7 +142,7 @@ octeontx_port_open(struct octeontx_nic *nic) nic->mcast_mode = bgx_port_conf.mcast_mode; nic->speed = bgx_port_conf.mode; - memcpy(&nic->mac_addr[0], &bgx_port_conf.macaddr[0], ETHER_ADDR_LEN); + memcpy(&nic->mac_addr[0], &bgx_port_conf.macaddr[0], RTE_ETHER_ADDR_LEN); octeontx_log_dbg("port opened %d", nic->port_id); return res; @@ -1064,7 +1064,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, data->all_multicast = 0; data->scattered_rx = 0; - data->mac_addrs = rte_zmalloc_socket(octtx_name, ETHER_ADDR_LEN, 0, + data->mac_addrs = rte_zmalloc_socket(octtx_name, RTE_ETHER_ADDR_LEN, 0, socket_id); if (data->mac_addrs == NULL) { octeontx_log_err("failed to allocate memory for mac_addrs"); @@ -1085,7 +1085,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, } /* Update port_id mac to eth_dev */ - memcpy(data->mac_addrs, nic->mac_addr, ETHER_ADDR_LEN); + memcpy(data->mac_addrs, nic->mac_addr, RTE_ETHER_ADDR_LEN); PMD_INIT_LOG(DEBUG, "ethdev info: "); PMD_INIT_LOG(DEBUG, "port %d, port_ena %d ochan %d num_ochan %d tx_q %d", diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h index 2a4a08afc..fd2e99edf 100644 --- a/drivers/net/octeontx/octeontx_ethdev.h +++ b/drivers/net/octeontx/octeontx_ethdev.h @@ -62,7 +62,7 @@ struct octeontx_nic { uint8_t duplex; uint8_t speed; uint16_t mtu; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* Rx port parameters */ struct { bool classifier_enable; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 7655b3a7a..10277b9b6 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -28,7 +28,7 @@ #include #define RTE_ETH_PCAP_SNAPSHOT_LEN 65535 -#define RTE_ETH_PCAP_SNAPLEN ETHER_MAX_JUMBO_FRAME_LEN +#define RTE_ETH_PCAP_SNAPLEN RTE_ETHER_MAX_JUMBO_FRAME_LEN #define RTE_ETH_PCAP_PROMISC 1 #define RTE_ETH_PCAP_TIMEOUT -1 @@ -287,7 +287,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) pcap_dump((u_char *)dumper, &header, rte_pktmbuf_mtod(mbuf, void*)); } else { - if (mbuf->pkt_len <= ETHER_MAX_JUMBO_FRAME_LEN) { + if (mbuf->pkt_len <= RTE_ETHER_MAX_JUMBO_FRAME_LEN) { eth_pcap_gather_data(tx_pcap_data, mbuf); pcap_dump((u_char *)dumper, &header, tx_pcap_data); @@ -295,7 +295,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) PMD_LOG(ERR, "Dropping PCAP packet. Size (%d) > max jumbo size (%d).", mbuf->pkt_len, - ETHER_MAX_JUMBO_FRAME_LEN); + RTE_ETHER_MAX_JUMBO_FRAME_LEN); rte_pktmbuf_free(mbuf); break; @@ -349,7 +349,7 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_pktmbuf_mtod(mbuf, u_char *), mbuf->pkt_len); } else { - if (mbuf->pkt_len <= ETHER_MAX_JUMBO_FRAME_LEN) { + if (mbuf->pkt_len <= RTE_ETHER_MAX_JUMBO_FRAME_LEN) { eth_pcap_gather_data(tx_pcap_data, mbuf); ret = pcap_sendpacket(pcap, tx_pcap_data, mbuf->pkt_len); @@ -357,7 +357,7 @@ eth_pcap_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) PMD_LOG(ERR, "Dropping PCAP packet. Size (%d) > max jumbo size (%d).", mbuf->pkt_len, - ETHER_MAX_JUMBO_FRAME_LEN); + RTE_ETHER_MAX_JUMBO_FRAME_LEN); rte_pktmbuf_free(mbuf); break; @@ -993,7 +993,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, return -1; } - mac_addrs = rte_zmalloc_socket(NULL, ETHER_ADDR_LEN, 0, numa_node); + mac_addrs = rte_zmalloc_socket(NULL, RTE_ETHER_ADDR_LEN, 0, numa_node); if (!mac_addrs) { close(if_fd); return -1; @@ -1002,7 +1002,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, PMD_LOG(INFO, "Setting phy MAC for %s", if_name); eth_dev->data->mac_addrs = mac_addrs; rte_memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(if_fd); @@ -1040,7 +1040,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, ifm = (struct if_msghdr *)buf; sdl = (struct sockaddr_dl *)(ifm + 1); - mac_addrs = rte_zmalloc_socket(NULL, ETHER_ADDR_LEN, 0, numa_node); + mac_addrs = rte_zmalloc_socket(NULL, RTE_ETHER_ADDR_LEN, 0, numa_node); if (!mac_addrs) { rte_free(buf); return -1; @@ -1049,7 +1049,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, PMD_LOG(INFO, "Setting phy MAC for %s", if_name); eth_dev->data->mac_addrs = mac_addrs; rte_memcpy(eth_dev->data->mac_addrs[0].addr_bytes, - LLADDR(sdl), ETHER_ADDR_LEN); + LLADDR(sdl), RTE_ETHER_ADDR_LEN); rte_free(buf); diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 1abf44fa7..ec918c8ac 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -332,7 +332,7 @@ u32 qede_find_first_zero_bit(unsigned long *, u32); qede_find_first_zero_bit(bitmap, length) #define OSAL_BUILD_BUG_ON(cond) nothing -#define ETH_ALEN ETHER_ADDR_LEN +#define ETH_ALEN RTE_ETHER_ADDR_LEN #define OSAL_BITMAP_WEIGHT(bitmap, count) 0 diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index d7e1d7b32..434a8b96a 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -3656,9 +3656,9 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev, &p_dev->mf_bits))) { if (OSAL_TEST_BIT(ECORE_MF_8021Q_TAGGING, &p_dev->mf_bits)) - ether_type = ETHER_TYPE_VLAN; + ether_type = RTE_ETHER_TYPE_VLAN; else - ether_type = ETHER_TYPE_QINQ; + ether_type = RTE_ETHER_TYPE_QINQ; STORE_RT_REG(p_hwfn, PRS_REG_TAG_ETHERTYPE_0_RT_OFFSET, ether_type); STORE_RT_REG(p_hwfn, NIG_REG_TAG_ETHERTYPE_0_RT_OFFSET, diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 243c6974e..62303509f 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -565,7 +565,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, if (add) { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, - ETHER_ADDR_LEN) == 0) && + RTE_ETHER_ADDR_LEN) == 0) && ucast->vni == tmp->vni && ucast->vlan == tmp->vlan) { DP_INFO(edev, "Unicast MAC is already added" @@ -588,7 +588,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } else { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, - ETHER_ADDR_LEN) == 0) && + RTE_ETHER_ADDR_LEN) == 0) && ucast->vlan == tmp->vlan && ucast->vni == tmp->vni) break; @@ -1214,7 +1214,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) eth_dev->data->mtu = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN - QEDE_ETH_OVERHEAD; + RTE_ETHER_HDR_LEN - QEDE_ETH_OVERHEAD; if (rxmode->offloads & DEV_RX_OFFLOAD_SCATTER) eth_dev->data->scattered_rx = 1; @@ -2229,9 +2229,9 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) qede_dev_info_get(dev, &dev_info); max_rx_pkt_len = mtu + QEDE_MAX_ETHER_HDR_LEN; frame_size = max_rx_pkt_len; - if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) { + if ((mtu < RTE_ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) { DP_ERR(edev, "MTU %u out of range, %u is maximum allowable\n", - mtu, dev_info.max_rx_pktlen - ETHER_HDR_LEN - + mtu, dev_info.max_rx_pktlen - RTE_ETHER_HDR_LEN - QEDE_ETH_OVERHEAD); return -EINVAL; } @@ -2271,7 +2271,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) fp->rxq->rx_buf_size = rc; } } - if (max_rx_pkt_len > ETHER_MAX_LEN) + if (max_rx_pkt_len > RTE_ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -2405,7 +2405,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) struct qed_slowpath_params params; static bool do_once = true; uint8_t bulletin_change; - uint8_t vf_mac[ETHER_ADDR_LEN]; + uint8_t vf_mac[RTE_ETHER_ADDR_LEN]; uint8_t is_mac_forced; bool is_mac_exist; /* Fix up ecore debug level */ @@ -2535,7 +2535,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) /* Allocate memory for storing MAC addr */ eth_dev->data->mac_addrs = rte_zmalloc(edev->name, - (ETHER_ADDR_LEN * + (RTE_ETHER_ADDR_LEN * adapter->dev_info.num_mac_filters), RTE_CACHE_LINE_SIZE); @@ -2591,7 +2591,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) SLIST_INIT(&adapter->vlan_list_head); SLIST_INIT(&adapter->uc_list_head); SLIST_INIT(&adapter->mc_list_head); - adapter->mtu = ETHER_MTU; + adapter->mtu = RTE_ETHER_MTU; adapter->vport_started = false; /* VF tunnel offloads is enabled by default in PF driver */ diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 27fbe538a..12c83f46d 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -221,7 +221,7 @@ qede_fdir_to_arfs_filter(struct rte_eth_dev *eth_dev, case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: /* fill the common ip header */ - arfs->tuple.eth_proto = ETHER_TYPE_IPv4; + arfs->tuple.eth_proto = RTE_ETHER_TYPE_IPv4; arfs->tuple.dst_ipv4 = input->flow.ip4_flow.dst_ip; arfs->tuple.src_ipv4 = input->flow.ip4_flow.src_ip; arfs->tuple.ip_proto = next_proto[input->flow_type]; @@ -237,7 +237,7 @@ qede_fdir_to_arfs_filter(struct rte_eth_dev *eth_dev, break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - arfs->tuple.eth_proto = ETHER_TYPE_IPv6; + arfs->tuple.eth_proto = RTE_ETHER_TYPE_IPv6; arfs->tuple.ip_proto = next_proto[input->flow_type]; rte_memcpy(arfs->tuple.dst_ipv6, &input->flow.ipv6_flow.dst_ip, @@ -473,7 +473,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, *ether_type = rte_cpu_to_be_16(arfs->tuple.eth_proto); switch (arfs->tuple.eth_proto) { - case ETHER_TYPE_IPv4: + case RTE_ETHER_TYPE_IPv4: ip = (struct ipv4_hdr *)raw_pkt; ip->version_ihl = QEDE_FDIR_IP_DEFAULT_VERSION_IHL; ip->total_length = sizeof(struct ipv4_hdr); @@ -506,7 +506,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, params->tcp = true; } break; - case ETHER_TYPE_IPv6: + case RTE_ETHER_TYPE_IPv6: ip6 = (struct ipv6_hdr *)raw_pkt; ip6->proto = arfs->tuple.ip_proto; ip6->vtc_flow = @@ -992,25 +992,25 @@ qede_set_ucast_tunn_cmn_param(struct ecore_filter_ucast *ucast, break; case ECORE_FILTER_MAC: memcpy(ucast->mac, conf->outer_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); break; case ECORE_FILTER_INNER_MAC: memcpy(ucast->mac, conf->inner_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); break; case ECORE_FILTER_MAC_VNI_PAIR: memcpy(ucast->mac, conf->outer_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ucast->vni = conf->tenant_id; break; case ECORE_FILTER_INNER_MAC_VNI_PAIR: memcpy(ucast->mac, conf->inner_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ucast->vni = conf->tenant_id; break; case ECORE_FILTER_INNER_PAIR: memcpy(ucast->mac, conf->inner_mac.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); ucast->vlan = conf->inner_vlan; break; default: @@ -1266,7 +1266,7 @@ qede_flow_parse_pattern(__attribute__((unused))struct rte_eth_dev *dev, spec = pattern->spec; flow->entry.tuple.src_ipv4 = spec->hdr.src_addr; flow->entry.tuple.dst_ipv4 = spec->hdr.dst_addr; - flow->entry.tuple.eth_proto = ETHER_TYPE_IPv4; + flow->entry.tuple.eth_proto = RTE_ETHER_TYPE_IPv4; } break; @@ -1283,7 +1283,7 @@ qede_flow_parse_pattern(__attribute__((unused))struct rte_eth_dev *dev, rte_memcpy(flow->entry.tuple.dst_ipv6, spec->hdr.dst_addr, IPV6_ADDR_LEN); - flow->entry.tuple.eth_proto = ETHER_TYPE_IPv6; + flow->entry.tuple.eth_proto = RTE_ETHER_TYPE_IPv6; } break; diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index b840c743c..02feaba16 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -17,7 +17,7 @@ enum ecore_int_mode; struct qed_dev_info { uint8_t num_hwfns; - uint8_t hw_mac[ETHER_ADDR_LEN]; + uint8_t hw_mac[RTE_ETHER_ADDR_LEN]; bool is_mf_default; /* FW version */ diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index ec6190b11..8a108f99c 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -369,7 +369,7 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info) dev_info->dev_type = edev->type; rte_memcpy(&dev_info->hw_mac, &edev->hwfns[0].hw_info.hw_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); dev_info->fw_major = FW_MAJOR_VERSION; dev_info->fw_minor = FW_MINOR_VERSION; @@ -434,7 +434,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info) max_vf_vlan_filters; rte_memcpy(&info->port_mac, &edev->hwfns[0].hw_info.hw_mac_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); } else { ecore_vf_get_num_rxqs(ECORE_LEADING_HWFN(edev), &info->num_queues); @@ -455,7 +455,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info) qed_fill_dev_info(edev, &info->common); if (IS_VF(edev)) - memset(&info->common.hw_mac, 0, ETHER_ADDR_LEN); + memset(&info->common.hw_mac, 0, RTE_ETHER_ADDR_LEN); return 0; } diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 0e8a3675b..235f78ae3 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -963,21 +963,21 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) ethertype = rte_cpu_to_be_16(eth_hdr->ether_type); /* Note: Valid only if VLAN stripping is disabled */ - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { vlan_tagged = 1; vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); len += sizeof(struct rte_vlan_hdr); ethertype = rte_cpu_to_be_16(vlan_hdr->eth_proto); } - if (ethertype == ETHER_TYPE_IPv4) { + if (ethertype == RTE_ETHER_TYPE_IPv4) { packet_type |= RTE_PTYPE_L3_IPV4; ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len); if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) packet_type |= RTE_PTYPE_L4_UDP; - } else if (ethertype == ETHER_TYPE_IPv6) { + } else if (ethertype == RTE_ETHER_TYPE_IPv6) { packet_type |= RTE_PTYPE_L3_IPV6; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len); if (ipv6_hdr->proto == IPPROTO_TCP) diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h index 5b249cbb2..41a5f0f5c 100644 --- a/drivers/net/qede/qede_rxtx.h +++ b/drivers/net/qede/qede_rxtx.h @@ -70,7 +70,7 @@ #define QEDE_ETH_OVERHEAD (((2 * QEDE_VLAN_TAG_SIZE)) \ + (QEDE_LLC_SNAP_HDR_LEN) + 2) -#define QEDE_MAX_ETHER_HDR_LEN (ETHER_HDR_LEN + QEDE_ETH_OVERHEAD) +#define QEDE_MAX_ETHER_HDR_LEN (RTE_ETHER_HDR_LEN + QEDE_ETH_OVERHEAD) #define QEDE_RSS_OFFLOAD_ALL (ETH_RSS_IPV4 |\ ETH_RSS_NONFRAG_IPV4_TCP |\ diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 3324194d5..8bd04659e 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -905,7 +905,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) * The driver does not use it, but other PMDs update jumbo frame * flag and max_rx_pkt_len when MTU is set. */ - if (mtu > ETHER_MAX_LEN) { + if (mtu > RTE_ETHER_MAX_LEN) { struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; } @@ -2057,7 +2057,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) sfc_log_init(sa, "entry"); - dev->data->mac_addrs = rte_zmalloc("sfc", ETHER_ADDR_LEN, 0); + dev->data->mac_addrs = rte_zmalloc("sfc", RTE_ETHER_ADDR_LEN, 0); if (dev->data->mac_addrs == NULL) { rc = ENOMEM; goto fail_mac_addrs; diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 26d7de91e..9927253ef 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -952,7 +952,7 @@ sfc_flow_parse_geneve(const struct rte_flow_item *item, return 0; if (mask->protocol == supp_mask.protocol) { - if (spec->protocol != rte_cpu_to_be_16(ETHER_TYPE_TEB)) { + if (spec->protocol != rte_cpu_to_be_16(RTE_ETHER_TYPE_TEB)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "GENEVE encap. protocol must be Ethernet " diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c index 7ea6eb4fa..dc15ec8aa 100644 --- a/drivers/net/softnic/parser.c +++ b/drivers/net/softnic/parser.c @@ -533,7 +533,7 @@ my_ether_aton(const char *a) { int i; char *end; - unsigned long o[ETHER_ADDR_LEN]; + unsigned long o[RTE_ETHER_ADDR_LEN]; static struct rte_ether_addr ether_addr; i = 0; @@ -550,14 +550,14 @@ my_ether_aton(const char *a) return NULL; /* Support the format XX:XX:XX:XX:XX:XX */ - if (i == ETHER_ADDR_LEN) { + if (i == RTE_ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) return NULL; ether_addr.addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ - } else if (i == ETHER_ADDR_LEN / 2) { + } else if (i == RTE_ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return NULL; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index df92a536c..bb0aee42d 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -565,9 +565,9 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs, char *buff_data = rte_pktmbuf_mtod(seg, void *); proto = (*buff_data & 0xf0); pi.proto = (proto == 0x40) ? - rte_cpu_to_be_16(ETHER_TYPE_IPv4) : + rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) : ((proto == 0x60) ? - rte_cpu_to_be_16(ETHER_TYPE_IPv6) : + rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) : 0x00); } @@ -657,7 +657,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) return 0; struct rte_mbuf *gso_mbufs[MAX_GSO_MBUFS]; - max_size = *txq->mtu + (ETHER_HDR_LEN + ETHER_CRC_LEN + 4); + max_size = *txq->mtu + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 4); for (i = 0; i < nb_pkts; i++) { struct rte_mbuf *mbuf_in = bufs[num_tx]; struct rte_mbuf **mbuf; @@ -677,7 +677,7 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* TCP segmentation implies TCP checksum offload */ mbuf_in->ol_flags |= PKT_TX_TCP_CKSUM; - /* gso size is calculated without ETHER_CRC_LEN */ + /* gso size is calculated without RTE_ETHER_CRC_LEN */ hdrs_len = mbuf_in->l2_len + mbuf_in->l3_len + mbuf_in->l4_len; tso_segsz = mbuf_in->tso_segsz + hdrs_len; @@ -924,7 +924,7 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->if_index = internals->if_index; dev_info->max_mac_addrs = 1; - dev_info->max_rx_pktlen = (uint32_t)ETHER_MAX_VLAN_FRAME_LEN; + dev_info->max_rx_pktlen = (uint32_t)RTE_ETHER_MAX_VLAN_FRAME_LEN; dev_info->max_rx_queues = RTE_PMD_TAP_MAX_QUEUES; dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES; dev_info->min_rx_bufsize = 0; @@ -1183,11 +1183,11 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; - rte_memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, ETHER_ADDR_LEN); + rte_memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, RTE_ETHER_ADDR_LEN); ret = tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 1, mode); if (ret < 0) return ret; - rte_memcpy(&pmd->eth_addr, mac_addr, ETHER_ADDR_LEN); + rte_memcpy(&pmd->eth_addr, mac_addr, RTE_ETHER_ADDR_LEN); if (pmd->remote_if_index && !pmd->flow_isolate) { /* Replace MAC redirection rule after a MAC change */ ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_LOCAL_MAC); @@ -1780,7 +1780,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, memset(&ifr, 0, sizeof(struct ifreq)); ifr.ifr_hwaddr.sa_family = AF_LOCAL; rte_memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) goto error_exit; } @@ -1835,7 +1835,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, goto error_remote; } rte_memcpy(&pmd->eth_addr, ifr.ifr_hwaddr.sa_data, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); /* The desired MAC is already in ifreq after SIOCGIFHWADDR. */ if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) { TAP_LOG(ERR, "%s: failed to get %s MAC address.", @@ -1994,8 +1994,8 @@ set_mac_type(const char *key __rte_unused, static int iface_idx; /* fixed mac = 00:64:74:61:70: */ - memcpy((char *)user_mac->addr_bytes, "\0dtap", ETHER_ADDR_LEN); - user_mac->addr_bytes[ETHER_ADDR_LEN - 1] = iface_idx++ + '0'; + memcpy((char *)user_mac->addr_bytes, "\0dtap", RTE_ETHER_ADDR_LEN); + user_mac->addr_bytes[RTE_ETHER_ADDR_LEN - 1] = iface_idx++ + '0'; goto success; } diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index 20963090c..7fd0bd7f7 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -538,17 +538,17 @@ tap_flow_create_eth(const struct rte_flow_item *item, void *data) return 0; msg = &flow->msg; if (!rte_is_zero_ether_addr(&mask->dst)) { - tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, + tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, RTE_ETHER_ADDR_LEN, &spec->dst.addr_bytes); tap_nlattr_add(&msg->nh, - TCA_FLOWER_KEY_ETH_DST_MASK, ETHER_ADDR_LEN, + TCA_FLOWER_KEY_ETH_DST_MASK, RTE_ETHER_ADDR_LEN, &mask->dst.addr_bytes); } if (!rte_is_zero_ether_addr(&mask->src)) { - tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, + tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, RTE_ETHER_ADDR_LEN, &spec->src.addr_bytes); tap_nlattr_add(&msg->nh, - TCA_FLOWER_KEY_ETH_SRC_MASK, ETHER_ADDR_LEN, + TCA_FLOWER_KEY_ETH_SRC_MASK, RTE_ETHER_ADDR_LEN, &mask->src.addr_bytes); } return 0; diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h index 6de07c708..a0bb0ba0a 100644 --- a/drivers/net/thunderx/base/nicvf_plat.h +++ b/drivers/net/thunderx/base/nicvf_plat.h @@ -44,7 +44,7 @@ /* Constants */ #include -#define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN +#define NICVF_MAC_ADDR_SIZE RTE_ETHER_ADDR_LEN #include #define nicvf_addr_write(addr, val) rte_write64_relaxed((val), (void *)(addr)) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 482968b7a..3692c4b58 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -191,7 +191,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) (frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS)) return -EINVAL; - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -200,7 +200,7 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) return -EINVAL; /* Update max_rx_pkt_len */ - rxmode->max_rx_pkt_len = mtu + ETHER_HDR_LEN; + rxmode->max_rx_pkt_len = mtu + RTE_ETHER_HDR_LEN; nic->mtu = mtu; for (i = 0; i < nic->sqs_count; i++) @@ -1408,8 +1408,8 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if (nicvf_hw_version(nic) != PCI_SUB_DEVICE_ID_CN81XX_NICVF) dev_info->speed_capa |= ETH_LINK_SPEED_40G; - dev_info->min_rx_bufsize = ETHER_MIN_MTU; - dev_info->max_rx_pktlen = NIC_HW_MAX_MTU + ETHER_HDR_LEN; + dev_info->min_rx_bufsize = RTE_ETHER_MIN_MTU; + dev_info->max_rx_pktlen = NIC_HW_MAX_MTU + RTE_ETHER_HDR_LEN; dev_info->max_rx_queues = (uint16_t)MAX_RCV_QUEUES_PER_QS * (MAX_SQS_PER_VF + 1); dev_info->max_tx_queues = @@ -1736,7 +1736,7 @@ nicvf_dev_start(struct rte_eth_dev *dev) /* Setup MTU based on max_rx_pkt_len or default */ mtu = dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME ? dev->data->dev_conf.rxmode.max_rx_pkt_len - - ETHER_HDR_LEN : ETHER_MTU; + - RTE_ETHER_HDR_LEN : RTE_ETHER_MTU; if (nicvf_dev_set_mtu(dev, mtu)) { PMD_INIT_LOG(ERR, "Failed to set default mtu size"); @@ -2173,7 +2173,7 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) return ENOTSUP; } - eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate memory for mac addr"); ret = -ENOMEM; diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h index dd52f38e5..5d1379803 100644 --- a/drivers/net/thunderx/nicvf_struct.h +++ b/drivers/net/thunderx/nicvf_struct.h @@ -105,7 +105,7 @@ struct nicvf { uint16_t mtu; int skip_bytes; bool vlan_filter_en; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; /* secondary queue set support */ uint8_t sqs_id; uint8_t sqs_count; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 445f89989..40b9b81fc 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -832,16 +832,16 @@ static int virtio_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct virtio_hw *hw = dev->data->dev_private; - uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + + uint32_t ether_hdr_len = RTE_ETHER_HDR_LEN + VLAN_TAG_LEN + hw->vtnet_hdr_size; uint32_t frame_size = mtu + ether_hdr_len; uint32_t max_frame_size = hw->max_mtu + ether_hdr_len; max_frame_size = RTE_MIN(max_frame_size, VIRTIO_MAX_RX_PKTLEN); - if (mtu < ETHER_MIN_MTU || frame_size > max_frame_size) { + if (mtu < RTE_ETHER_MIN_MTU || frame_size > max_frame_size) { PMD_INIT_LOG(ERR, "MTU should be between %d and %d", - ETHER_MIN_MTU, max_frame_size - ether_hdr_len); + RTE_ETHER_MIN_MTU, max_frame_size - ether_hdr_len); return -EINVAL; } return 0; @@ -1097,7 +1097,7 @@ virtio_set_hwaddr(struct virtio_hw *hw) { vtpci_write_dev_config(hw, offsetof(struct virtio_net_config, mac), - &hw->mac_addr, ETHER_ADDR_LEN); + &hw->mac_addr, RTE_ETHER_ADDR_LEN); } static void @@ -1106,7 +1106,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) if (vtpci_with_feature(hw, VIRTIO_NET_F_MAC)) { vtpci_read_dev_config(hw, offsetof(struct virtio_net_config, mac), - &hw->mac_addr, ETHER_ADDR_LEN); + &hw->mac_addr, RTE_ETHER_ADDR_LEN); } else { rte_eth_random_addr(&hw->mac_addr[0]); virtio_set_hwaddr(hw); @@ -1129,10 +1129,10 @@ virtio_mac_table_set(struct virtio_hw *hw, ctrl.hdr.class = VIRTIO_NET_CTRL_MAC; ctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_TABLE_SET; - len[0] = uc->entries * ETHER_ADDR_LEN + sizeof(uc->entries); + len[0] = uc->entries * RTE_ETHER_ADDR_LEN + sizeof(uc->entries); memcpy(ctrl.data, uc, len[0]); - len[1] = mc->entries * ETHER_ADDR_LEN + sizeof(mc->entries); + len[1] = mc->entries * RTE_ETHER_ADDR_LEN + sizeof(mc->entries); memcpy(ctrl.data + len[0], mc, len[1]); err = virtio_send_command(hw->cvq, &ctrl, len, 2); @@ -1155,9 +1155,9 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, return -EINVAL; } - uc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(uc->entries)); + uc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(uc->entries)); uc->entries = 0; - mc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(mc->entries)); + mc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(mc->entries)); mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { @@ -1166,7 +1166,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, struct virtio_net_ctrl_mac *tbl = rte_is_multicast_ether_addr(addr) ? mc : uc; - memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN); + memcpy(&tbl->macs[tbl->entries++], addr, RTE_ETHER_ADDR_LEN); } return virtio_mac_table_set(hw, uc, mc); @@ -1185,9 +1185,9 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) return; } - uc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(uc->entries)); + uc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(uc->entries)); uc->entries = 0; - mc = alloca(VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN + sizeof(mc->entries)); + mc = alloca(VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN + sizeof(mc->entries)); mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { @@ -1197,7 +1197,7 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) continue; tbl = rte_is_multicast_ether_addr(addrs + i) ? mc : uc; - memcpy(&tbl->macs[tbl->entries++], addrs + i, ETHER_ADDR_LEN); + memcpy(&tbl->macs[tbl->entries++], addrs + i, RTE_ETHER_ADDR_LEN); } virtio_mac_table_set(hw, uc, mc); @@ -1208,17 +1208,17 @@ virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct virtio_hw *hw = dev->data->dev_private; - memcpy(hw->mac_addr, mac_addr, ETHER_ADDR_LEN); + memcpy(hw->mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); /* Use atomic update if available */ if (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) { struct virtio_pmd_ctrl ctrl; - int len = ETHER_ADDR_LEN; + int len = RTE_ETHER_ADDR_LEN; ctrl.hdr.class = VIRTIO_NET_CTRL_MAC; ctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_ADDR_SET; - memcpy(ctrl.data, mac_addr, ETHER_ADDR_LEN); + memcpy(ctrl.data, mac_addr, RTE_ETHER_ADDR_LEN); return virtio_send_command(hw->cvq, &ctrl, &len, 1); } @@ -1297,7 +1297,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features) offsetof(struct virtio_net_config, mtu), &config.mtu, sizeof(config.mtu)); - if (config.mtu < ETHER_MIN_MTU) + if (config.mtu < RTE_ETHER_MIN_MTU) req_features &= ~(1ULL << VIRTIO_NET_F_MTU); } @@ -1710,7 +1710,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) * time, but check again in case it has changed since * then, which should not happen. */ - if (config->mtu < ETHER_MIN_MTU) { + if (config->mtu < RTE_ETHER_MIN_MTU) { PMD_INIT_LOG(ERR, "invalid max MTU value (%u)", config->mtu); return -1; @@ -1721,7 +1721,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) eth_dev->data->mtu = config->mtu; } else { - hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - ETHER_HDR_LEN - + hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - RTE_ETHER_HDR_LEN - VLAN_TAG_LEN - hw->vtnet_hdr_size; } @@ -1736,7 +1736,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) } else { PMD_INIT_LOG(DEBUG, "config->max_virtqueue_pairs=1"); hw->max_queue_pairs = 1; - hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - ETHER_HDR_LEN - + hw->max_mtu = VIRTIO_MAX_RX_PKTLEN - RTE_ETHER_HDR_LEN - VLAN_TAG_LEN - hw->vtnet_hdr_size; } @@ -1835,11 +1835,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) } /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("virtio", VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN, 0); + eth_dev->data->mac_addrs = rte_zmalloc("virtio", VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", - VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN); + VIRTIO_MAX_MAC_ADDRS * RTE_ETHER_ADDR_LEN); return -ENOMEM; } @@ -1989,7 +1989,7 @@ virtio_dev_configure(struct rte_eth_dev *dev) const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; const struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode; struct virtio_hw *hw = dev->data->dev_private; - uint32_t ether_hdr_len = ETHER_HDR_LEN + VLAN_TAG_LEN + + uint32_t ether_hdr_len = RTE_ETHER_HDR_LEN + VLAN_TAG_LEN + hw->vtnet_hdr_size; uint64_t rx_offloads = rxmode->offloads; uint64_t tx_offloads = txmode->offloads; diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 38a0261da..a38cb45ad 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -251,7 +251,7 @@ struct virtio_hw { bool has_tx_offload; bool has_rx_offload; uint16_t port_id; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; uint32_t notify_off_multiplier; uint8_t *isr; uint16_t *notify_base; @@ -294,7 +294,7 @@ extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS]; */ struct virtio_net_config { /* The config defining mac address (if VIRTIO_NET_F_MAC) */ - uint8_t mac[ETHER_ADDR_LEN]; + uint8_t mac[RTE_ETHER_ADDR_LEN]; /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ uint16_t status; uint16_t max_virtqueue_pairs; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index ab3b6cf1b..12283cd4c 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1244,7 +1244,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) PMD_RX_LOG(DEBUG, "packet len:%d", len[i]); - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); @@ -1347,7 +1347,7 @@ virtio_recv_pkts_packed(void *rx_queue, struct rte_mbuf **rx_pkts, PMD_RX_LOG(DEBUG, "packet len:%d", len[i]); - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); @@ -1461,7 +1461,7 @@ virtio_recv_pkts_inorder(void *rx_queue, rxm = rcv_pkts[i]; - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf_inorder(vq, rxm); @@ -1653,7 +1653,7 @@ virtio_recv_mergeable_pkts(void *rx_queue, rxm = rcv_pkts[i]; - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); @@ -1832,7 +1832,7 @@ virtio_recv_mergeable_pkts_packed(void *rx_queue, rxm = rcv_pkts[i]; - if (unlikely(len[i] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[i] < hdr_size + RTE_ETHER_HDR_LEN)) { PMD_RX_LOG(ERR, "Packet drop"); nb_enqueued++; virtio_discard_rxbuf(vq, rxm); diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c index fbd9e979d..76bf75423 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c @@ -135,7 +135,7 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq, memset(&ifr, 0, sizeof(ifr)); ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; - memcpy(ifr.ifr_hwaddr.sa_data, mac, ETHER_ADDR_LEN); + memcpy(ifr.ifr_hwaddr.sa_data, mac, RTE_ETHER_ADDR_LEN); if (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) { PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", strerror(errno)); goto error; diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 8e420bcbc..e743695e4 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -226,15 +226,15 @@ static inline void parse_mac(struct virtio_user_dev *dev, const char *mac) { int i, r; - uint32_t tmp[ETHER_ADDR_LEN]; + uint32_t tmp[RTE_ETHER_ADDR_LEN]; if (!mac) return; r = sscanf(mac, "%x:%x:%x:%x:%x:%x", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]); - if (r == ETHER_ADDR_LEN) { - for (i = 0; i < ETHER_ADDR_LEN; ++i) + if (r == RTE_ETHER_ADDR_LEN) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) dev->mac_addr[i] = (uint8_t)tmp[i]; dev->mac_specified = 1; } else { diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index 829ad4140..db7dc607a 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -43,7 +43,7 @@ struct virtio_user_dev { uint64_t unsupported_features; /* unsupported features mask */ uint8_t status; uint16_t port_id; - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; char path[PATH_MAX]; union { struct vring vrings[VIRTIO_MAX_VIRTQUEUES]; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 129c2b9ef..893f48a5d 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -118,8 +118,8 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, struct virtio_user_dev *dev = virtio_user_get_dev(hw); if (offset == offsetof(struct virtio_net_config, mac) && - length == ETHER_ADDR_LEN) { - for (i = 0; i < ETHER_ADDR_LEN; ++i) + length == RTE_ETHER_ADDR_LEN) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) ((uint8_t *)dst)[i] = dev->mac_addr[i]; return; } @@ -179,8 +179,8 @@ virtio_user_write_dev_config(struct virtio_hw *hw, size_t offset, struct virtio_user_dev *dev = virtio_user_get_dev(hw); if ((offset == offsetof(struct virtio_net_config, mac)) && - (length == ETHER_ADDR_LEN)) - for (i = 0; i < ETHER_ADDR_LEN; ++i) + (length == RTE_ETHER_ADDR_LEN)) + for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i) dev->mac_addr[i] = ((const uint8_t *)src)[i]; else PMD_DRV_LOG(ERR, "not supported offset=%zu, len=%d", diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index e9dedc5da..c6dd4a347 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -134,7 +134,7 @@ enum { VTNET_RQ = 0, VTNET_TQ = 1, VTNET_CQ = 2 }; */ struct virtio_net_ctrl_mac { uint32_t entries; - uint8_t macs[][ETHER_ADDR_LEN]; + uint8_t macs[][RTE_ETHER_ADDR_LEN]; } __attribute__((__packed__)); #define VIRTIO_NET_CTRL_MAC 1 diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 3ac65d0e4..2aae8cb0c 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -302,12 +302,12 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) memcpy(hw->perm_addr + 4, &mac_hi, 2); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("vmxnet3", ETHER_ADDR_LEN * + eth_dev->data->mac_addrs = rte_zmalloc("vmxnet3", RTE_ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS); + RTE_ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS); return -ENOMEM; } /* Copy the permanent MAC address */ diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index 5bc3a84c9..e5ad684cf 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -67,7 +67,7 @@ struct vmxnet3_hw { uint16_t subsystem_vendor_id; bool adapter_stopped; - uint8_t perm_addr[ETHER_ADDR_LEN]; + uint8_t perm_addr[RTE_ETHER_ADDR_LEN]; uint8_t num_tx_queues; uint8_t num_rx_queues; uint8_t bufs_per_pkt; diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 9fa492978..bf9d36615 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -62,7 +62,7 @@ static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { diff --git a/examples/bond/main.c b/examples/bond/main.c index 23171f4cf..04102b7ed 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -120,7 +120,7 @@ static struct rte_mempool *mbuf_pool; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .rx_adv_conf = { @@ -304,13 +304,13 @@ get_vlan_offset(struct rte_ether_hdr *eth_hdr, uint16_t *proto) { size_t vlan_offset = 0; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; - if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { + if (rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; @@ -372,12 +372,12 @@ static int lcore_main(__attribute__((unused)) void *arg1) } eth_hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) printf("VLAN taged frame, offset:"); offset = get_vlan_offset(eth_hdr, ðer_type); if (offset > 0) printf("%d\n", offset); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP)) { if (rte_spinlock_trylock(&global_flag_stru_p->lock) == 1) { global_flag_stru_p->port_packets[1]++; rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -400,7 +400,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) rte_eth_tx_burst(BOND_PORT, 0, NULL, 0); } } - } else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { if (rte_spinlock_trylock(&global_flag_stru_p->lock) == 1) { global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -475,19 +475,19 @@ static void cmd_obj_send_parsed(void *parsed_result, eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); - memset(ð_hdr->d_addr, 0xFF, ETHER_ADDR_LEN); - eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); + memset(ð_hdr->d_addr, 0xFF, RTE_ETHER_ADDR_LEN); + eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct rte_ether_hdr)); arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); - arp_hdr->arp_protocol = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hlen = ETHER_ADDR_LEN; + arp_hdr->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); + arp_hdr->arp_hlen = RTE_ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REQUEST); rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; - memset(&arp_hdr->arp_data.arp_tha, 0, ETHER_ADDR_LEN); + memset(&arp_hdr->arp_data.arp_tha, 0, RTE_ETHER_ADDR_LEN); arp_hdr->arp_data.arp_tip = ((unsigned char *)&res->ip.addr.ipv4)[0] | (((unsigned char *)&res->ip.addr.ipv4)[1] << 8) | diff --git a/examples/distributor/main.c b/examples/distributor/main.c index e4c8c3c18..81d7ca61d 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -81,7 +81,7 @@ struct app_stats prev_app_stats; static const struct rte_eth_conf port_conf_default = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index ce7f715f8..b6b967118 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -530,8 +530,8 @@ pcmd_mtu_callback(void *ptr_params, new_mtu = atoi(params->opt); new_mtu = strtoul(params->opt, &ptr_parse_end, 10); if (*ptr_parse_end != '\0' || - new_mtu < ETHER_MIN_MTU || - new_mtu > ETHER_MAX_JUMBO_FRAME_LEN) { + new_mtu < RTE_ETHER_MIN_MTU || + new_mtu > RTE_ETHER_MAX_JUMBO_FRAME_LEN) { printf("Port %i: Invalid MTU value\n", params->port); return; } diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index 63227f0d5..f4e57f541 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -253,7 +253,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) static const struct rte_eth_conf port_conf_default = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, .rx_adv_conf = { .rss_conf = { diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index 5ae81fab1..dfb7db1c9 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -61,7 +61,7 @@ const char cb_port_delim[] = ":"; static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index cf9421874..09dbbcea9 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -47,8 +47,8 @@ struct rte_flow *flow; static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", what, buf); } diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index ed92d6f06..b34a2228f 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -52,15 +52,15 @@ * Default byte size for the IPv6 Maximum Transfer Unit (MTU). * This value includes the size of IPv6 header. */ -#define IPV4_MTU_DEFAULT ETHER_MTU -#define IPV6_MTU_DEFAULT ETHER_MTU +#define IPV4_MTU_DEFAULT RTE_ETHER_MTU +#define IPV6_MTU_DEFAULT RTE_ETHER_MTU /* * The overhead from max frame size to MTU. * We have to consider the max possible overhead. */ #define MTU_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct rte_vlan_hdr)) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 2 * sizeof(struct rte_vlan_hdr)) /* * Default payload in bytes for the IPv6 packet. @@ -355,9 +355,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, /* src addr */ rte_ether_addr_copy(&ports_eth_addr[port_out], ð_hdr->s_addr); if (ipv6) - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv6); else - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); } len += len2; @@ -570,8 +570,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -675,9 +675,9 @@ parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c index e3d0b3758..e9262e079 100644 --- a/examples/ip_pipeline/kni.c +++ b/examples/ip_pipeline/kni.c @@ -86,7 +86,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) if (!rte_eth_dev_is_valid_port(port_id)) return -EINVAL; - if (new_mtu > ETHER_MAX_LEN) + if (new_mtu > RTE_ETHER_MAX_LEN) return -EINVAL; /* Set new MTU */ diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c index 4777f9ffd..3fffeb586 100644 --- a/examples/ip_pipeline/parser.c +++ b/examples/ip_pipeline/parser.c @@ -518,7 +518,7 @@ my_ether_aton(const char *a) { int i; char *end; - unsigned long o[ETHER_ADDR_LEN]; + unsigned long o[RTE_ETHER_ADDR_LEN]; static struct rte_ether_addr ether_addr; i = 0; @@ -535,14 +535,14 @@ my_ether_aton(const char *a) return NULL; /* Support the format XX:XX:XX:XX:XX:XX */ - if (i == ETHER_ADDR_LEN) { + if (i == RTE_ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) return NULL; ether_addr.addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ - } else if (i == ETHER_ADDR_LEN / 2) { + } else if (i == RTE_ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return NULL; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 3a98e644f..c2a1f9228 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -362,7 +362,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, dst_port = next_hop; } - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; @@ -400,7 +400,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, dst_port = next_hop; } - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6); + eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv6); } /* if packet wasn't IPv4 or IPv6, it's forwarded to the port it came from */ @@ -693,8 +693,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 959fa569a..05c187c4c 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -211,7 +211,7 @@ static struct lcore_conf lcore_conf[RTE_MAX_LCORE]; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -236,8 +236,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) struct rte_ether_hdr *eth; eth = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { - nlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN); + if (eth->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { + nlp = (uint8_t *)rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p)); if (*nlp == IPPROTO_ESP) t->ipsec.pkts[(t->ipsec.num)++] = pkt; @@ -247,8 +247,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) } pkt->l2_len = 0; pkt->l3_len = sizeof(struct ip); - } else if (eth->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { - nlp = (uint8_t *)rte_pktmbuf_adj(pkt, ETHER_HDR_LEN); + } else if (eth->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { + nlp = (uint8_t *)rte_pktmbuf_adj(pkt, RTE_ETHER_HDR_LEN); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip6_hdr, ip6_nxt)); if (*nlp == IPPROTO_ESP) t->ipsec.pkts[(t->ipsec.num)++] = pkt; @@ -329,12 +329,12 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, ip = rte_pktmbuf_mtod(pkt, struct ip *); - ethhdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); + ethhdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, RTE_ETHER_HDR_LEN); if (ip->ip_v == IPVERSION) { pkt->ol_flags |= qconf->outbound.ipv4_offloads; pkt->l3_len = sizeof(struct ip); - pkt->l2_len = ETHER_HDR_LEN; + pkt->l2_len = RTE_ETHER_HDR_LEN; ip->ip_sum = 0; @@ -342,13 +342,13 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0) ip->ip_sum = rte_ipv4_cksum((struct ipv4_hdr *)ip); - ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); } else { pkt->ol_flags |= qconf->outbound.ipv6_offloads; pkt->l3_len = sizeof(struct ip6_hdr); - pkt->l2_len = ETHER_HDR_LEN; + pkt->l2_len = RTE_ETHER_HDR_LEN; - ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); } memcpy(ðhdr->s_addr, ðaddr_tbl[port].src, @@ -1428,8 +1428,8 @@ parse_args(int32_t argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 8f84545df..cc9a30c4c 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -279,7 +279,7 @@ mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, rte_ether_addr_copy(dest_addr, ðdr->d_addr); rte_ether_addr_copy(&ports_eth_addr[port], ðdr->s_addr); - ethdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); + ethdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPv4); /* Put new packet into the output queue */ len = qconf->tx_mbufs[port].len; @@ -537,8 +537,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/kni/main.c b/examples/kni/main.c index c96095f5f..75b55f39b 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -760,7 +760,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) memcpy(&conf, &port_conf, sizeof(conf)); /* Set new MTU */ - if (new_mtu > ETHER_MAX_LEN) + if (new_mtu > RTE_ETHER_MAX_LEN) conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -834,8 +834,8 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) static void print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, mac_addr); RTE_LOG(INFO, APP, "\t%s%s\n", name, buf); } diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index 1a8af28e2..b34b40a00 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -20,7 +20,7 @@ #define BURST_SIZE 32 static const struct rte_eth_conf port_conf_default = { - .rxmode = { .max_rx_pkt_len = ETHER_MAX_LEN } + .rxmode = { .max_rx_pkt_len = RTE_ETHER_MAX_LEN } }; /* l2fwd-cat.c: CAT enabled, basic DPDK skeleton forwarding example. */ diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index a77b000a9..973a371bf 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -212,7 +212,7 @@ struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE]; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { @@ -396,7 +396,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (eth_hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (eth_hdr->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) return -1; ipdata_offset = sizeof(struct rte_ether_hdr); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 4b94c246a..ab8ba046b 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -125,7 +125,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -1701,7 +1701,7 @@ parse_args(int argc, char **argv) /* * if no max-pkt-len set, then use the - * default value ETHER_MAX_LEN + * default value RTE_ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -1756,8 +1756,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 7d57a7f39..2725bb40b 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -200,7 +200,7 @@ uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -624,9 +624,9 @@ parse_ptype_one(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; @@ -1534,7 +1534,7 @@ parse_args(int argc, char **argv) /** * if no max-pkt-len set, use the default value - * ETHER_MAX_LEN + * RTE_ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -1579,8 +1579,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 56a55ac28..d9b636806 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -159,7 +159,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -790,8 +790,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index 64e79b946..b56b08646 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -572,7 +572,7 @@ em_parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = (struct ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; @@ -584,7 +584,7 @@ em_parse_ptype(struct rte_mbuf *m) packet_type |= RTE_PTYPE_L4_UDP; } else packet_type |= RTE_PTYPE_L3_IPV4_EXT; - } else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { + } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { ipv6_hdr = (struct ipv6_hdr *)l3; if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP; diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index d7e1aef86..96143d871 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -378,9 +378,9 @@ lpm_parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index ad013bae8..0fa9dc3a1 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -118,7 +118,7 @@ static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) / static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -562,7 +562,7 @@ parse_args(int argc, char **argv) /* * if no max-pkt-len set, use the default - * value ETHER_MAX_LEN. + * value RTE_ETHER_MAX_LEN. */ if (getopt_long(argc, argvopt, "", &lenopts, &option_index) == 0) { @@ -636,8 +636,8 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + char buf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -808,7 +808,7 @@ main(int argc, char **argv) /* pre-init dst MACs for all ports to 02:00:00:00:00:xx */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) { dest_eth_addr[portid] = - ETHER_LOCAL_ADMIN_ADDR + ((uint64_t)portid << 40); + RTE_ETHER_LOCAL_ADMIN_ADDR + ((uint64_t)portid << 40); *(uint64_t *)(val_eth + portid) = dest_eth_addr[portid]; } diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index bd1ec8fa0..3d2ceea2f 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -98,9 +98,9 @@ parse_ptype(struct rte_mbuf *m) eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) + else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; m->packet_type = packet_type; @@ -302,7 +302,7 @@ static uint16_t nb_tx_thread_params = RTE_DIM(tx_thread_params_array_default); static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, @@ -2975,7 +2975,7 @@ parse_args(int argc, char **argv) port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; - /* if no max-pkt-len set, use the default value ETHER_MAX_LEN */ + /* if no max-pkt-len set, use the default value RTE_ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -3022,9 +3022,9 @@ parse_args(int argc, char **argv) static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { - char buf[ETHER_ADDR_FMT_SIZE]; + char buf[RTE_ETHER_ADDR_FMT_SIZE]; - rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3488,7 +3488,7 @@ main(int argc, char **argv) /* pre-init dst MACs for all ports to 02:00:00:00:00:xx */ for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) { - dest_eth_addr[portid] = ETHER_LOCAL_ADMIN_ADDR + + dest_eth_addr[portid] = RTE_ETHER_LOCAL_ADMIN_ADDR + ((uint64_t)portid << 40); *(uint64_t *)(val_eth + portid) = dest_eth_addr[portid]; } diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 1266f521c..95b0c176e 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -49,7 +49,7 @@ static uint8_t ptp_enabled_ports[RTE_MAX_ETHPORTS]; static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 9f3344bf1..5f44f3b8c 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -54,7 +54,7 @@ static struct rte_mempool *pool = NULL; static struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_RSS, - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 37c2b95fd..1209bd7ce 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -57,7 +57,7 @@ struct flow_conf qos_conf[MAX_DATA_STREAMS]; static struct rte_eth_conf port_conf = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, .split_hdr_size = 0, }, .txmode = { diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index a277519f5..640a4152d 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -19,7 +19,7 @@ static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 7e3cd8715..a8a8e98f0 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -19,7 +19,7 @@ static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index ed2a405d5..48a46d536 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -16,9 +16,9 @@ static uint16_t get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags) { - if (ethertype == ETHER_TYPE_IPv4) + if (ethertype == RTE_ETHER_TYPE_IPv4) return rte_ipv4_phdr_cksum(l3_hdr, ol_flags); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ return rte_ipv6_phdr_cksum(l3_hdr, ol_flags); } @@ -38,20 +38,20 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, info->outer_l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); info->outer_l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); } switch (ethertype) { - case ETHER_TYPE_IPv4: + case RTE_ETHER_TYPE_IPv4: ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->outer_l2_len); info->outer_l3_len = sizeof(struct ipv4_hdr); *l4_proto = ipv4_hdr->next_proto_id; break; - case ETHER_TYPE_IPv6: + case RTE_ETHER_TYPE_IPv6: ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->outer_l2_len); info->outer_l3_len = sizeof(struct ipv6_hdr); @@ -83,7 +83,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i info->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); info->l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); @@ -91,14 +91,14 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i l3_hdr = (char *)eth_hdr + info->l2_len; - if (ethertype == ETHER_TYPE_IPv4) { + if (ethertype == RTE_ETHER_TYPE_IPv4) { ipv4_hdr = (struct ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_IPV4; ol_flags |= PKT_TX_IP_CKSUM; info->l3_len = sizeof(struct ipv4_hdr); l4_proto = ipv4_hdr->next_proto_id; - } else if (ethertype == ETHER_TYPE_IPv6) { + } else if (ethertype == RTE_ETHER_TYPE_IPv6) { ipv6_hdr = (struct ipv6_hdr *)l3_hdr; info->l3_len = sizeof(struct ipv6_hdr); l4_proto = ipv6_hdr->proto; @@ -206,7 +206,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) m->l2_len = tx_offload.l2_len; m->l3_len = tx_offload.l3_len; m->l4_len = tx_offload.l4_len; - m->l2_len += ETHER_VXLAN_HLEN; + m->l2_len += RTE_ETHER_VXLAN_HLEN; } m->outer_l2_len = sizeof(struct rte_ether_hdr); @@ -228,7 +228,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) + sizeof(struct rte_vxlan_hdr)); udp->dst_port = rte_cpu_to_be_16(vxdev.dst_port); - hash = rte_hash_crc(phdr, 2 * ETHER_ADDR_LEN, phdr->ether_type); + hash = rte_hash_crc(phdr, 2 * RTE_ETHER_ADDR_LEN, phdr->ether_type); udp->src_port = rte_cpu_to_be_16((((uint64_t) hash * PORT_RANGE) >> 32) + PORT_MIN); diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 18a2215b4..0b6b2d86e 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -251,7 +251,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) return -1; } - for (i = 0; i < ETHER_ADDR_LEN; i++) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) { vdev->mac_address.addr_bytes[i] = vxdev.port[portid].vport_mac.addr_bytes[i] = pkt_hdr->s_addr.addr_bytes[i]; @@ -313,7 +313,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) &app_l2_hdr[portid].d_addr); rte_ether_addr_copy(&ports_eth_addr[0], &app_l2_hdr[portid].s_addr); - app_l2_hdr[portid].ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + app_l2_hdr[portid].ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip = &app_ip_hdr[portid]; ip->version_ihl = IP_VHL_DEF; @@ -371,7 +371,7 @@ vxlan_unlink(struct vhost_dev *vdev) vdev->rx_q); return; } - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) vdev->mac_address.addr_bytes[i] = 0; /* Clear out the receive buffers */ diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 96d697677..cbd8e248d 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -693,7 +693,7 @@ link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m) return -1; } - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) vdev->mac_address.addr_bytes[i] = pkt_hdr->s_addr.addr_bytes[i]; /* vlan_tag currently uses the device_id. */ @@ -857,7 +857,7 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) { if (ol_flags & PKT_TX_IPV4) return rte_ipv4_phdr_cksum(l3_hdr, ol_flags); - else /* assume ethertype == ETHER_TYPE_IPv6 */ + else /* assume ethertype == RTE_ETHER_TYPE_IPv6 */ return rte_ipv6_phdr_cksum(l3_hdr, ol_flags); } @@ -947,7 +947,7 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) tx_q = &lcore_tx_queue[lcore_id]; nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) { + if (unlikely(nh->ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN))) { /* Guest has inserted the vlan tag. */ struct rte_vlan_hdr *vh = (struct rte_vlan_hdr *) (nh + 1); uint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag); diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index a2bec6242..b4de4e3a6 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -65,7 +65,7 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr) { int i; char *end; - unsigned long o[ETHER_ADDR_LEN]; + unsigned long o[RTE_ETHER_ADDR_LEN]; i = 0; do { @@ -81,14 +81,14 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr) return -1; /* Support the format XX:XX:XX:XX:XX:XX */ - if (i == ETHER_ADDR_LEN) { + if (i == RTE_ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) return -1; ether_addr->addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ - } else if (i == ETHER_ADDR_LEN / 2) { + } else if (i == RTE_ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return -1; diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index f018e1509..b0a3196bf 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -48,7 +48,7 @@ static volatile bool force_quit; /****************/ static const struct rte_eth_conf port_conf_default = { .rxmode = { - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = RTE_ETHER_MAX_LEN, }, }; diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index f5e4e2d12..ebeae2b2e 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -491,7 +491,7 @@ rte_eth_dev_allocate(const char *name) eth_dev = eth_dev_get(port_id); strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name)); eth_dev->data->port_id = port_id; - eth_dev->data->mtu = ETHER_MTU; + eth_dev->data->mtu = RTE_ETHER_MTU; unlock: rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock); @@ -1221,20 +1221,20 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, dev_info.max_rx_pktlen); ret = -EINVAL; goto rollback; - } else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { + } else if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN) { RTE_ETHDEV_LOG(ERR, "Ethdev port_id=%u max_rx_pkt_len %u < min valid value %u\n", port_id, dev_conf->rxmode.max_rx_pkt_len, - (unsigned)ETHER_MIN_LEN); + (unsigned)RTE_ETHER_MIN_LEN); ret = -EINVAL; goto rollback; } } else { - if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN || - dev_conf->rxmode.max_rx_pkt_len > ETHER_MAX_LEN) + if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN || + dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN) /* Use default value */ dev->data->dev_conf.rxmode.max_rx_pkt_len = - ETHER_MAX_LEN; + RTE_ETHER_MAX_LEN; } /* Any requested offloading must be within its device capabilities */ @@ -2549,7 +2549,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim = lim; dev_info->tx_desc_lim = lim; dev_info->device = dev->device; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->max_mtu = UINT16_MAX; RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); @@ -3085,7 +3085,7 @@ get_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) rte_eth_dev_info_get(port_id, &dev_info); for (i = 0; i < dev_info.max_mac_addrs; i++) - if (memcmp(addr, &dev->data->mac_addrs[i], ETHER_ADDR_LEN) == 0) + if (memcmp(addr, &dev->data->mac_addrs[i], RTE_ETHER_ADDR_LEN) == 0) return i; return -1; @@ -3219,7 +3219,7 @@ get_hash_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) for (i = 0; i < dev_info.max_hash_mac_addrs; i++) if (memcmp(addr, &dev->data->hash_mac_addrs[i], - ETHER_ADDR_LEN) == 0) + RTE_ETHER_ADDR_LEN) == 0) return i; return -1; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index fd8366043..50d98ec4b 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2284,7 +2284,7 @@ void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); * }; * * device = dev->device - * min_mtu = ETHER_MIN_MTU + * min_mtu = RTE_ETHER_MIN_MTU * max_mtu = UINT16_MAX * * The following fields will be populated if support for dev_infos_get() diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 958a8e77c..75c374552 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -605,7 +605,7 @@ static const struct rte_flow_item_eth rte_flow_item_eth_mask = { * Matches an 802.1Q/ad VLAN tag. * * The corresponding standard outer EtherType (TPID) values are - * ETHER_TYPE_VLAN or ETHER_TYPE_QINQ. It can be overridden by the preceding + * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by the preceding * pattern item. */ struct rte_flow_item_vlan { @@ -769,7 +769,7 @@ static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { * Matches a E-tag header. * * The corresponding standard outer EtherType (TPID) value is - * ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. + * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. */ struct rte_flow_item_e_tag { /** @@ -2119,7 +2119,7 @@ struct rte_flow_action_set_ttl { * Set MAC address from the matched flow */ struct rte_flow_action_set_mac { - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; }; /* diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index d248f387f..11d422573 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -621,21 +621,21 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, *ipv6_hdr = NULL; switch (eth_hdr->ether_type) { - case RTE_BE16(ETHER_TYPE_IPv4): + case RTE_BE16(RTE_ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); break; - case RTE_BE16(ETHER_TYPE_IPv6): + case RTE_BE16(RTE_ETHER_TYPE_IPv6): *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); break; - case RTE_BE16(ETHER_TYPE_VLAN): + case RTE_BE16(RTE_ETHER_TYPE_VLAN): vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { - case RTE_BE16(ETHER_TYPE_IPv4): + case RTE_BE16(RTE_ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); break; - case RTE_BE16(ETHER_TYPE_IPv6): + case RTE_BE16(RTE_ETHER_TYPE_IPv6): *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1); break; default: diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index d0975eda8..5f9873634 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -253,7 +253,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool, dev_info.mbuf_size = conf->mbuf_size; dev_info.mtu = conf->mtu; - memcpy(dev_info.mac_addr, conf->mac_addr, ETHER_ADDR_LEN); + memcpy(dev_info.mac_addr, conf->mac_addr, RTE_ETHER_ADDR_LEN); strlcpy(dev_info.name, conf->name, RTE_KNI_NAMESIZE); diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 9a9a7d754..950673339 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -68,7 +68,7 @@ struct rte_kni_conf { __extension__ uint8_t force_bind : 1; /* Flag to bind kernel thread */ - char mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ + char mac_addr[RTE_ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ uint16_t mtu; }; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 2274dc65d..b9dd8dc4f 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -29,15 +29,15 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, } /* Ethernet header. */ - memset(eth_hdr->d_addr.addr_bytes, 0xff, ETHER_ADDR_LEN); + memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN); rte_ether_addr_copy(mac, ð_hdr->s_addr); - eth_hdr->ether_type = htons(ETHER_TYPE_RARP); + eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP); /* RARP header. */ rarp = (struct rte_arp_hdr *)(eth_hdr + 1); rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER); - rarp->arp_protocol = htons(ETHER_TYPE_IPv4); - rarp->arp_hlen = ETHER_ADDR_LEN; + rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPv4); + rarp->arp_hlen = RTE_ETHER_ADDR_LEN; rarp->arp_plen = 4; rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index cc31fbd9b..b8b545f37 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -23,25 +23,25 @@ extern "C" { #include #include -#define ETHER_ADDR_LEN 6 /**< Length of Ethernet address. */ -#define ETHER_TYPE_LEN 2 /**< Length of Ethernet type field. */ -#define ETHER_CRC_LEN 4 /**< Length of Ethernet CRC. */ -#define ETHER_HDR_LEN \ - (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN) /**< Length of Ethernet header. */ -#define ETHER_MIN_LEN 64 /**< Minimum frame len, including CRC. */ -#define ETHER_MAX_LEN 1518 /**< Maximum frame len, including CRC. */ -#define ETHER_MTU \ - (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) /**< Ethernet MTU. */ - -#define ETHER_MAX_VLAN_FRAME_LEN \ - (ETHER_MAX_LEN + 4) /**< Maximum VLAN frame length, including CRC. */ - -#define ETHER_MAX_JUMBO_FRAME_LEN \ +#define RTE_ETHER_ADDR_LEN 6 /**< Length of Ethernet address. */ +#define RTE_ETHER_TYPE_LEN 2 /**< Length of Ethernet type field. */ +#define RTE_ETHER_CRC_LEN 4 /**< Length of Ethernet CRC. */ +#define RTE_ETHER_HDR_LEN \ + (RTE_ETHER_ADDR_LEN * 2 + RTE_ETHER_TYPE_LEN) /**< Length of Ethernet header. */ +#define RTE_ETHER_MIN_LEN 64 /**< Minimum frame len, including CRC. */ +#define RTE_ETHER_MAX_LEN 1518 /**< Maximum frame len, including CRC. */ +#define RTE_ETHER_MTU \ + (RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN) /**< Ethernet MTU. */ + +#define RTE_ETHER_MAX_VLAN_FRAME_LEN \ + (RTE_ETHER_MAX_LEN + 4) /**< Maximum VLAN frame length, including CRC. */ + +#define RTE_ETHER_MAX_JUMBO_FRAME_LEN \ 0x3F00 /**< Maximum Jumbo frame length, including CRC. */ -#define ETHER_MAX_VLAN_ID 4095 /**< Maximum VLAN ID. */ +#define RTE_ETHER_MAX_VLAN_ID 4095 /**< Maximum VLAN ID. */ -#define ETHER_MIN_MTU 68 /**< Minimum MTU for IPv4 packets, see RFC 791. */ +#define RTE_ETHER_MIN_MTU 68 /**< Minimum MTU for IPv4 packets, see RFC 791. */ /** * Ethernet address: @@ -55,11 +55,11 @@ extern "C" { * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ struct rte_ether_addr { - uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ + uint8_t addr_bytes[RTE_ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); -#define ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ -#define ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ +#define RTE_ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ +#define RTE_ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ /** * Check if two Ethernet addresses are the same. @@ -79,7 +79,7 @@ static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, const struct rte_ether_addr *ea2) { int i; - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) if (ea1->addr_bytes[i] != ea2->addr_bytes[i]) return 0; return 1; @@ -98,7 +98,7 @@ static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) if (ea->addr_bytes[i] != 0x00) return 0; return 1; @@ -116,7 +116,7 @@ static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_unicast_ether_addr(const struct rte_ether_addr *ea) { - return (ea->addr_bytes[0] & ETHER_GROUP_ADDR) == 0; + return (ea->addr_bytes[0] & RTE_ETHER_GROUP_ADDR) == 0; } /** @@ -131,7 +131,7 @@ static inline int rte_is_unicast_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_multicast_ether_addr(const struct rte_ether_addr *ea) { - return ea->addr_bytes[0] & ETHER_GROUP_ADDR; + return ea->addr_bytes[0] & RTE_ETHER_GROUP_ADDR; } /** @@ -164,7 +164,7 @@ static inline int rte_is_broadcast_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_universal_ether_addr(const struct rte_ether_addr *ea) { - return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) == 0; + return (ea->addr_bytes[0] & RTE_ETHER_LOCAL_ADMIN_ADDR) == 0; } /** @@ -179,7 +179,7 @@ static inline int rte_is_universal_ether_addr(const struct rte_ether_addr *ea) */ static inline int rte_is_local_admin_ether_addr(const struct rte_ether_addr *ea) { - return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) != 0; + return (ea->addr_bytes[0] & RTE_ETHER_LOCAL_ADMIN_ADDR) != 0; } /** @@ -209,9 +209,9 @@ static inline void rte_eth_random_addr(uint8_t *addr) uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; - rte_memcpy(addr, p, ETHER_ADDR_LEN); - addr[0] &= (uint8_t)~ETHER_GROUP_ADDR; /* clear multicast bit */ - addr[0] |= ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ + rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN); + addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR; /* clear multicast bit */ + addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ } /** @@ -240,7 +240,7 @@ static inline void rte_ether_addr_copy(const struct rte_ether_addr *ea_from, #endif } -#define ETHER_ADDR_FMT_SIZE 18 +#define RTE_ETHER_ADDR_FMT_SIZE 18 /** * Format 48bits Ethernet address in pattern xx:xx:xx:xx:xx:xx. * @@ -295,23 +295,23 @@ struct rte_vxlan_hdr { } __attribute__((__packed__)); /* Ethernet frame types */ -#define ETHER_TYPE_IPv4 0x0800 /**< IPv4 Protocol. */ -#define ETHER_TYPE_IPv6 0x86DD /**< IPv6 Protocol. */ -#define ETHER_TYPE_ARP 0x0806 /**< Arp Protocol. */ -#define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */ -#define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */ -#define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */ +#define RTE_ETHER_TYPE_IPv4 0x0800 /**< IPv4 Protocol. */ +#define RTE_ETHER_TYPE_IPv6 0x86DD /**< IPv6 Protocol. */ +#define RTE_ETHER_TYPE_ARP 0x0806 /**< Arp Protocol. */ +#define RTE_ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */ +#define RTE_ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */ +#define RTE_ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */ #define ETHER_TYPE_PPPOE_DISCOVERY 0x8863 /**< PPPoE Discovery Stage. */ #define ETHER_TYPE_PPPOE_SESSION 0x8864 /**< PPPoE Session Stage. */ -#define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */ -#define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */ -#define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */ -#define ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */ -#define ETHER_TYPE_LLDP 0x88CC /**< LLDP Protocol. */ -#define ETHER_TYPE_MPLS 0x8847 /**< MPLS ethertype. */ -#define ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */ - -#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) +#define RTE_ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */ +#define RTE_ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */ +#define RTE_ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */ +#define RTE_ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */ +#define RTE_ETHER_TYPE_LLDP 0x88CC /**< LLDP Protocol. */ +#define RTE_ETHER_TYPE_MPLS 0x8847 /**< MPLS ethertype. */ +#define RTE_ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */ + +#define RTE_ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -327,15 +327,15 @@ struct rte_vxlan_gpe_hdr { } __attribute__((__packed__)); /* VXLAN-GPE next protocol types */ -#define VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */ -#define VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */ -#define VXLAN_GPE_TYPE_ETH 3 /**< Ethernet Protocol. */ -#define VXLAN_GPE_TYPE_NSH 4 /**< NSH Protocol. */ -#define VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */ -#define VXLAN_GPE_TYPE_GBP 6 /**< GBP Protocol. */ -#define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ - -#define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ +#define RTE_VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */ +#define RTE_VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */ +#define RTE_VXLAN_GPE_TYPE_ETH 3 /**< Ethernet Protocol. */ +#define RTE_VXLAN_GPE_TYPE_NSH 4 /**< NSH Protocol. */ +#define RTE_VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */ +#define RTE_VXLAN_GPE_TYPE_GBP 6 /**< GBP Protocol. */ +#define RTE_VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ + +#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ @@ -356,7 +356,7 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); struct rte_vlan_hdr *vh; - if (eh->ether_type != rte_cpu_to_be_16(ETHER_TYPE_VLAN)) + if (eh->ether_type != rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) return -1; vh = (struct rte_vlan_hdr *)(eh + 1); @@ -365,7 +365,7 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) /* Copy ether header over rather than moving whole packet */ memmove(rte_pktmbuf_adj(m, sizeof(struct rte_vlan_hdr)), - eh, 2 * ETHER_ADDR_LEN); + eh, 2 * RTE_ETHER_ADDR_LEN); return 0; } @@ -404,8 +404,8 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) if (nh == NULL) return -ENOSPC; - memmove(nh, oh, 2 * ETHER_ADDR_LEN); - nh->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + memmove(nh, oh, 2 * RTE_ETHER_ADDR_LEN); + nh->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); vh = (struct rte_vlan_hdr *) (nh + 1); vh->vlan_tci = rte_cpu_to_be_16((*m)->vlan_tci); diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 315c37c55..5551cce17 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -155,16 +155,16 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, *off += opt_len[flags]; *proto = gh->proto; - if (*proto == rte_cpu_to_be_16(ETHER_TYPE_TEB)) + if (*proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_TEB)) return RTE_PTYPE_TUNNEL_NVGRE; else return RTE_PTYPE_TUNNEL_GRE; } case IPPROTO_IPIP: - *proto = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + *proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); return RTE_PTYPE_TUNNEL_IP; case IPPROTO_IPV6: - *proto = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + *proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); return RTE_PTYPE_TUNNEL_IP; /* IP is also valid for IPv6 */ default: return 0; @@ -249,10 +249,10 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_L2_MASK) == 0) return 0; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) goto l3; /* fast path if packet is IPv4 */ - if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -263,7 +263,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, off += sizeof(*vh); hdr_lens->l2_len += sizeof(*vh); proto = vh->eth_proto; - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -275,8 +275,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, off += 2 * sizeof(*vh); hdr_lens->l2_len += 2 * sizeof(*vh); proto = vh->eth_proto; - } else if ((proto == rte_cpu_to_be_16(ETHER_TYPE_MPLS)) || - (proto == rte_cpu_to_be_16(ETHER_TYPE_MPLSM))) { + } else if ((proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) || + (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLSM))) { unsigned int i; const struct mpls_hdr *mh; struct mpls_hdr mh_copy; @@ -299,7 +299,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_L3_MASK) == 0) return pkt_type; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { const struct ipv4_hdr *ip4h; struct ipv4_hdr ip4h_copy; @@ -322,7 +322,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } proto = ip4h->next_proto_id; pkt_type |= ptype_l4(proto); - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { const struct ipv6_hdr *ip6h; struct ipv6_hdr ip6h_copy; int frag = 0; @@ -391,7 +391,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; hdr_lens->inner_l2_len = 0; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_TEB)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_TEB)) { eh = rte_pktmbuf_read(m, off, sizeof(*eh), &eh_copy); if (unlikely(eh == NULL)) return pkt_type; @@ -401,7 +401,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l2_len = sizeof(*eh); } - if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -413,7 +413,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, off += sizeof(*vh); hdr_lens->inner_l2_len += sizeof(*vh); proto = vh->eth_proto; - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) { const struct rte_vlan_hdr *vh; struct rte_vlan_hdr vh_copy; @@ -431,7 +431,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L3_MASK) == 0) return pkt_type; - if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { const struct ipv4_hdr *ip4h; struct ipv4_hdr ip4h_copy; @@ -454,7 +454,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } proto = ip4h->next_proto_id; pkt_type |= ptype_inner_l4(proto); - } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { + } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { const struct ipv6_hdr *ip6h; struct ipv6_hdr ip6h_copy; int frag = 0; diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index d4318ecb0..224045e8a 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -611,8 +611,8 @@ encap_ether_apply(void *data, { struct encap_ether_data *d = data; uint16_t ethertype = (common_cfg->ip_version) ? - ETHER_TYPE_IPv4 : - ETHER_TYPE_IPv6; + RTE_ETHER_TYPE_IPv4 : + RTE_ETHER_TYPE_IPv6; /* Ethernet */ rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); @@ -629,13 +629,13 @@ encap_vlan_apply(void *data, { struct encap_vlan_data *d = data; uint16_t ethertype = (common_cfg->ip_version) ? - ETHER_TYPE_IPv4 : - ETHER_TYPE_IPv6; + RTE_ETHER_TYPE_IPv4 : + RTE_ETHER_TYPE_IPv6; /* Ethernet */ rte_ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* VLAN */ d->vlan.vlan_tci = rte_htons(VLAN(p->vlan.vlan.pcp, @@ -653,19 +653,19 @@ encap_qinq_apply(void *data, { struct encap_qinq_data *d = data; uint16_t ethertype = (common_cfg->ip_version) ? - ETHER_TYPE_IPv4 : - ETHER_TYPE_IPv6; + RTE_ETHER_TYPE_IPv4 : + RTE_ETHER_TYPE_IPv6; /* Ethernet */ rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_QINQ); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_QINQ); /* SVLAN */ d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp, p->qinq.svlan.dei, p->qinq.svlan.vid)); - d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN); + d->svlan.eth_proto = rte_htons(RTE_ETHER_TYPE_VLAN); /* CVLAN */ d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp, @@ -685,13 +685,13 @@ encap_qinq_pppoe_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* SVLAN */ d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp, p->qinq.svlan.dei, p->qinq.svlan.vid)); - d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN); + d->svlan.eth_proto = rte_htons(RTE_ETHER_TYPE_VLAN); /* CVLAN */ d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp, @@ -778,13 +778,13 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* VLAN */ d->vlan.vlan_tci = rte_htons(VLAN(p->vxlan.vlan.pcp, p->vxlan.vlan.dei, p->vxlan.vlan.vid)); - d->vlan.eth_proto = rte_htons(ETHER_TYPE_IPv4); + d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPv4); /* IPv4*/ d->ipv4.version_ihl = 0x45; @@ -817,7 +817,7 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_IPv4); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPv4); /* IPv4*/ d->ipv4.version_ihl = 0x45; @@ -852,13 +852,13 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_VLAN); /* VLAN */ d->vlan.vlan_tci = rte_htons(VLAN(p->vxlan.vlan.pcp, p->vxlan.vlan.dei, p->vxlan.vlan.vid)); - d->vlan.eth_proto = rte_htons(ETHER_TYPE_IPv6); + d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPv6); /* IPv6*/ d->ipv6.vtc_flow = rte_htonl((6 << 28) | @@ -891,7 +891,7 @@ encap_vxlan_apply(void *data, /* Ethernet */ rte_ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); rte_ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); - d->ether.ether_type = rte_htons(ETHER_TYPE_IPv6); + d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPv6); /* IPv6*/ d->ipv6.vtc_flow = rte_htonl((6 << 28) | diff --git a/lib/librte_port/rte_port_source_sink.c b/lib/librte_port/rte_port_source_sink.c index 54045f952..74b7385a2 100644 --- a/lib/librte_port/rte_port_source_sink.c +++ b/lib/librte_port/rte_port_source_sink.c @@ -368,7 +368,7 @@ pcap_sink_write_pkt(struct rte_port_sink *port, struct rte_mbuf *mbuf) { uint8_t *pcap_dumper = (port->dumper); struct pcap_pkthdr pcap_hdr; - uint8_t jumbo_pkt_buf[ETHER_MAX_JUMBO_FRAME_LEN]; + uint8_t jumbo_pkt_buf[RTE_ETHER_MAX_JUMBO_FRAME_LEN]; uint8_t *pkt; /* Maximum num packets already reached */ @@ -385,10 +385,10 @@ pcap_sink_write_pkt(struct rte_port_sink *port, struct rte_mbuf *mbuf) struct rte_mbuf *jumbo_mbuf; uint32_t pkt_index = 0; - /* if packet size longer than ETHER_MAX_JUMBO_FRAME_LEN, + /* if packet size longer than RTE_ETHER_MAX_JUMBO_FRAME_LEN, * ignore it. */ - if (mbuf->pkt_len > ETHER_MAX_JUMBO_FRAME_LEN) + if (mbuf->pkt_len > RTE_ETHER_MAX_JUMBO_FRAME_LEN) return; for (jumbo_mbuf = mbuf; jumbo_mbuf != NULL; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index a71cf0cf7..e8f3edc07 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -977,7 +977,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) m->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); - if (ethertype == ETHER_TYPE_VLAN) { + if (ethertype == RTE_ETHER_TYPE_VLAN) { struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); m->l2_len += sizeof(struct rte_vlan_hdr); @@ -987,14 +987,14 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) l3_hdr = (char *)eth_hdr + m->l2_len; switch (ethertype) { - case ETHER_TYPE_IPv4: + case RTE_ETHER_TYPE_IPv4: ipv4_hdr = l3_hdr; *l4_proto = ipv4_hdr->next_proto_id; m->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV4; break; - case ETHER_TYPE_IPv6: + case RTE_ETHER_TYPE_IPv6: ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; m->l3_len = sizeof(struct ipv6_hdr); -- 2.11.0